Neural Architecture Search
Reinforcement learning, evolution and differentiable search, and what design spaces revealed.
If designing an architecture means choosing among operations and connections, an algorithm should be able to choose. The first attempts used reinforcement learning and evolution and burned thousands of GPU-days; weight sharing and differentiable search brought the cost down to one GPU-day; and careful baselines then showed that random search in the same spaces did nearly as well. The lasting lesson was about search spaces, and it led to RegNet.
What you’ll learn
- Decompose neural architecture search into search space, search strategy and performance estimation, and count the size of cell-based spaces.
- Explain reinforcement-learning controllers and aging evolution, and their compute costs.
- Derive DARTS: the softmax relaxation over operations, the bilevel objective and its first- and second-order approximations, and the discretization step.
- Explain DARTS's collapse toward parameter-free operations, and evaluate NAS honestly with random baselines, tabular benchmarks and controlled protocols.
- Describe design-space design (RegNet) and hardware-aware, once-for-all search, and the role of NAS as of the mid-2020s.
Spaces, strategies and estimates
Neural architecture search (NAS) has three parts (Elsken, Metzen & Hutter, 2019): a search space of allowed architectures, a search strategy that proposes candidates, and a performance estimate that scores them, ideally by full training and validation, in practice by cheaper proxies such as shorter training, smaller models or shared weights. Every result in this lesson is a choice in each of the three.
The most influential spaces are cell-based. Instead of searching the whole network, search one small computation graph, the cell, and stack copies of it in a fixed skeleton. NASNet (Zoph et al., 2018) searched two cells, a normal cell that keeps the resolution and a reduction cell that halves it. Each has blocks, and each block picks two inputs (the two previous cells' outputs or earlier blocks), an operation for each from a list of 13 (convolutions, separable and dilated convolutions, poolings, identity), and a way to combine them (addition or concatenation). Cells found on CIFAR-10 were then stacked more times and widened for ImageNet: the space is designed so that what is found on a small proxy transfers.
NAS-Bench-201 (Dong & Yang, 2020) searches a cell that is a directed acyclic graph on 4 nodes, with an edge from every node to every later node, and each edge carries one of 5 operations (zero, skip connection, convolution, convolution, average pooling). How many different cells are there?
Show the answer
15625
Four nodes form pairs , so 6 edges, each with 5 choices: . The "zero" operation deletes an edge, so the space also contains sparser graphs. Small enough to train every cell, which is exactly what the benchmark did on three datasets. The DARTS space, by contrast, has about discrete architectures: each of 4 intermediate nodes keeps 2 of its earlier nodes as inputs ( ways in all) with one of 7 operations on each, per cell, squared for the normal and reduction cells.
Reinforcement learning and evolution
Zoph & Le (2017) let a recurrent network, the controller, emit an architecture token by token (filter sizes, strides, number of filters, skip connections), trained a child network for each sampled architecture, and used its validation accuracy as a reward. The reward is not differentiable in the controller's parameters, so they used a policy gradient:
The controller defines a distribution over token sequences. Maximize the expected reward . Since :
Subtracting a baseline that does not depend on the sampled actions leaves the expectation unchanged, because , and reduces variance. Zoph & Le used an exponential moving average of past accuracies; with sampled architectures per update:
Each costs a full training run. They trained 12,800 child networks for 50 epochs each on CIFAR-10, 800 at a time on 800 GPUs, over several weeks; NASNet's cell search used about 500 GPUs for 4 days, roughly 2,000 GPU-days.
Regularized evolution (Real et al., 2019) replaced the controller by a population. Each cycle samples a few members, mutates the most accurate one (changing one operation or one input), trains the child, and removes the oldest member rather than the worst, so a lucky early model cannot dominate forever and good architectures must keep being rediscovered. In a controlled comparison in the same space, evolution reached good architectures faster than reinforcement learning, especially early in the search, and both beat random search. The search ran on 450 GPUs for about 7 days (roughly 3,150 GPU-days), and the resulting AmoebaNet-A, scaled up, reached 83.9% ImageNet top-1, a new best at the time.
AGING-EVOLUTION(population size P, sample size S, cycles C)
population ← empty queue; history ← ∅
while |population| < P: // random initial population
m.arch ← RANDOM-ARCHITECTURE(); m.acc ← TRAIN-AND-EVAL(m.arch)
append m to population and to history
while |history| < C:
sample ← S members drawn at random from population
parent ← the member of sample with the highest accuracy
child.arch ← MUTATE(parent.arch) // one operation or one input
child.acc ← TRAIN-AND-EVAL(child.arch)
append child to population and to history
remove the OLDEST member of population // aging, not the worst
return the most accurate model in historyAfter Algorithm 1 of Real et al. (2019). Their search used and . Removing the oldest member acts as a regularizer: an architecture survives only if retraining it keeps producing good results, which favors architectures robust to training noise.
Weight sharing and differentiable search
Training every candidate from scratch is the bottleneck. ENAS (Pham et al., 2018) built one large supergraph containing every candidate as a subgraph, with each operation's weights shared by all candidates that use it; the controller samples subgraphs, which inherit weights instead of training from zero. Every search took less than 16 hours on a single GPU, more than 1,000 times fewer GPU-hours than the original NAS. DARTS (Liu, Simonyan & Yang, 2019) went further and made the choice of operation itself continuous, so that architecture and weights are trained together by gradient descent.
In a cell, every edge carries a mixed operation, a softmax-weighted sum of all candidates (separable and dilated convolutions, poolings, identity and "zero"), with architecture parameters :
The architecture should minimize the validation loss of weights trained on the training loss, a bilevel problem with as the upper-level variable:
Approximate by one gradient step from the current weights, , and apply the chain rule:
The mixed second derivative times a vector costs only two extra gradient evaluations by a central finite difference, with and . Setting drops the term entirely: the faster first-order DARTS, which simply alternates gradient steps on (validation loss) and (training loss).
Finally discretize: on each edge take the strongest operation other than zero, and keep each node's two strongest incoming edges. The resulting cell is retrained from scratch in a deeper network.
On CIFAR-10 the second-order search took 4 GPU-days and the first-order one 1.5, against about 2,000 for NASNet and 3,150 for AmoebaNet, and the cells reached 2.76% and 3.00% test error, comparable to theirs. In the same space, random search reached 3.29%: better than the hand-designed DenseNet-BC in the same comparison (3.46%), worse than DARTS. The DARTS paper itself noted that random search being competitive "reflects the importance of the search space design".
Collapse, and a sober look at evaluation
DARTS turned out to be fragile. Zela et al. (2020) built twelve benchmarks from four search spaces in which it returned degenerate cells, dominated by parameter-free operations such as skip connections, with very poor test error, even though the search was minimizing the validation loss. They found that the dominant eigenvalue of the Hessian of the validation loss with respect to correlates strongly with the final error: when the relaxed solution sits in a sharp region of architecture space, rounding it to a discrete cell (the discretization gap) costs a lot. Early stopping when the eigenvalue grows, and stronger regularization of the inner training problem, fixed the failures in all twelve. Wang et al. (2021) located another part of the problem in the last step: the magnitude of need not reflect how much an operation contributes to the supernet, and selecting operations by perturbing the supernet instead removed several failure modes.
Meanwhile the baselines caught up. Li & Talwalkar (2019) found that random search with early stopping performed at least as well as ENAS on both standard benchmarks, that random search with weight sharing did better still, and that many published results lacked the code, seeds and details needed to reproduce them. Yang, Esperança & Carlucci (2020) compared eight methods on five datasets by their improvement over the average randomly sampled architecture of their own space, and found that many struggled to beat it significantly; tricks in the training protocol had a larger effect than the searched cell, and in the narrow accuracy range of the DARTS space the random seed reordered the rankings. Yu et al. (2020) found that weight sharing degrades the ranking of candidates so much that it no longer reflects their true quality.
A new NAS method finds a CIFAR-10 cell with 2.6% test error in the DARTS space. What comparison best shows that the search strategy deserves credit?
- Compare with ResNet-110, a well-known hand-designed network
- Compare with randomly sampled cells from the same space, trained with the same protocol and several seeds
- Compare with the published error of DARTS, from its paper
- Report that the search took less than one GPU-day
Show the answer
B. Compare with randomly sampled cells from the same space, trained with the same protocol and several seeds
Gains can come from the space, the training tricks (cutout, auxiliary towers, longer schedules) or the seed. Only a same-space, same-protocol random baseline, averaged over seeds, isolates the search strategy.
Tabular benchmarks made such comparisons cheap and reproducible. NAS-Bench-101 (Ying et al., 2019) trained each of about 423,000 unique cells (up to 7 nodes and 9 edges, three kinds of operation) three times at four training budgets, about 5 million training runs, so a search algorithm can be evaluated by table lookup; NAS-Bench-201 did the same for its 15,625 cells on three datasets. They exposed how much published comparisons had depended on implementation details.
Designing design spaces, and NAS today
Radosavovic et al. (2020) turned the lesson into a method: instead of searching for the single best network, design the space and judge it by the distribution of its models. They sample hundreds of networks from a space, train each briefly, and plot the error empirical distribution function (EDF), the fraction of models with error below each value; a better space has its EDF shifted toward low error. Starting from an unconstrained space of ResNet-like stages (AnyNet), they kept each simplification that did not hurt the EDF, such as sharing one bottleneck ratio and one group width across stages, or that helped it, such as letting widths and depths increase from stage to stage.
What survived is RegNet: block widths that grow linearly, for blocks , then quantized to powers of a ratio , writing and rounding , so that each stage has constant width . Six numbers (, bottleneck ratio , group width ) describe a whole network. The population analysis contradicted common practice: the best models were about 20 blocks deep at every compute budget, used no bottleneck () and no inverted bottleneck, and grew width by about per stage. Under comparable training settings and FLOPs, RegNets outperformed EfficientNets while being up to five times faster on GPUs.
Searching for hardware. When the goal is speed on a particular device, the search can measure it. MnasNet put measured phone latency into the reward, (Tan et al., 2019), and MobileNetV3 combined such a search with layer-wise tuning (Efficient ConvNets). Once-for-all networks (Cai et al., 2020) train a single supernet whose sub-networks vary in depth, width, kernel size and resolution, by progressive shrinking: train the largest network, then fine-tune it to also support smaller choices, one dimension at a time. The result contains more than sub-networks, and specializing to a new device or latency budget is a search over sub-networks with no retraining.
NAS in the scaling era. As of the mid-2020s, the largest vision and language models are hand-designed architectures, mostly transformers, scaled by width, depth and data according to scaling laws (Neural Scaling Laws), and the main lever has moved from architecture to data and training recipe. Search remains in use where a fixed hardware budget makes small architectural differences matter, for mobile and embedded models, and in the automated tuning of hyperparameters.
Key takeaways
- NAS = search space + search strategy + performance estimate; cell-based spaces search a small graph and stack it, and their size is a product of choices ( for NAS-Bench-201, about for DARTS).
- RL controllers (REINFORCE with a baseline) and aging evolution found strong cells at a cost of thousands of GPU-days; evolution was faster early in the search, and random search was a strong baseline in the same spaces.
- DARTS relaxes each edge to a softmax mixture, solves with a one-step (and finite-difference) approximation, and discretizes to the top-2 inputs per node, at 1.5–4 GPU-days.
- DARTS can collapse to parameter-free operations when the relaxed solution is sharp; random baselines, same-protocol comparisons over seeds and tabular benchmarks showed that much of NAS's reported gain came from spaces and training tricks.
- Designing design spaces produced RegNet's simple quantized linear widths; hardware-aware and once-for-all search remain useful for efficient deployment, while large models are mostly scaled by hand.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
A cell is a directed acyclic graph on 4 nodes with an edge from every node to every later node, and each edge carries one of 4 operations. How many cells does the space contain?
Show the answer
D.
There are edges, each with 4 choices: .
In DARTS, what are the architecture parameters , and how is a discrete cell obtained at the end of the search?
- They are the probabilities of a controller network; the cell is sampled from it
- They are logits of a softmax over candidate operations on each edge; each edge keeps its strongest non-zero operation and each node its two strongest inputs
- They are the convolution weights; the cell keeps the largest weights
- They are binary masks trained with a straight-through estimator
Show the answer
B. They are logits of a softmax over candidate operations on each edge; each edge keeps its strongest non-zero operation and each node its two strongest inputs
The mixed operation weights every candidate by . After the search, the softmax weights rank the operations, and the discretized cell is retrained from scratch.
On several search spaces, DARTS returned cells made almost entirely of skip connections, with poor test error. Which explanation does the evidence support?
- Skip connections are always the best operation, and the test sets were mislabeled
- The search failed to reduce the validation loss
- The relaxed solutions sat in sharp regions of the validation loss in architecture space (large dominant Hessian eigenvalue), so discretizing them hurt; early stopping and stronger regularization fixed it
- DARTS's first-order approximation is wrong, and the second-order version never fails
Show the answer
C. The relaxed solutions sat in sharp regions of the validation loss in architecture space (large dominant Hessian eigenvalue), so discretizing them hurt; early stopping and stronger regularization fixed it
Zela et al. (2020) found that the search did minimize validation loss, but the curvature with respect to predicted the poor generalization of the discretized cell. Selecting operations by perturbation rather than by 's magnitude also helps (Wang et al., 2021).
What did the population-level analysis of the RegNet design space find about good networks?
- The best models grow deeper with every increase in compute and use inverted bottlenecks
- Widths should be constant across stages, as in VGG
- Depth hardly matters, only the total number of parameters
- The best models were about 20 blocks deep at every compute budget, used no bottleneck, and widened each stage by about 2.5 times
Show the answer
D. The best models were about 20 blocks deep at every compute budget, used no bottleneck, and widened each stage by about 2.5 times
Their widths follow a quantized linear rule, rounded to powers of , and they ran up to five times faster on GPUs than EfficientNets of similar accuracy and FLOPs.
Further reading
- B. Zoph & Q. V. Le, "Neural architecture search with reinforcement learning," ICLR (2017).
- E. Real, A. Aggarwal, Y. Huang & Q. V. Le, "Regularized evolution for image classifier architecture search," AAAI (2019).
- H. Liu, K. Simonyan & Y. Yang, "DARTS: Differentiable architecture search," ICLR (2019).
- L. Li & A. Talwalkar, "Random search and reproducibility for neural architecture search," UAI (2019).
- I. Radosavovic, R. P. Kosaraju, R. Girshick, K. He & P. Dollár, "Designing network design spaces," CVPR (2020).