# 可微分架构搜索

可微分架构搜索（Differentiable architecture search，DARTS）是一种神经架构搜索方法，它将网络架构的离散空间松弛为一个连续、可微的空间，从而可以通过在验证集性能上的梯度下降来优化网络结构。早期的著名搜索方法如NASNet（强化学习）和AmoebaNet（进化算法）需要数千个GPU日，而DARTS仅用1.5或4个GPU日就达到了相当的结果，计算量少了三个数量级，尽管ENAS等权重共享方法使用的搜索计算量要少得多。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup>

| 关键事实 | 详情 |
|---|---|
| 核心思想 | 边上每个候选操作被替换为softmax加权的混合，使架构可微<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> |
| 优化方式 | 双层：架构参数 \( \alpha \) 在验证损失上优化，网络权重 \( w \) 在训练损失上优化<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> |
| 输出 | 一个基因型（单元规格），通过每个中间节点保留两条最强的入边、每条边上保留除none以外权重最高的操作得到；它必须从头重新训练，并非可直接使用的网络<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup><sup> • </sup><sup>[2](https://github.com/quark0/darts)</sup> |
| CIFAR-10结果 | 2.76 ± 0.09%测试误差，3.3M参数<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> |
| ImageNet结果 | 移动端设置下26.7% top-1误差<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> |
| 搜索成本 | 1.5或4个GPU日，而NASNet（强化学习）为2000个GPU日，AmoebaNet（进化）为3150个<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> |
| 已知缺陷 | 退化为跳跃连接主导的架构，在四个搜索空间的12个基准上均有报告<sup>[3](https://arxiv.org/pdf/1909.09656v2.pdf)</sup> |

## 工作原理

DARTS将计算单元表示为一个有向无环图，其边通过预定义操作变换输入。<sup>[4](https://aclanthology.org/D19-1367.pdf)</sup> 在原始的离散表述中，每条边携带一个从候选集 \( \mathcal{O} \) 中选出的操作。DARTS对此进行松弛，在每条边上使用所有候选操作的加权和，混合权重由可学习的架构参数经softmax产生。<sup>[3](https://arxiv.org/pdf/1909.09656v2.pdf)</sup> 对于一对节点 \( (i, j) \)，混合操作为

\[ \bar{o}^{(i,j)}(x) = \sum_{o \in \mathcal{O}} \frac{\exp\left(\alpha_{o}^{(i,j)}\right)}{\sum_{o' \in \mathcal{O}} \exp\left(\alpha_{o'}^{(i,j)}\right)} \cdot o(x) \]

其中 \( \alpha^{(i,j)} \) 是维度为 \( |\mathcal{O}| \) 的向量。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 搜索随后变成一个双层优化问题：α是上层变量，最小化验证损失，约束条件是w为下层变量，最小化训练损失，\( w^{*} = \arg\min_{w} \mathcal{L}_{\mathrm{train}}(w, \alpha) \)。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 由于CIFAR等常用数据集没有单独的验证集划分，\( \mathcal{D}_{\mathrm{train}} \) 和 \( \mathcal{D}_{\mathrm{val}} \) 通常是将原始训练数据平分后得到的两个互不重叠的子集；联合最小化两个损失之和会导致过拟合。<sup>[5](https://www.math.uci.edu/~jxin/RARTS_ACCESS_2022.pdf)</sup>

## 实现方式

实践者将超网络构建为单元形状的有向无环图，每条边持有所有候选操作及其α向量，然后交替执行两个更新：<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup>

1. 通过下降 \( \nabla_{\alpha} \mathcal{L}_{\mathrm{val}}\left(w - \xi \nabla_{w} \mathcal{L}_{\mathrm{train}}(w, \alpha), \alpha\right) \) 来更新架构，其中 \( \xi = 0 \) 给出一阶近似，\( \xi > 0 \) 给出二阶（展开）近似。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup><sup> • </sup><sup>[5](https://www.math.uci.edu/~jxin/RARTS_ACCESS_2022.pdf)</sup>
2. 通过下降 \( \nabla_{w} \mathcal{L}_{\mathrm{train}}(w, \alpha) \) 来更新权重。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup>

官方实现运行二阶搜索，使用 `train_search.py --unrolled`，用于CIFAR-10上的卷积单元和[Penn Treebank](https://www.edgepedia.org/zh/penn-treebank)上的循环单元。<sup>[2](https://github.com/quark0/darts)</sup> 搜索结束时，每个中间节点保留两条最强的入边，在每条选中的边上，混合操作被替换为除none以外最可能的操作，\( o^{(i,j)} = \arg\max_{o \in \mathcal{O}, o \neq \text{none}} \alpha_{o}^{(i,j)} \)。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 结果是一个基因型，即构建网络的配方，而非训练好的模型：作者的代码仓库指出，搜索期间的验证性能并不代表最终性能，得到的基因型必须用全尺寸模型从头训练。<sup>[2](https://github.com/quark0/darts)</sup> 不同的运行会收敛到不同的局部极小值，因此应当用不同的随机种子重复搜索，并根据验证性能选择最佳单元。<sup>[2](https://github.com/quark0/darts)</sup>

## 起源

DARTS由刘涵晓（Hanxiao Liu）、Karen Simonyan和杨一鸣（Yiming Yang）在2018年的一篇arXiv论文中提出。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 它出现在架构搜索被强化学习控制器、超网络、性能预测器、ENAS和正则化进化所主导的一段时期之后，论文将这些方法均列为其所基于或所取代的方法。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 正则化进化是当时最强的进化基线，由Esteban Real及同事于2019年通过AAAI发表，其CIFAR-10结果需要3150个GPU日。<sup>[6](https://doi.org/10.1609/aaai.v33i01.33014780)</sup><sup> • </sup><sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 通过将搜索成本降低到训练单个网络的量级，DARTS改变了NAS的经济学，并迅速被扩展到语义分割和视差估计。<sup>[3](https://arxiv.org/pdf/1909.09656v2.pdf)</sup>

## 变体

原始DARTS卷积单元在CIFAR-10上以3.3M参数达到2.76 ± 0.09%的测试误差，迁移到ImageNet移动端设置时top-1误差为26.7%，与当时最佳的强化学习方法相当；DARTS循环单元在Penn Treebank上达到55.7的测试困惑度。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 带cutout的一阶DARTS在1.5个GPU日下达到3.00 ± 0.14%，而带cutout的随机搜索基线在4个GPU日下为3.29 ± 0.15%，ENAS在0.5个GPU日搜索下为2.89%。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup>

一个庞大的变体家族针对特定弱点。渐进式DARTS（Progressive DARTS）由陈鑫（Xin Chen）及同事于2019年提出，分阶段逐步增加网络深度并按分数剪枝候选操作，在CIFAR-10上以3.4M参数达到2.50%测试误差，在ImageNet上top-1/top-5误差为24.4%/7.4%，搜索时间为0.3个GPU日。<sup>[7](https://openaccess.thecvf.com/content_ICCV_2019/papers/Chen_Progressive_Differentiable_Architecture_Search_Bridging_the_Depth_Gap_Between_Search_ICCV_2019_paper.pdf)</sup><sup> • </sup><sup>[8](https://doi.org/10.48550/arxiv.1904.12760)</sup> PC-DARTS通过在搜索期间仅采样一部分通道用于边连接，降低了超网络的内存成本。<sup>[9](https://export.arxiv.org/pdf/1907.05737v4.pdf)</sup> FairDARTS由朱翔翔（Xiangxiang Chu）及同事于2019年提出，用零一损失消除操作之间的排他选择竞争，将架构权重推向零或一，并在两个主流搜索空间上于CIFAR-10和ImageNet报告了新的最优结果。<sup>[10](https://link.springer.com/chapter/10.1007/978-3-030-58555-6_28)</sup><sup> • </sup><sup>[11](https://doi.org/10.48550/arxiv.1911.12126)</sup> DARTS+由梁瀚文（Hanwen Liang）及同事于2019年提出，在搜索中加入早停。<sup>[12](https://doi.org/10.48550/arxiv.1909.06035)</sup> DARTS-PT重新审视了最终的argmax选择步骤，通过基于扰动的选择与渐进调优来衡量每个操作对超网络的影响，在0.8个GPU日搜索下将DARTS的测试误差从3.00%改善到2.61%。<sup>[13](https://ar5iv.labs.arxiv.org/html/2108.04392)</sup> 架构感知最小化（Architecture-aware minimization，A2M）是一篇将[锐度感知最小化](https://www.edgepedia.org/zh/sharpness-aware-minimization)扩展到架构空间的研究论文，分析了可微分架构搜索空间的几何性质。<sup>[14](https://iopscience.iop.org/article/10.1088/2632-2153/adf02e/meta)</sup> I-DARTS将逐边softmax松弛为将节点的所有入边放入单个softmax，收敛速度为DARTS的1.4倍。<sup>[4](https://aclanthology.org/D19-1367.pdf)</sup> iDARTS由张淼（Miao Zhang）及同事于2021年提出，用随机隐式梯度替代连续松弛的幅度优化视角。<sup>[15](https://proceedings.mlr.press/v139/zhang21s/zhang21s.pdf)</sup><sup> • </sup><sup>[16](https://doi.org/10.48550/arxiv.2106.10784)</sup>

## 应用

除CIFAR-10图像分类外，DARTS风格的搜索已被应用于Penn Treebank语言建模和CoNLL命名实体识别，其中I-DARTS在该NER数据集上报告了当时的最优结果；通过更广泛的可微分搜索路线，还被应用于语义分割和视差估计。<sup>[4](https://aclanthology.org/D19-1367.pdf)</sup><sup> • </sup><sup>[3](https://arxiv.org/pdf/1909.09656v2.pdf)</sup>

## 局限与替代方案

该方法最著名的缺陷是退化为充满无参数操作的网络，主要是跳跃连接，伴随严重的性能损失。<sup>[13](https://ar5iv.labs.arxiv.org/html/2108.04392)</sup><sup> • </sup><sup>[17](https://www.mdpi.com/2079-9292/15/2/314)</sup> Zela、Elsken、Saikia、Marrakchi、Brox和Hutter在四个搜索空间的12个NAS基准上确认了标准DARTS会产生此类退化架构且测试性能不佳。<sup>[3](https://arxiv.org/pdf/1909.09656v2.pdf)</sup> 他们的诊断是验证过拟合：在搜索的第40轮左右，DARTS认为最优的架构的测试性能开始恶化，而超网络自身的验证误差仍在收敛，验证损失关于架构参数的海森矩阵的主特征值与架构的泛化误差强相关；一个早停变体则稳健得多。<sup>[3](https://arxiv.org/pdf/1909.09656v2.pdf)</sup> P-DARTS提供了一个相关的实践解释：搜索偏向跳跃连接是因为它在优化过程中带来最快的误差衰减，并通过包括操作级Dropout在内的搜索空间正则化来缓解。<sup>[7](https://openaccess.thecvf.com/content_ICCV_2019/papers/Chen_Progressive_Differentiable_Architecture_Search_Bridging_the_Depth_Gap_Between_Search_ICCV_2019_paper.pdf)</sup> 这些解释相互竞争。FairDARTS将问题归因于排他选择竞争——其中一个操作的优势趋近于一——而非超网络优化失败。<sup>[10](https://link.springer.com/chapter/10.1007/978-3-030-58555-6_28)</sup> DARTS-PT的作者则认为，通常被归因于超网络优化失败的跳跃连接主导，实际上是DARTS在精化其对最优特征图的估计时的合理结果。<sup>[13](https://ar5iv.labs.arxiv.org/html/2108.04392)</sup> 后来的工作将坍缩归因于无参数操作的累积优势。<sup>[17](https://www.mdpi.com/2079-9292/15/2/314)</sup>

超网络的内存开销很大，因为每条边都携带每个候选操作；PC-DARTS的部分通道连接——搜索期间每条边仅采样一部分通道——是对此的直接回应。<sup>[9](https://export.arxiv.org/pdf/1907.05737v4.pdf)</sup> 近似阶数是一种权衡：二阶DARTS因为要估计混合二阶导数而较慢，一阶DARTS存在收敛问题，两者在跳跃连接过多时都会遭遇架构坍缩。<sup>[5](https://www.math.uci.edu/~jxin/RARTS_ACCESS_2022.pdf)</sup> 与替代方案相比，原论文自己的数字显示出微弱的差距：一阶DARTS在CIFAR-10上为3.00 ± 0.14%，随机搜索为3.29 ± 0.15%，而ENAS仅用0.5个GPU日搜索就达到2.89%。<sup>[1](https://doi.org/10.48550/arxiv.1806.09055)</sup> 独立分析发现DARTS有时并不优于随机搜索，而一个带权重共享的随机搜索基线在搜索过程中保持不变，且当仅评估最终架构时优于DARTS；官方仓库记录的种子敏感性意味着单次运行的结果应谨慎对待。<sup>[3](https://arxiv.org/pdf/1909.09656v2.pdf)</sup><sup> • </sup><sup>[2](https://github.com/quark0/darts)</sup>

## References

1. [Liu, Hanxiao, Simonyan, Karen, Yang, Yiming (2018). DARTS: Differentiable Architecture Search. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1806.09055)
2. [quark0/darts, official DARTS code repository](https://github.com/quark0/darts)
3. [Understanding and Robustifying Differentiable Architecture Search (Zela et al., ICLR 2020)](https://arxiv.org/pdf/1909.09656v2.pdf)
4. [Improved Differentiable Architecture Search for Language Modeling and Named Entity Recognition (I-DARTS, EMNLP-IJCNLP 2019)](https://aclanthology.org/D19-1367.pdf)
5. [RARTS: An Efficient First-Order Relaxed Architecture Search Method (ACCESS 2022)](https://www.math.uci.edu/~jxin/RARTS_ACCESS_2022.pdf)
6. [Real, Esteban and colleagues (2019). Regularized Evolution for Image Classifier Architecture Search. AAAI Publications (The Association for the Advancement of Artificial Intelligence (AAAI)).](https://doi.org/10.1609/aaai.v33i01.33014780)
7. [Progressive Differentiable Architecture Search: Bridging the Depth Gap Between Search and Evaluation (P-DARTS, ICCV 2019)](https://openaccess.thecvf.com/content_ICCV_2019/papers/Chen_Progressive_Differentiable_Architecture_Search_Bridging_the_Depth_Gap_Between_Search_ICCV_2019_paper.pdf)
8. [Chen, Xin and colleagues (2019). Progressive Differentiable Architecture Search: Bridging the Depth Gap between Search and Evaluation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1904.12760)
9. [PC-DARTS: Partial Channel Connections for Memory-Efficient Architecture Search](https://export.arxiv.org/pdf/1907.05737v4.pdf)
10. [Fair DARTS: Eliminating Unfair Advantages in Differentiable Architecture Search (ECCV 2020)](https://link.springer.com/chapter/10.1007/978-3-030-58555-6_28)
11. [Chu, Xiangxiang and colleagues (2019). Fair DARTS: Eliminating Unfair Advantages in Differentiable Architecture Search. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1911.12126)
12. [Liang, Hanwen and colleagues (2019). DARTS+: Improved Differentiable Architecture Search with Early Stopping. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1909.06035)
13. [Rethinking Architecture Selection in Differentiable NAS (DARTS+PT)](https://ar5iv.labs.arxiv.org/html/2108.04392)
14. [Architecture-aware minimization (A2M): how to find flat minima in neural architecture search (IOPscience, 2025)](https://iopscience.iop.org/article/10.1088/2632-2153/adf02e/meta)
15. [iDARTS: Differentiable Architecture Search with Stochastic Implicit Gradients (ICML 2021)](https://proceedings.mlr.press/v139/zhang21s/zhang21s.pdf)
16. [Zhang, Miao and colleagues (2021). iDARTS: Differentiable Architecture Search with Stochastic Implicit Gradients. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2106.10784)
17. [Efficient and Lightweight Differentiable Architecture Search (MDPI Electronics, 2026)](https://www.mdpi.com/2079-9292/15/2/314)

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Titles A to H

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/differentiable-architecture-search

English original: https://www.edgepedia.org/differentiable-architecture-search
