betaFeedback

WorksMathematics

A Single-Loop, Constant-Batch First-Order Penalty Method for Stochastic Bilevel Optimization

Abstract

Recent advances in penalty-based methods for stochastic bilevel optimization (SBO) have eliminated the need for second-order derivative oracles. However, for stochastic nonconvex-strongly convex bilevel problems, existing first-order methods typically rely on nested loops and/or large batch sizes for attaining O(ε−6)O(ε^{-6}) or O(ε−4)O(ε^{-4}) sample complexity under standard bounded-variance assumption or mean-square smoothness assumption. Achieving these rates with a single-loop penalty method and a constant batch size remains challenging due to a large penalty value needed for an accurate approximation. To address this challenge, we develop a stochastic SIngle-loop COnstant-Batch first-order penalty method (SICO) that combines two complementary ingredients. First, it performs one stochastic-gradient update per-iteration for both the original lower-level and penalized problems, with a projection that controls the separation between their iterates. Second, it applies an exponential moving average to stabilize the upper-level gradient estimator. We show that this combination achieves O(ε−6) O(ε^{-6}) sample complexity using only O(1)O(1) stochastic-gradient samples per iteration under unbiased, bounded-variance stochastic gradients. Under the additional mean-square smoothness assumption on the lower-level stochastic gradients, the same algorithm improves the complexity to O(ε−4)O(ε^{-4}) also with O(1)O(1) batch size. To the best of our knowledge, this is the first work to match the best-known convergence rate for fully first-order SBO methods using a single loop and a constant batch size. This result addresses an open problem posed in the literature.

Introduction

In this paper we study nonconvex–strongly convex (NC–SC) stochastic bilevel optimization (SBO):

min⁡w∈RdwF(w):=f(w,y∗(w)),y∗(w):=arg⁡min⁡y∈Rdyg(w,y),(1)\min_{w\in\mathbb{R}^{d_w}} F(w) := f(w,y^*(w)), \qquad y^*(w) := \arg\min_{y\in\mathbb{R}^{d_y}} g(w,y), \tag*{(1)}

where the lower level (LL) function g(w,y):=Eξg∼Dgg(w,y,ξg)g(w,\mathbf{y}) := \mathbb{E}_{\xi_g\sim\mathcal{D}_g}g(w,\mathbf{y},\xi_g) is jointly smooth and strongly convex in y\mathbf{y} for every w\mathbf{w}, while the upper level (UL) function f(w,y):=Eξf∼Dff(w,y,ξf)f(\mathbf{w},\mathbf{y}) := \mathbb{E}_{\xi_f\sim\mathcal{D}_f} f(\mathbf{w},\mathbf{y},\xi_f) is smooth but potentially nonconvex. Both ff and gg are accessed through stochastic gradients. This formulation captures learning problems in which one optimization task depends on the solution of another, including hyperparameter optimization [5, 1], data hyper-cleaning and reweighting [6], and meta-learning with strongly convex inner problems [12, 14].

A substantial body of work has developed algorithms and convergence guarantees for this problem class. Representative contributions include early approximation methods [7], two-timescale stochastic approximation [11], improved hypergradient estimation and alternating stochastic updates [12, 4], momentum-based single-loop methods [10], and variance-reduced algorithms [22, 13, 9]. These approaches estimate the hypergradient ∇F(w)\nabla F(\mathbf{w}) by differentiating through the lower-level solution map. This typically requires second-order information, accessed through Hessian- or Jacobian-vector products (HVPs/JVPs) or approximate inverse-Hessian computations.

To reduce the computational and memory costs associated with second-order derivative computations, recent work has developed fully first-order methods, which use only ordinary stochastic gradients of ff and gg and avoid second-order oracle access altogether. A prominent approach is to construct a penalty-based reformulation of the bilevel problem that can be optimized using only first-order information [17, 14, 19]. In particular, problem (1) admits the equivalent constraint reformulation:

min⁡w,yf(w,y)subject tog(w,y)−min⁡zg(w,z)≤0.(2)\min_{w,y} f(w,y) \quad\text{subject to} \quad g(w,y)-\min_z g(w,z)\leq0. \tag*{(2)}

Penalizing the constraint violation yields a surrogate problem:

min⁡wLλ∗(w),Lλ∗(w):=min⁡y{f(w,y)+λ[g(w,y)−min⁡zg(w,z)]},λ>0.(3)\min_w \mathcal{L}^{*}_{\lambda}(w), \qquad\mathcal{L}^{*}_{\lambda}(w):=\min_y\left\{f(w,y)+\lambda\left[g(w,y)-\min_z g(w,z)\right]\right\}, \qquad\lambda>0. \tag*{(3)}

Under standard regularity conditions and for sufficiently large λ\lambda, the gradient of the surrogate objective approximates the bilevel hypergradient with error ∥∇Lλ∗(w)−∇F(w)∥2=O(λ−1)\lVert\nabla\mathcal{L}^{*}_{\lambda}(w)-\nabla F(w)\rVert_{2}=O(\lambda^{-1}) [14]. Consequently, choosing λ=Θ(ϵ−1)\lambda=\Theta(\epsilon^{-1}) ensures that an O(ϵ)O(\epsilon)-stationary point of Lλ∗\mathcal{L}^{*}_{\lambda} is also an O(ϵ)O(\epsilon)-stationary point of FF.

Despite this first-order representation, attaining sharp sample complexity with simple updates remains challenging. Existing fully first-order methods achieve O(ϵ−6)O(\epsilon^{-6}) sample complexity under bounded-variance stochastic gradients and O(ϵ−4)O(\epsilon^{-4}) under additional mean-square smoothness. However, the methods attaining these rates rely on nested lower-level solvers [15, 3, 19], ϵ\epsilon-dependent large batch sizes [15, 3, 8, 19], or both. Meanwhile, existing methods that combine a single loop with constant-size batches have weaker sample complexity guarantees [14, 23]. This gap motivates the following open question [20, 23]:

Can we design a fully first-order method for NC-SC SBO that uses a single loop and constant-size batches while matching the best-known sample complexity under standard stochastic assumptions?

We answer this question affirmatively with a simple algorithmic design supported by refined convergence analyses. Our method maintains yty_t and ztz_t to track the minimizers of the penalized problem over yy and original lower-level problem over zz in (3), respectively, taking one stochastic-gradient step for each at every iteration given wtw_t. Inspired by the projected-coupling idea of Kwon et al. [15], we project the provisional zz-iterate onto a ball of radius O(λ−1)O(\lambda^{-1}) centered at the updated yy-iterate. This projection constrains the separation between the two iterates rather than their individual locations. We combine it with a standard exponential moving average of the stochastic gradient estimator for the upper-level variable ww. The projection controls the relative lower-level tracking error, while the moving average controls the upper-level gradient estimation error with a constant batch size. We refer to the proposed algorithm as SICO.

By establishing refined contraction and sensitivity bounds for coupled lower-level tracking, we prove that SICO achieves O(ϵ−6)O(\epsilon^{-6}) sample complexity under unbiased, bounded-variance stochastic gradients and O(ϵ−4)O(\epsilon^{-4}) under the additional mean-square smoothness assumption on the lower-level stochastic gradients, using only O(1)O(1) stochastic-gradient samples per iteration in both settings. In addition, our results also achieve the best known dependence on the condition number (cf. Table 1).

Table 1: Comparison of fully first-order methods for bilevel optimization. The second column indicates the mean-square smoothness (MSS) of the stochastic gradients (cf. Assumption 3).

AlgorithmMSSLoopBatch sizeSample complexity
F2SA (Kwon et al., [14])NoSingleO(1)O(1)O(poly⁡(κ)ϵ−7)O(\operatorname{poly}(\kappa)\epsilon^{-7})
Yang [23]NoSingleO(1)O(1)O(κ15ϵ−7)O(\kappa^{15}\epsilon^{-7})
Kwon et al. [15]NoDoubleO(ϵ−4)O(\epsilon^{-4})O(poly⁡(κ)ϵ−6)O(\operatorname{poly}(\kappa)\epsilon^{-6})
F2BSA (Chen et al., [3])NoDoubleO(ϵ−4)O(\epsilon^{-4})O~(κ12ϵ−6)\widetilde{O}(\kappa^{12}\epsilon^{-6})
F3BSA (Chen et al., [3])NoDoubleO(κ)O(\kappa)O~(κ11ϵ−6)\widetilde{O}(\kappa^{11}\epsilon^{-6})
Stoc-SGHA (Gu et al., [8])NoSingleO(ϵ−4)O(\epsilon^{-4})O(κ17ϵ−6)O(\kappa^{17}\epsilon^{-6})
SICO (Theorem 1)NoSingleO(1)O(1)O(κ11ϵ−6)O(\kappa^{11}\epsilon^{-6})
F3SA (Kwon et al., [14])YesSingleO(1)O(1)O(poly⁡(κ)ϵ−5)O(\operatorname{poly}(\kappa)\epsilon^{-5})
Kwon et al. [15]YesDoubleO(ϵ−2)O(\epsilon^{-2})O(poly⁡(κ)ϵ−4)O(\operatorname{poly}(\kappa)\epsilon^{-4})
Stoc-SGHA (Gu et al., [8])YesSingleO(ϵ−2)O(\epsilon^{-2})O(κ11ϵ−4)O(\kappa^{11}\epsilon^{-4})
SICO (Theorem 2)YesSingleO(1)O(1)O(κ9ϵ−4)O(\kappa^{9}\epsilon^{-4})

Table 1.

We evaluate the proposed method on bilevel problems arising in data hyper-cleaning and regularization selection, demonstrating its effectiveness compared with existing fully first-order baselines.

Related Work

Penalty methods for bilevel optimization build on classical value-function reformulations and associated exact-penalty analyses [24]. These formulations express lower-level optimality through a constraint on the lower-level optimality gap. More recent developments include [17, 19, 18]. Building on this broader literature, recent research on NC–SC SBO has focused on controlling the approximation error and stochastic noise introduced by penalization.

Kwon et al. [14] introduced F2SA, a fully first-order penalty method that avoids Jacobian and Hessian evaluations. It uses simple stochastic gradient updates for all variables. Its established sample complexity is O(ϵ−7)O(\epsilon^{-7}) in the fully stochastic setting. Their F3SA variant incorporates STORM-style gradient estimators for both the upper- and lower-level variables, improving the complexity to O(ϵ−5)O(\epsilon^{-5}) under additional mean-square smoothness for both the upper and lower level stochastic gradients while using a single loop and constant-size batches.

Kwon et al. [15] established two improved complexity bounds: O(ϵ−6)O(\epsilon^{-6}) under bounded-variance stochastic gradients and O(ϵ−4)O(\epsilon^{-4}) under additional mean-square smoothness. Their method uses a double-loop structure with batch sizes of order ϵ−4\epsilon^{-4} and ϵ−2\epsilon^{-2} in the two settings, respectively. The analysis exploits the proximity of the original and penalized lower-level solutions through projection and, under mean-square smoothness. These ideas motivate our algorithm, while our refined tracking analysis enables single-loop updates with constant-size batches.

Chen et al. [3] showed that the smoothness constant of the reduced penalty objective Lλ∗\mathcal{L}_{\lambda}^{*} can be bounded independently of λ\lambda. Their F2BSA method combines inner solvers with large batch sizes to attain O~(κ12ϵ−6)\widetilde{O}(\kappa^{12}\epsilon^{-6}) sample complexity in the fully stochastic setting. Their F3BSA variant uses multilevel Monte Carlo and single-sample stochastic updates to attain O~(κ11ϵ−6)\widetilde{O}(\kappa^{11}\epsilon^{-6}) complexity. However, constructing its gradient estimator still requires nested stochastic solvers and a batch size in the order of O(κ)O(\kappa).

Using an equivalent min–max reformulation of the penalty problem (3), Yang [23] developed a single-loop stochastic momentum gradient descent–ascent method with constant-size batches. Its established sample complexity under bounded variance is O(ϵ−7)O(\epsilon^{-7}), leaving a gap relative to the O(ϵ−6)O(\epsilon^{-6}) dependence achieved by nested-loop methods.

In concurrent work, Gu et al. [8] proposed SGHA and its stochastic counterpart, Stoc-SGHA, based on a regularized Lagrangian formulation of the lower-level stationarity constraints. These methods approximate Hessian–vector products using finite differences of first-order gradients. Stoc-SGHA achieves expected oracle complexities of O(κ17ϵ−6)O(\kappa^{17}\epsilon^{-6}) under bounded variance and O(κ11ϵ−4)O(\kappa^{11}\epsilon^{-4}) under lower-level mean-square smoothness. However, its stated in-expectation guarantees additionally assume that the iterates are almost surely bounded and use batch sizes of order ϵ−4\epsilon^{-4} and ϵ−2\epsilon^{-2}, respectively. Thus, its single-loop structure still entails an ϵ\epsilon-dependent per-iteration sampling cost. In contrast, SICO operates directly on stochastic gradients and does not require finite-difference approximations or an additional almost-sure bounded-iterate assumption and has sharper dependence on the condition number. Table 1 summarizes these comparisons.

Preliminaries

Notation. We use ∇1f(w,y)\nabla_1 f(\mathbf{w},\mathbf{y}) and ∇2f(w,y)\nabla_2 f(\mathbf{w},\mathbf{y}) to denote gradients with respect to the first and second arguments, respectively, and ∥⋅∥\|\cdot\| to denote the Euclidean norm. Let ΠB(c,r)(u)\Pi_{\mathbb{B}(\mathbf{c},r)}(\mathbf{u}) denote the Euclidean projection of u\mathbf{u} onto a closed Euclidean ball B(c,r)={u:∥u−c∥≤r}\mathbb{B}(\mathbf{c},r)=\{\mathbf{u}:\|\mathbf{u}-\mathbf{c}\|\le r\}. We write Et[⋅]\mathbb{E}_t[\cdot] for the conditional expectation given the history prior to the drawing of random samples at iteration tt. A possibly random point w\mathbf{w} is called ϵ\epsilon-stationary if E[∥∇F(w)∥2]≤ϵ2\mathbb{E}[\|\nabla F(\mathbf{w})\|^2]\le\epsilon^2. A function ff is CCLipschitz continuous if ∣f(x)−f(y)∣≤C∥x−y∥|f(x)-f(y)| \le C\lVert x-y\rVert for all x,yx,y. It is LL-smooth if it is differentiable and ∥∇f(x)−∇f(y)∥≤L∥x−y∥\lVert\nabla f(x)-\nabla f(y)\rVert\le L\lVert x-y\rVert for all x,yx,y. A differentiable function gg is μg\mu_g-strongly convex if g(y)≥g(x)+∇g(x)T(y−x)+μg2∥y−x∥2g(y) \ge g(x) + \nabla g(x)^{\mathsf{T}}(y-x) + \frac{\mu_g}{2}\lVert y-x\rVert^2 for all x,yx,y. A mapping H(s):Rd→RdH(s):\mathbb{R}^d \to\mathbb{R}^d is μ\mu-strongly monotone if (H(s)−H(s′))T(s−s′)≥μ∥s−s′∥2(H(s)-H(s'))^{\mathsf{T}}(s-s') \ge\mu\lVert s-s'\rVert^2.

Assumption

We make the following standard assumptions regarding the problem (1).

Assumption 1. Regarding ff, gg and FF, we assume:

  • f(w,y)f(\mathbf{w},y) is CfC_f-Lipschitz in yy and jointly LfL_f-smooth in terms of (w,y)(\mathbf{w},y)

  • g(w,y)g(\mathbf{w},y) is jointly LgL_g-smooth and μg\mu_g-strongly convex in terms of yy for any w\mathbf{w}

  • ff is twice continuously differentiable, and ∇2g(w,y)\nabla^2 g(\mathbf{w},y) is jointly QgQ_g-Lipschitz continuous.

  • F(w)F(\mathbf{w}) is lower bounded, i.e., inf⁡w∈RdF(w)>−∞\inf_{\mathbf{w}\in\mathbb{R}^d} F(\mathbf{w})>-\infty

References

  1. [1]Fan Bao, Guoqiang Wu, Chongxuan Li, Jun Zhu, and Bo Zhang. Stability and generalization of bilevel programming in hyperparameter optimization. Advances in neural information processing systems, 34:4529–4541, 2021.arxiv.org/abs/2106.04188
  2. [2]Chih-Chung Chang and Chih-Jen Lin. LIBSVM: A library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:27:1–27:7, 2011. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm.
  3. [3]Lesi Chen, Yaohua Ma, and Jingzhao Zhang. Near-optimal nonconvex-strongly-convex bilevel optimization with fully first-order oracles. Journal of Machine Learning Research, 26(109):1–56, 2025. URL http://jmlr.org/papers/v26/23-1104.html.
  4. [4]Tianyi Chen, Yuejiao Sun, and Wotao Yin. Closing the gap: Tighter analysis of alternating stochastic gradient methods for bilevel problems. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id=r6cNUjS8cm0.
  5. [5]Luca Franceschi, Paolo Frasconi, Saverio Salzo, Riccardo Grazzi, and Massimiliano Pontil. Bilevel programming for hyperparameter optimization and meta-learning. In International conference on machine learning, pp. 1568–1577. PMLR, 2018.
  6. [6]Jiahui Gao, Renjie Pi, Yong Lin, Hang Xu, Jiacheng Ye, Zhiyong Wu, Weizhong Zhang, Xiaodan Liang, Zhenguo Li, and Lingpeng Kong. Self-guided noise-free data generation for efficient zero-shot learning. arXiv preprint arXiv:2205.12679, 2022.arxiv.org/abs/2205.12679
  7. [7]Saeed Ghadimi and Mengdi Wang. Approximation methods for bilevel programming. arXiv preprint arXiv:1802.02246, 2018.arxiv.org/abs/1802.02246
  8. [8]Zhihаo Gu, Qilong Wu, and Junchi Yang. Sgha: A single-loop fully first-order algorithm for nonconvex-strongly-convex bilevel optimization. arXiv preprint arXiv:2608.23211, 2026.arxiv.org/abs/2608.23211
  9. [9]Zhishuai Guo, Quanqi Hu, Lijun Zhang, and Tianbao Yang. Randomized stochastic variance-reduced methods for stochastic bilevel optimization. CoRR, abs/2105.02266, 2021a. URL https://arxiv.org/abs/2105.02266.
  10. [10]Zhishuai Guo, Yi Xu, Wotao Yin, Rong Jin, and Tianbao Yang. Unified convergence analysis for adaptive optimization with moving average estimator. Mach. Learn., 114(4), February 2021b. ISSN 0885-6125. doi: 10.1007/s10994-024-06650-8. URL https://doi.org/10.1007/s10994-024-06650-8.
  11. [11]Mingyi Hong, Hoi-To Wai, Zhaoran Wang, and Zhuoran Yang. A two-timescale stochastic algorithm framework for bilevel optimization: Complexity analysis and application to actor-critic. SIAM Journal on Optimization, 33(1):147–180, 2020.
  12. [12]Kaiyi Ji, Junjie Yang, and Yingbin Liang. Bilevel optimization: Convergence analysis and enhanced design. In International conference on machine learning, pp. 4882–4892. PMLR, 2021.
  13. [13]Prashant Khanduri, Siliang Zeng, Mingyi Hong, Hoi-To Wai, Zhaoran Wang, and Zhuoran Yang. A near-optimal algorithm for stochastic bilevel optimization via double-momentum. In Proceedings of the 35th International Conference on Neural Information Processing Systems, NIPS ’21, Red Hook, NY, USA, 2021. Curran Associates Inc. ISBN 9781713845393.arxiv.org/abs/2102.07367
  14. [14]Jeongyeol Kwon, Dohyun Kwon, Stephen Wright, and Robert D Nowak. A fully first-order method for stochastic bilevel optimization. In International Conference on Machine Learning, pp. 18083–18113. PMLR, 2023.arxiv.org/abs/2301.10945
  15. [15]Jeongyeol Kwon, Dohyun Kwon, and Hanbaek Lyu. On the complexity of first-order methods in stochastic bilevel optimization. arXiv preprint arXiv:2402.07101, 2024.arxiv.org/abs/2402.07101
  16. [17]Bo Liu, Mao Ye, Stephen Wright, Peter Stone, and Qiang Liu. Bome! bilevel optimization made easy: a simple first-order approach. In Proceedings of the 36th International Conference on Neural Information Processing Systems, NIPS ’22, Red Hook, NY, USA, 2022. Curran Associates Inc. ISBN 9781713871088.arxiv.org/abs/2209.08709
  17. [18]Zhaosong Lu and Sanyou Mei. First-order penalty methods for bilevel optimization. SIAM Journal on Optimization, 34(2):1937–1969, 2024. doi: 10.1137/23M1566753.DOI
  18. [19]Han Shen and Tianyi Chen. On penalty-based bilevel gradient descent method. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett (eds.), Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pp. 30992–31015. PMLR, 23–29 Jul 2023. URL https://proceedings.mlr.press/v202/shen23c.html.arxiv.org/abs/2302.05185
  19. [20]Stephen J. Wright. Gradient-based methods for large-scale bilevel optimization. Plenary talk at the 8th International Conference on Continuous Optimization (ICCOPT 2025), July 2025. URL https://sites.google.com/view/iccopt2025/home/speakers/plenary-speakers. University of Southern California, Los Angeles, CA, USA.
  20. [22]Junjie Yang, Kaiyi Ji, and Yingbin Liang. Provably faster algorithms for bilevel optimization. In Proceedings of the 35th International Conference on Neural Information Processing Systems, NIPS ’21, Red Hook, NY, USA, 2021. Curran Associates Inc. ISBN 9781713845393.arxiv.org/abs/2106.04692
  21. [23]T. Yang. Compositional Optimization for Advanced Machine Learning. Springer Optimization and Its Applications. Springer Nature Switzerland, 2026. ISBN 9783032343574. URL https://books.google.com/books?id=0E4h0gEACAAJ.
  22. [24]Jane J. Ye and Daoli Zhu. Optimality conditions for bilevel programming problems. Optimization, 33(1):9–27, 1995. doi: 10.1080/02331939508844060.DOI

Paper details

vlnc:W_tg6jnjm4
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

generative AI tools

View statement
Looking for related papers…
Contents