Improved Penalty Method Via Doubly Stochastic Gradients for Bilevel Hyperparameter Optimization

Improved Penalty Method Via Doubly Stochastic Gradients for Bilevel Hyperparameter Optimization

The Thirty-Fifth AAAI Conference on Artificial Intelligence (AAAI-21) Improved Penalty Method via Doubly Stochastic Gradients for Bilevel Hyperparameter Optimization Wanli Shi1, Bin Gu1,2,3* 1 Nanjing University of Information Science & Technology, P.R.China 2MBZUAI, United Arab Emirates 3JD Finance America Corporation, Mountain View, CA, USA [email protected], [email protected] Abstract of HO methods have emerged, such as grid search, random search (Bergstra et al. 2011; Bergstra and Bengio 2012), so- Hyperparameter optimization (HO) is an important problem lution path (Gu and Sheng 2017; Gu, Liu, and Huang 2017; in machine learning which is normally formulated as a bilevel optimization problem. Gradient-based methods are dominant Bao, Gu, and Huang 2019; Gu and Ling 2015), and sev- in bilevel optimization due to their high scalability to the eral Bayesian methods (Thornton et al. 2013; Brochu, Cora, number of hyperparameters, especially in a deep learning and De Freitas 2010; Swersky, Snoek, and Adams 2014; Wu problem. However, traditional gradient-based bilevel opti- et al. 2019). mization methods need intermediate steps to obtain the ex- In real-world applications, the number of hyperparame- act or approximate gradient of hyperparameters, namely hy- ters increases shapely, especially in a deep learning problem. pergradient, for the upper-level objective, whose complexity In these problems, gradient-based methods are dominant in is high especially for high dimensional datasets. Recently, bilevel problems with continuous hyperparameter set due a penalty method has been proposed to avoid the computa- tion of the hypergradient, which speeds up the gradient-based to their high scalability to the amount of hyperparameters. BHO methods. However, the penalty method may result in a The main idea of the gradient-based methods is to first ap- very large number of constraints, which greatly limits the ef- proximate the solution on the training set and then compute ficiency of this method, especially for high dimensional data the gradient descent direction for hyperparameters, namely problems. To address this limitation, in this paper, we propose hypergradient. However, calculating the exact hypergradient a doubly stochastic gradient descent algorithm (DSGPHO) to needs the computation of the inverse Hessian of the lower- improve the efficiency of the penalty method. Importantly, level problem, which makes it impractical for high dimen- we not only prove the proposed method can converge to the sional data problem. To solve this problem, many methods KKT condition of the original problem in a convex setting, have been proposed to approximate the hypergradient by us- but also provide the convergence rate of DSGPHO which is ing some intermediate steps, such as solving a linear system the first result in the references of gradient-based bilevel op- timization as far as we know. We compare our method with (the approximate methods (Domke 2012; Pedregosa 2016; three state-of-the-art gradient-based methods in three tasks, Rajeswaran et al. 2019)) or using reverse/forward mode dif- i.e., data denoising, few-shot learning, and training data poi- ferentiation (e.g. (Maclaurin, Duvenaud, and Adams 2015; soning, using several large-scale benchmark datasets. All the Domke 2012; Franceschi et al. 2017; Swersky, Snoek, and results demonstrate that our method outperforms or is com- Adams 2014)). Although these methods can avoid the com- parable to the existing methods in terms of accuracy and effi- putation of inverse Hessian, the intermediate steps usually ciency. need extra loops which will affect the efficiency of these gradient-based methods. Introduction Recently, (Mehra and Hamm 2019) pointed out that the intermediate steps are not necessary. They formulate the Hyperparameter optimization problems (HO) are at the cen- bilevel problem as a single level constrained problem, by ter of several important machine learning problems, which replacing the lower-level objective with its first-order opti- are usually formulated as bilevel optimization problems mal necessary condition. Then the penalty framework can (Feurer and Hutter 2019). Any machine learning algorithms be used to solve this constrained problem. With updating crucially depend on the choice of their hyperparameters. the model parameters and hyperparameters alternately, the However, manually tunning hyperparameters is often time- penalty method can finally obtain the exact hypergradient. It consuming, and depends heavily on human’s prior knowl- speeds up the gradient-based methods but brings a new prob- edge, which makes it difficult to find the optimal hyperpa- lem in the meanwhile. Since the constraints are calculated rameters. Therefore, to choose the set hyperparameters au- from the first order necessary condition of the lower-level tomatically has attracted great attention, and large amounts objective, it may lead to the optimization problem with a *Corresponding Authors large number of constraints, especially for high dimensional Copyright © 2021, Association for the Advancement of Artificial datasets or deep learning methods. Calculating the gradient Intelligence (www.aaai.org). All rights reserved. of the penalty term in such a heavily constrained problem 9621 Method Problem Update v Intermediate steps Time Space Convergence Rate 2 2 FMD Bilevel v v − ηrvg P = P (I − ηrvvg) − ηruvg O(dmT ) O(dm) − 2 p = p − ηruvg · q RMD Bilevel v v − ηrvg 2 O(dT ) O(dT + m) − q = (I − ηrvvg)q 2 2 Approx Bilevel v v − ηrvg Solve minq krvvg · q − rvfk2 O(dT ) O(d + m) − 2 Penalty Single level v v − η(rvf + µrvvg · rvg) Not reqired O(dT ) O(d + m) −p DSGPHO Single level v v − ηr~ vL Not reqired O(T ) O(d + m) O(1= K) Table 1: The complexity of various gradient methods for update the hyperparameters one time. Here d is the size of model parameters, m denotes the size of hyperparameters and T is the number of model parameters update per hypergradient compu- tation. r~ vL = r~ vf + [µcj + zj]rvcj where zj is the jth element of dual parameter, µ > 0 is the penalty parameter and cj is jth element of rvg. K denotes the total number of hyperparameter updates. will greatly limits its efficiency. ority of our method. To address this limitation, in this paper, we propose a dou- bly stochastic gradient descent method to improve the ef- Related Works ficiency of the penalty method (Mehra and Hamm 2019). Similar to (Mehra and Hamm 2019), we first transform the In this section, we give a brief review of the gradient-based bilevel problem to a single level constrained problem and hyperparameter optimization methods. give its corresponding augmented Lagrangian function. We As we mentioned in the previous section, many gradient first randomly sample a validation data instance to calculate method use some intermediate steps to approximate the hy- the stochastic gradient of the upper-level objective. Then, we pergradient. Specifically, (Franceschi et al. 2017; Maclaurin, randomly sample a constraint and calculate its correspond- Duvenaud, and Adams 2015; Shaban et al. 2019) use the ing gradient. By combining these terms together, we obtain forward/reverse mode differentiation (RMD/FMD) to ap- the stochastic gradient of the augmented Lagrangian func- proximate the hypergradient. Both of them view the train- tion, and update the model parameters and hyperparameters, ing procedure as dynamical system with a state vt+1 = alternately, by using this stochastic gradient. Since in our Φ(vt; u) := vt − ηrvg(u; vt), for t = 1; ··· ;T , where v method, we have two sources of randomness, i.e., the valida- denote the model parameters, u denotes the hyperparame- tion set and the constraints set, we can denote our method as ters, η is the learning rate and g is the training objective on a doubly stochastic gradient descent method for the penalty training set. According to (Feurer and Hutter 2019), RMD 2 hyperparameter optimization (DSGPHO). We prove that our needs another T iterations to calculate p = p − ηruvg · q 2 method can achieve the unbiased estimation of the exact hy- and q = (I − ηrvvg)q and then outputs the hypergradient pergradient asymptotically and it finally converges to the p, where I is the identity matrix. In each p update step we KKT point of the original problem. Importantly, we also pro- need O(d) time and space to calculate the Jacobian vector vide the convergence rate of DSGPHO which is the first re- product, where d is the size of model parameters. Totally, it sult in the references of gradient-based bilevel optimization needs O(dT ) time and O(m+T d) space to get the hypergra- as far as we know. We compare our method with three state- dient, where m is the size of hyperparameters. FMD needs 2 2 of-the-art gradient-based methods in three tasks, i.e., data to calculate P = P (I − ηrvvg) − ηruvg and update v at denoising, few-shot learning and training data poisoning, us- the same time. Then the hypergradient can be computed by ing several large scale benchmark datasets. All the results using P . (Feurer and Hutter 2019) pointed out that it needs demonstrate that our method outperforms or is comparable O(dm) time to get each P . Hence the time complexity for to the existing methods in terms of accuracy and efficiency. calculate one hypergradient is O(dmT ), and the space com- plexity is O(dm) for P is a d × m matrix. (Pedregosa 2016) Contributions We summarized the contributions as follows, 2 2 solve a linear problem minq krvvg · q − rvfk2 and use the 1. In this paper, we propose a doubly stochastic gradient solution to approximate the hypergradient. When using gra- descent method to improve the efficiency of the penalty dient method to solve this problem, we require O(d) time to method. Within each iteration, we randomly sample a val- obtain the Hessian-vector product in each iteration accord- idation instance and a constraint to calculate the stochastic ing to (Pearlmutter 1994).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us