Fine-grained Analysis of Stability and Generalization for Stochastic Bilevel Optimization

Xuelin Zhang, Hong Chen, Bin Gu, Tieliang Gong

Abstract

Stochastic bilevel optimization (SBO) is a cornerstone of modern machine learning, powering applications from hyperparameter tuning to meta-learning. Despite its prevalence, the generalization properties of SBO algorithms—how well they perform on unseen data—have remained poorly understood. This paper provides a rigorous theoretical framework for analyzing the generalization gap in SBO by linking it to algorithmic stability. We derive tight performance bounds for Single-Timescale and Two-Timescale Stochastic Gradient Descent (SSGD and TSGD) across various convexity settings. Crucially, our analysis supports the "warm-starting" approach used in practice, removing the need for artificial re-initialization steps. Empirical results on MNIST and Omniglot benchmarks validate our theoretical predictions, demonstrating the critical trade-offs between optimization depth, sample size, and generalization.

Introduction

Bilevel optimization involves two nested problems: an "outer" objective that depends on the optimal solution of an "inner" objective. While convergence analysis for SBO has matured, generalization analysis has lagged, often relying on restrictive assumptions like parameter resetting. This work addresses this gap by establishing a quantitative link between "on-average argument stability" and the generalization gap, providing a more realistic theoretical foundation for practitioners.

Methodology: Stability as a Bridge

The core of our approach is Algorithmic Stability. An algorithm is considered stable if its output is robust to small changes in the training set (e.g., replacing one sample). We prove that for SBO, the generalization gap is bounded by the stability of both inner and outer parameters.

We analyze two primary algorithms:

  1. Single-Timescale SGD (SSGD): Updates inner and outer variables simultaneously.
  2. Two-Timescale SGD (TSGD): Executes multiple inner-loop steps for every outer update.

Our framework derives upper bounds for three mathematical settings: Nonconvex-Nonconvex (NC-NC), Convex-Convex (C-C), and Strongly-Convex-Strongly-Convex (SC-SC). By incorporating the empirical risk into our bounds, we achieve a "fine-grained" analysis that reflects how well the model fits the training data.

Experimental Validation

We evaluated our theoretical findings using a data reweighting task on the MNIST and Omniglot datasets. To simulate a challenging generalization scenario, we corrupted 50% of the training labels, forcing the bilevel optimizer to learn appropriate weights for clean versus noisy samples.

Impact of Iterations and Inner Steps

Our theory predicts that while more iterations ($K$) improve training performance, they can eventually degrade stability, leading to an increased generalization gap.

Figure 2: Impact of outer iterations (K) and inner steps (T) on SBO performance. As K increases, the generalization gap (c) grows, confirming the stability-optimization trade-off.

As shown in Figure 2, the generalization gap grows steadily with the number of outer iterations $K$. Furthermore, increasing the number of inner steps $T$ (from 1 to 32) accelerates convergence in validation error but also leads to a significantly larger generalization gap, highlighting the need for careful tuning of the inner-loop depth.

Impact of Sample Size

A key result of our analysis is the dependency of the generalization gap on the validation set size $m_1$. Our theorems predict rates such as $O(1/\sqrt{m_1})$ or $O(1/m_1)$ depending on the convexity of the problem.

Figure 3: Performance metrics across different validation set sizes (m1). Increasing m1 consistently reduces the generalization gap (c), aligning with our theoretical bounds.

Figure 3 demonstrates that larger validation sets ($m_1$) lead to lower generalization gaps across the training process, providing empirical support for our derived rates.

Conclusion

This work provides the first systematic analysis of generalization for practical SBO algorithms. By moving beyond the "re-initialization" paradigm, we offer a theoretical lens that aligns with actual practice. Our findings emphasize that stability is the key to generalization in bilevel settings, and that factors like iteration count and sample size must be balanced to avoid overfitting. Future work will explore extending this analysis to second-order methods and relaxing step-size constraints in strongly convex settings.

Summary updated

BibTeX
@inproceedings{zhang2024fine,
  author = {Xuelin Zhang and Hong Chen and Bin Gu and Tieliang Gong},
  title = {{Fine-grained Analysis of Stability and Generalization for Stochastic Bilevel Optimization}},
  booktitle = {Thirty-Third International Joint Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=Cf9KEXQwF4},
}
Figure