# 双层优化

双层优化是一种数学框架，其中一个优化问题作为约束嵌套在另一个优化问题之中，因此求解外层问题需要预判内层问题的最优响应。外层的决策者称为领导者，内层称为跟随者；双方各有自己的目标和约束，领导者的可行集由跟随者的最佳响应决定。<sup>[1](https://www.lamsade.dauphine.fr/poc/sites/default/files/bilevel-optimization.pdf)</sup><sup> • </sup><sup>[2](https://arxiv.org/html/2511.03448v1)</sup> 这一结构刻画了决策者必须预判利益相关方反应的层级决策问题：交通收费设定与网络设计、安全规划，以及日益增多的机器学习任务，如超参数优化和神经架构搜索。<sup>[2](https://arxiv.org/html/2511.03448v1)</sup><sup> • </sup><sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup><sup> • </sup><sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 形式结构 | 领导者求解 \( \min_{x} F(x,y) \)，约束为 \( y \in S(x) \)，其中 \( S(x) \) 是跟随者以 \( x \) 为参数的问题的最优解集。<sup>[1](https://www.lamsade.dauphine.fr/poc/sites/default/files/bilevel-optimization.pdf)</sup> |
| 两种解读 | 当跟随者有多个最优解时，问题是不适定的；乐观（弱）与悲观（强）两种表述对此有不同的处理方式。<sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup><sup> • </sup><sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup> |
| 复杂度 | 即便是线性情形也是强 NP 难的，因此除非 P = NP，否则不能指望存在多项式时间的精确算法。<sup>[5](https://doi.org/10.1287/opre.38.3.556)</sup><sup> • </sup><sup>[6](https://doi.org/10.1137/0913069)</sup><sup> • </sup><sup>[7](https://optimization-online.org/wp-content/uploads/2021/01/8187.pdf)</sup> |
| 主要归约 | 用跟随者的 KKT 条件替掉跟随者，得到一个带均衡约束的数学规划（MPEC），这仅在下层为凸时可行。<sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup><sup> • </sup><sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup> |
| 基于梯度的求解 | 超梯度由一个显式梯度与一个隐式梯度合成，后者通过对跟随者的解映射求导得到。<sup>[8](https://proceedings.mlr.press/v247/chen24a/chen24a.pdf)</sup> |
| 机器学习中的应用 | 超参数优化、元学习和架构搜索本质上都是双层的。<sup>[9](https://proceedings.mlr.press/v80/franceschi18a.html)</sup><sup> • </sup><sup>[10](https://doi.org/10.48550/arxiv.1806.09055)</sup> |

## 工作原理

一个双层问题写作 \( \min_{x \in X, y} F(x,y) \)，约束为 \( G(x) \le 0 \) 与 \( y \in \Psi(x) \)，其中 \( \Psi(x) := \{ y \in Y: g(x,y) \le 0,\ f(x,y) \le \varphi(x) \} \) 是下层问题的解集映射，\( \varphi(x) := \min_y \{ f(x,y): g(x,y) \le 0,\ y \in Y \} \) 是其最优值函数。<sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup> 约束 \( (x,y) \in \mathrm{gph}\,\Psi \) 即理性响应条件：跟随者看到 \( x \) 后做出最佳回应，领导者则在由此得到的各对 \( (x,y) \) 上优化。

若对每个 \( x \) 下层都有唯一最优解，则双层问题等价于一个目标隐式定义的单层问题。<sup>[11](https://link.springer.com/book/10.1007/b101970)</sup> 当 \( \Psi(x) \) 不是单点集时，映射 \( x \mapsto F(x, y(x)) \) 是多值的，问题便不适定；乐观方法假定跟随者会挑选领导者最偏好的那个最佳回应，悲观方法则以最差回应所造成的损失为上界。<sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup> 该框架形式化了与海因里希·冯·施塔克尔贝格（Heinrich von Stackelberg）市场均衡研究相关联的领导者—跟随者博弈。<sup>[12](https://doi.org/10.2307/2550609)</sup>

## 求解方法

**单层归约。** 在适当的可微性与约束品性假设下，当下层为凸时，Karush–Kuhn–Tucker（KKT）条件刻画了下层的全局最优解；用这些条件替换下层，便得到一个带均衡（或互补）约束的数学规划，即 MPEC 或 MPCC；对于非凸的下层，KKT 条件一般只是全局最优性的必要条件而非充分条件。<sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup><sup> • </sup><sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup> 该 MPEC 是非凸的，且在每个可行点处 Mangasarian–Fromovitz 约束品性都不成立，这决定了为其设计的专门算法的形态。<sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup>

**离散与组合方法。** 对于线性双层问题，解出现在底层多面体集的某个顶点上，这启发了顶点枚举算法；此类方法在最坏情况下可能需要访问指数多个顶点。<sup>[13](https://onlinelibrary.wiley.com/doi/10.1002/nav.3800310104)</sup><sup> • </sup><sup>[7](https://optimization-online.org/wp-content/uploads/2021/01/8187.pdf)</sup> 分支定界与分支切割方案，以及它们与混合 0–1 规划的关联，构成第二个经典方法族。<sup>[14](https://doi.org/10.1023/a:1022645805569)</sup><sup> • </sup><sup>[7](https://optimization-online.org/wp-content/uploads/2021/01/8187.pdf)</sup> 遗传算法、粒子群优化等进化方法则用于处理缺乏凸性或可微性的情形。<sup>[2](https://arxiv.org/html/2511.03448v1)</sup>

**基于梯度的方法。** 在机器学习中，外层目标 \( \Phi(x) := F(x, y^{*}(x)) \) 的超梯度，在下层强凸且解映射 \( y^{*} \) 在适当的光滑性与正则性条件下可微时，可分解为 \( \nabla \Phi(x) = \nabla_{x} F(x, y^{*}(x)) + (\nabla y^{*}(x))^{\top} \nabla_{y} F(x, y^{*}(x)) \)：一个显式梯度加一个隐式梯度。<sup>[8](https://proceedings.mlr.press/v247/chen24a/chen24a.pdf)</sup> 由于该公式涉及的雅可比矩阵与海森逆矩阵无法显式计算，方法分为近似隐式微分（AID）与迭代微分（ITD）两族。<sup>[15](https://www.jmlr.org/papers/volume24/21-0949/21-0949.pdf)</sup>

## 起源

约束本身包含优化问题的一类优化问题（包括某些博弈），由杰罗姆·布拉肯（Jerome Bracken）与詹姆斯·T. 麦吉尔（James T. McGill）于 1973 年在《运筹学》上提出；该文给出了凸性理论、一个线性规划应用以及计算方法。<sup>[16](https://doi.org/10.1287/opre.21.1.37)</sup> 1974 年的一篇姊妹论文涵盖了国防应用，该表述最早用于一个关于成本最小化武器组合的军事问题。<sup>[17](https://doi.org/10.1287/opre.22.5.1086)</sup><sup> • </sup><sup>[1](https://www.lamsade.dauphine.fr/poc/sites/default/files/bilevel-optimization.pdf)</sup> 乔纳森·F. 巴德（Jonathan F. Bard）于 1984 年为一般问题建立了一阶最优性必要条件，并证明了线性情形等价于在多面体约束集的连通面与棱上最大化一个线性函数，解位于顶点。<sup>[13](https://onlinelibrary.wiley.com/doi/10.1002/nav.3800310104)</sup> 奥马尔·本-阿耶德（Omar Ben-Ayed）与查尔斯·E. 布莱尔（Charles E. Blair）于 1990 年证明了求解双层线性规划是 NP 难的，并指出此前发表的两个算法只是启发式方法。<sup>[5](https://doi.org/10.1287/opre.38.3.556)</sup> 皮埃尔·汉森（Pierre Hansen）、布丽吉特·若马尔（Brigitte Jaumard）与吉勒·萨瓦尔（Gilles Savard）于 1992 年通过从图问题 KERNEL 归约，确立了强 NP 难度，并引入了新的分支定界规则。<sup>[6](https://doi.org/10.1137/0913069)</sup> 奥代（Audet）、汉森、若马尔与萨瓦尔于 1997 年将线性双层规划与混合 0–1 规划联系起来。<sup>[14](https://doi.org/10.1023/a:1022645805569)</sup> 斯特凡·登佩（Stephan Dempe）的《双层规划基础》（2002）处理上层约束部分由第二个参数优化问题定义的双层问题，而伯努瓦·科尔松（Benoît Colson）、帕特里斯·马科特（Patrice Marcotte）与吉勒·萨瓦尔 2007 年的综述将该领域与 MPEC 联系起来。<sup>[11](https://link.springer.com/book/10.1007/b101970)</sup><sup> • </sup><sup>[18](https://doi.org/10.1007/s10479-007-0176-2)</sup>

## 变体

乐观表述让跟随者选择对领导者有利的最佳回应；悲观表述求解 \( \min_{x \in X} \varphi_p(x) := \max_y \{ F(x,y) \mid y \in S(x) \} \)，该问题被视为双层优化中最具挑战性的问题之一。<sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup><sup> • </sup><sup>[19](https://ar5iv.labs.arxiv.org/html/1711.11127)</sup> 选择函数方法可推广上述两者。<sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup> 在简单双层问题中，在一个凸问题的解集上最小化另一个凸函数；与一般双层问题不同——后者即便数据均为凸的也是非凸的——该变体是凸的。<sup>[20](https://ar5iv.labs.arxiv.org/html/1912.06376)</sup>

## 应用

在运筹学中，双层模型用于在交通网络中设定最优收费、设计网络以及控制交通信号；安全领域的应用包括边境安全、防范恐怖袭击以及关键基础设施保护。<sup>[4](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)</sup><sup> • </sup><sup>[2](https://arxiv.org/html/2511.03448v1)</sup>

在机器学习中，卢卡·弗朗切斯基（Luca Franceschi）、保罗·弗拉斯科尼（Paolo Frasconi）、萨韦里奥·萨尔佐（Saverio Salzo）、里卡尔多·格拉齐（Riccardo Grazzi）与马西米利亚诺·蓬蒂尔（Massimiliano Pontil）于 2018 年提出了一个双层框架，统一了基于梯度的超参数优化与元学习，求解一个显式考虑内层目标优化动态的近似双层问题。<sup>[9](https://proceedings.mlr.press/v80/franceschi18a.html)</sup><sup> • </sup><sup>[21](https://doi.org/10.48550/arxiv.1806.04910)</sup> 刘涵晓（Hanxiao Liu）、卡伦·西蒙扬（Karen Simonyan）与杨一鸣（Yiming Yang）于 2018 年提出的可微架构搜索方法 DARTS，在离散架构空间的连续松弛上使用基于梯度的双层优化。<sup>[10](https://doi.org/10.48550/arxiv.1806.09055)</sup>

**近期算法理论。** 全一阶方法如今已能避开海森-向量乘积：F2BA 对非凸—强凸双层问题达到 \( \tilde{O}(\bar{\kappa}_y^{4} \varepsilon^{-2}) \) 的预言机复杂度，后改进至 \( \tilde{O}(\bar{\kappa}_y^{7/2} \varepsilon^{-2}) \)，这在 \( \varepsilon \) 上近乎最优，但相对于基于海森-向量乘积的 \( O(\varepsilon^{-2}) \) 方法以及 \( \Omega(\kappa^{3/2} \varepsilon^{-2}) \) 的确定性下界，在条件数依赖上仍留有可证明的差距。<sup>[22](https://jmlr.org/papers/volume26/23-1104/23-1104.pdf)</sup><sup> • </sup><sup>[8](https://proceedings.mlr.press/v247/chen24a/chen24a.pdf)</sup> 相匹配的下界也已出现：任何一阶零尊重算法要达到 \( \varepsilon \)-精度驻点，确定性情形至少需要 \( \Omega(\kappa^{3/2} \varepsilon^{-2}) \) 次、随机情形至少需要 \( \Omega(\kappa^{5/2} \varepsilon^{-4}) \) 次预言机调用，这与当前上界之间仍存在显著差距。<sup>[23](https://par.nsf.gov/biblio/10681833-lower-complexity-bounds-nonconvex-strongly-convex-bilevel-optimization-first-order-oracles)</sup>

## 局限与替代方案

**难度。** 双层线性规划是 NP 难的；即便是线性情形的强 NP 难度，也排除了多项式时间精确算法的可能，除非 P = NP。<sup>[5](https://doi.org/10.1287/opre.38.3.556)</sup><sup> • </sup><sup>[7](https://optimization-online.org/wp-content/uploads/2021/01/8187.pdf)</sup> 当下层为凸但非强凸时，对零尊重算法而言，寻找超目标的驻点可能是棘手的。<sup>[8](https://proceedings.mlr.press/v247/chen24a/chen24a.pdf)</sup><sup> • </sup><sup>[22](https://jmlr.org/papers/volume26/23-1104/23-1104.pdf)</sup>

**结构性失效模式。** 下层解不唯一会使问题不适定，需要乐观、悲观或选择函数处理。<sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup><sup> • </sup><sup>[11](https://link.springer.com/book/10.1007/b101970)</sup> 由于互补约束在 MPEC 的所有可行点处都违反 LICQ 与 MFCQ，KKT 条件在极小点处可能失效，标准非线性规划求解器也随之失去收敛保证；针对 MPEC 定制的约束品性可弥补这一点。<sup>[24](https://eprints.soton.ac.uk/508837/1/2508.12850v1.pdf)</sup> 线性双层问题的单层重构需要难以获取的大 M 参数，且会产生病态问题；当下层为连续非凸时，即使在下层解唯一、严格互补性与 Slater 条件均成立的情况下，仅把跟随者求解到 \( \varepsilon \)-可行性，也可能使返回的解与真解相距任意远。<sup>[25](https://link.springer.com/article/10.1007/s10957-023-02238-9)</sup> 隐式梯度方法需要海森-向量乘积，这在大规模分布式或神经形态硬件上难以实现；本杰明·塞利耶（Benjamin Scellier）与约书亚·本吉奥（Yoshua Bengio）于 2017 年提出的均衡传播通过对比偏导数避开了它们。<sup>[26](https://arxiv.org/pdf/2205.03076v3.pdf)</sup><sup> • </sup><sup>[27](https://doi.org/10.3389/fncom.2017.00024)</sup> 更广泛地说，中等与大规模实例的实际实现仍然稀少，且没有通用方法能对每种问题类型都保证收敛性、性能或最优性。<sup>[3](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)</sup>

**最接近的替代方案。** MPEC 是最接近的单层近亲，是标准的重构方式而非竞争框架；简单双层问题提供了一个带专门算法的凸特例；而悲观变体长期以来所知甚少，仍是最不成熟的分支。<sup>[28](http://ideas.repec.org/h/spr/spochp/978-3-030-52119-6_12.html)</sup><sup> • </sup><sup>[20](https://ar5iv.labs.arxiv.org/html/1912.06376)</sup><sup> • </sup><sup>[19](https://ar5iv.labs.arxiv.org/html/1711.11127)</sup> 双层优化与鲁棒优化的详细比较，以及对抗训练应用的具体细节，本文所涵盖的已发表比较尚未给出定论。

## References

1. [A Gentle and Incomplete Introduction to Bilevel Optimization (lecture notes, LAMSADE)](https://www.lamsade.dauphine.fr/poc/sites/default/files/bilevel-optimization.pdf)
2. [A Review of Bilevel Optimization: Methods, Emerging Applications, and Recent Advancements](https://arxiv.org/html/2511.03448v1)
3. [Bilevel Programming and Applications (Wiley, 2015)](https://onlinelibrary.wiley.com/doi/10.1155/2015/310301)
4. [Bilevel optimization: theory, algorithms and applications (S. Dempe, survey/annotated bibliography)](https://optimization-online.org/wp-content/uploads/2018/08/6773.pdf)
5. [Omar Ben-Ayed, Charles E. Blair (1990). Computational Difficulties of Bilevel Linear Programming. Operations Research.](https://doi.org/10.1287/opre.38.3.556)
6. [Pierre Hansen, Brigitte Jaumard, Gilles Savard (1992). New Branch-and-Bound Rules for Linear Bilevel Programming. SIAM Journal on Scientific and Statistical Computing.](https://doi.org/10.1137/0913069)
7. [A Survey on Mixed-Integer Programming Techniques in Bilevel Optimization](https://optimization-online.org/wp-content/uploads/2021/01/8187.pdf)
8. [On Finding Small Hyper-Gradients in Bilevel Optimization: Hardness Results and Improved Analysis (PMLR v247)](https://proceedings.mlr.press/v247/chen24a/chen24a.pdf)
9. [Bilevel Programming for Hyperparameter Optimization and Meta-Learning (Franceschi et al., ICML 2018)](https://proceedings.mlr.press/v80/franceschi18a.html)
10. [Liu, Hanxiao, Simonyan, Karen, Yang, Yiming (2018). DARTS: Differentiable Architecture Search. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1806.09055)
11. [Foundations of Bilevel Programming (Stephan Dempe, Springer, 2002)](https://link.springer.com/book/10.1007/b101970)
12. [Heinrich von Stackelberg and colleagues (1953). The Theory of the Market Economy.. Economica.](https://doi.org/10.2307/2550609)
13. [Optimality conditions for the bilevel programming problem (Bard, Naval Research Logistics Quarterly, 1984)](https://onlinelibrary.wiley.com/doi/10.1002/nav.3800310104)
14. [C. Audet and colleagues (1997). Links Between Linear Bilevel and Mixed 0–1 Programming Problems. Journal of Optimization Theory and Applications.](https://doi.org/10.1023/a:1022645805569)
15. [Lower Bounds and Accelerated Algorithms for Bilevel Optimization (JMLR)](https://www.jmlr.org/papers/volume24/21-0949/21-0949.pdf)
16. [Jerome Bracken, James T. McGill (1973). Mathematical Programs with Optimization Problems in the Constraints. Operations Research.](https://doi.org/10.1287/opre.21.1.37)
17. [Jerome Bracken, James T. McGill (1974). Defense Applications of Mathematical Programs with Optimization Problems in the Constraints. Operations Research.](https://doi.org/10.1287/opre.22.5.1086)
18. [Benoît Colson, Patrice Marcotte, Gilles Savard (2007). An overview of bilevel optimization. Annals of Operations Research.](https://doi.org/10.1007/s10479-007-0176-2)
19. [Two-level value function approach to nonsmooth optimistic and pessimistic bilevel programs (Mordukhovich et al.)](https://ar5iv.labs.arxiv.org/html/1711.11127)
20. [Simple Bilevel Programming and Extensions Part-I: Theory](https://ar5iv.labs.arxiv.org/html/1912.06376)
21. [Franceschi, Luca and colleagues (2018). Bilevel Programming for Hyperparameter Optimization and Meta-Learning. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1806.04910)
22. [Near-Optimal Nonconvex-Strongly-Convex Bilevel Optimization with Fully First-Order Oracles (JMLR)](https://jmlr.org/papers/volume26/23-1104/23-1104.pdf)
23. [Lower Complexity Bounds for Nonconvex-Strongly-Convex Bilevel Optimization with First-Order Oracles (ICML 2026, NSF Public Access Repository record)](https://par.nsf.gov/biblio/10681833-lower-complexity-bounds-nonconvex-strongly-convex-bilevel-optimization-first-order-oracles)
24. [On Constraint Qualifications for MPECs with Applications to Bilevel Hyperparameter Optimization for Machine Learning](https://eprints.soton.ac.uk/508837/1/2508.12850v1.pdf)
25. [On a Computationally Ill-Behaved Bilevel Problem with a Continuous and Nonconvex Lower Level (JOTA, 2023)](https://link.springer.com/article/10.1007/s10957-023-02238-9)
26. [Beyond backpropagation: bilevel optimization through implicit differentiation and equilibrium propagation](https://arxiv.org/pdf/2205.03076v3.pdf)
27. [Benjamin Scellier, Yoshua Bengio (2017). Equilibrium Propagation: Bridging the Gap between Energy-Based Models and Backpropagation. Frontiers in Computational Neuroscience.](https://doi.org/10.3389/fncom.2017.00024)
28. [MPEC Methods for Bilevel Optimization Problems (Kim, Leyffer, Munson, 2020, Springer)](http://ideas.repec.org/h/spr/spochp/978-3-030-52119-6_12.html)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/bilevel-optimization

English original: https://www.edgepedia.org/bilevel-optimization
