Foundations to Frontier
Tests
E. Deep Learning › E19 Continual, Multi-Task and Transfer Learning

Neural Architecture Search (DARTS, ENAS)

Neural architecture search (NAS) automates the choice of network structure: which operations, connections and sizes to use. Early methods trained thousands of candidate networks with reinforcement learning or evolution, costing thousands of GPU-days. ENAS (Pham et al., 2018) shares weights between candidates in one supernet. DARTS (Liu, Simonyan and Yang, 2019) relaxes the discrete choice into a softmax mixture of operations whose weights are learned by gradient descent. This page covers search spaces, search strategies, weight sharing, the DARTS bilevel problem, and evaluation pitfalls. In the exercises you implement the DARTS mixed operation and derivation, then search 16 two-layer architectures where the ground truth is known. Training every candidate showed linear-sin is best (test MSE 0.001 against 0.59 for the worst). Weight-sharing one-shot search picked a top-2 architecture in every seed, but ranked the rest only moderately (Kendall τ 0.52–0.67). DARTS found the best in two seeds and committed to the 6th-best in the other.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Letting the computer design the network

Choosing layers, activations and connections by hand takes experience and trial and error. Neural architecture search automates it: define a menu of options, then search for the combination that works best. Training every combination separately is far too expensive, so modern methods train one big “supernet” containing all options and share its weights. The demo shows how quickly the number of possible architectures explodes.

Transfer and efficiency lab
4 ops on 14 edges give 2.68e+8 discrete architectures. A DARTS supernet mixes all 4 ops on every edge (cost about 4 networks) and learns α; this edge's mixture weights (first 4 ops) put 47% on op 1, which would be kept if it is the largest.
Why engineers care

NAS produced efficient mobile networks (MnasNet, EfficientNet) and is used to find architectures that meet latency and energy budgets on specific hardware, such as the processors on drones and satellites.

📝 Quick check (Level 0)
0/3 answered
  1. 1. NAS automates…
  2. 2. Weight sharing trains…
  3. 3. The number of possible architectures grows…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Three ingredients:
    • Search space: for example a cell with E edges, each choosing one of k ops (k^E architectures; 8 ops on 14 edges is about 4.4 × 10¹²).
    • Search strategy: random search, reinforcement learning (NASNet), evolution (AmoebaNet), gradient-based (DARTS).
    • Performance estimation: full training, early stopping, or weight sharing.
  • ENAS: an RNN controller samples architectures as paths in a shared supernet, trained with REINFORCE on validation reward. All children share weights, cutting search from about 2000 GPU-days (NASNet) to under one.
  • DARTS:
    • each edge computes ō(x) = Σ_k softmax(α)_k o_k(x);
    • bilevel problem min_α L_val(w*(α), α) with w*(α) = argmin_w L_train(w, α), approximated by alternating gradient steps (first-order DARTS);
    • the final architecture takes argmax α on each edge, then is retrained from scratch.
  • Costs: a DARTS supernet holds all k ops’ activations, about k times one network’s memory.
  • Random search baseline: the best of m random picks from n has expected rank (n + 1)/(m + 1) (3.4 for 4 of 16).
📝 Quick check (Level 1)
0/3 answered
  1. 1. Architectures with 4 ops on 2 edges:
  2. 2. DARTS chooses the final op on each edge by…
  3. 3. Expected rank of the best of 4 random picks from 16:

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

NAS in code

Exercise 1.

  • Implement the DARTS mixed operation.
  • Derive the discrete architecture.
  • Count the search space.

Practice.

  • Tools: NNI (Microsoft), Auto-PyTorch, Optuna or Ray Tune for hyperparameter and architecture search, and the NAS-Bench-101/201/301 tabular benchmarks for fair comparison.
  • Always compare against random search with the same budget; it is a surprisingly strong baseline.
  • Retrain the found architecture from scratch with several seeds before claiming gains.
  • Add hardware cost (latency, energy) to the objective for deployment: hardware-aware NAS.
alpha = nn.Parameter(1e-3 * torch.randn(n_edges, n_ops))
def mixed(x, e): w = F.softmax(alpha[e], -1); return sum(wi * op(x) for wi, op in zip(w, ops[e]))
for xb_tr, xb_val in loader:                                     # first-order DARTS
    w_opt.zero_grad(); loss_fn(net(xb_tr)).backward(); w_opt.step()
    a_opt.zero_grad(); loss_fn(net(xb_val)).backward(); a_opt.step()
arch = alpha.argmax(-1)                                          # then retrain this architecture from scratch
🐍 Exercise 1: mixed operations and derivation
Implement the DARTS mixed operation, the argmax derivation and the search-space size.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Tabular benchmarks for fair NAS comparison:
  2. 2. A strong baseline to always run:
  3. 3. Hardware-aware NAS adds…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Why weight sharing works, partly. If a supernet’s shared weights were good for every sub-architecture, scoring sub-networks with them would rank architectures like independent training would, at a fraction of the cost. In practice the shared weights are a compromise: rankings correlate only moderately with stand-alone performance, and they favour architectures that train fast.

DARTS failure modes.

  • α is learned jointly with under-trained weights, so it can commit early to operations that help the supernet now, not the final network.
  • Parameter-free ops (skip connections) are a known attractor.
  • Discretisation (argmax) creates a gap between the mixture and the chosen architecture.
  • Fixes include early stopping, regularisation of α (DARTS+, RobustDARTS), progressive pruning of ops and perturbation-based selection.

Evaluation pitfalls. Many NAS gains vanish against random search with equal budgets and identical training pipelines (Li and Talwalkar, 2019; Yang et al., 2020). Search spaces designed by experts already contain mostly good architectures.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Weight-sharing rankings correlate with stand-alone results…
  2. 2. A known DARTS attractor:
  3. 3. Many NAS gains vanish against…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

Do one-shot and differentiable search find the best architecture?

History.

  • B. Zoph and Q. V. Le, “Neural architecture search with reinforcement learning” (ICLR 2017).
  • H. Pham et al., “Efficient neural architecture search via parameter sharing” (ICML 2018).
  • H. Liu, K. Simonyan and Y. Yang, “DARTS: differentiable architecture search” (ICLR 2019).
  • L. Li and A. Talwalkar, “Random search and reproducibility for NAS” (UAI 2019).

Exercise 2.

  • Task: regression y = sin(2x·a) + 0.5 tanh(3x·b), x ∈ [−2, 2]⁴, with 400 training, 400 validation and 2000 test samples.
  • Search space: two hidden layers of 16 units, each with activation linear, relu, tanh or sin, giving 16 architectures.
  • Ground truth: each architecture trained separately (Adam, 400 steps) and scored on test MSE.
  • Searches:
    • DARTS, first order: supernet with softmax-mixed activations; weights updated on training data, α on validation data; argmax at the end;
    • one-shot weight sharing (ENAS-style, uniform random paths instead of a learned controller): each architecture scored on validation data with the shared weights;
    • random search: best of 4 architectures (mean over 200 draws).
seed best architecture (test MSE) worst MSE DARTS choice (rank) one-shot choice (rank) one-shot Kendall τ random search of 4 (mean rank)
0 linear-sin (0.0010) 0.590 tanh-sin (6) sin-sin (2) 0.517 3.33
1 linear-sin (0.0002) 0.527 linear-sin (1) linear-sin (1) 0.517 3.73
2 linear-sin (0.0007) 0.537 linear-sin (1) linear-sin (1) 0.667 3.72
  • Architecture matters a lot here: the best and worst differ by more than 100× in MSE. A sinusoidal last layer suits the target.
  • One-shot search found a top-2 architecture every time, at the cost of training one supernet instead of 16 networks. But its ranking of all 16 was only moderately correlated with the truth (τ 0.52–0.67).
  • DARTS was unstable:
    • in seed 0 its α committed early (softmax 0.98 on tanh in layer 1) and it chose the 6th-best;
    • in a cheaper setting (200 data points, 200–250 steps) it chose ranks 3–9 in all seeds while one-shot still chose ranks 1–3. Early commitment of α before the weights are trained is a known DARTS failure.
  • Random search of 4 averaged rank 3.3–3.7, close to the theoretical 3.4. Both one-shot and DARTS (when it worked) beat it, but on a space of only 16, exhaustive search is affordable anyway.
🐍 Exercise 2 (research): do one-shot and differentiable search find the best architecture?
Train all 16 two-layer architectures for ground truth, then run first-order DARTS, one-shot weight sharing and random search, and compare their choices.

NAS in AI, robotics and aerospace

  • Efficient vision models: MnasNet, EfficientNet and FBNet were found with hardware-aware NAS for mobile processors.
  • Embedded autonomy: searching detectors that meet latency budgets on drone and automotive accelerators.
  • Scientific ML: searching architectures for surrogate models of aerodynamic or thermal simulations.
  • Design lesson: compare with random search on the same budget, retrain the winner from scratch, and treat weight-sharing rankings as rough.

References

  1. B. Zoph and Q. V. Le (2017). “Neural architecture search with reinforcement learning.” Proc. ICLR.
  2. H. Pham, M. Guan, B. Zoph, Q. Le and J. Dean (2018). “Efficient neural architecture search via parameter sharing.” Proc. ICML.
  3. H. Liu, K. Simonyan and Y. Yang (2019). “DARTS: differentiable architecture search.” Proc. ICLR.
  4. L. Li and A. Talwalkar (2019). “Random search and reproducibility for neural architecture search.” Proc. UAI.