Neural Architecture Search: Theory & Methods
Automating network design: search spaces, search strategies (RL, evolutionary, gradient-based), weight sharing (supernets, one-shot NAS), DARTS differentiable search, hardware-aware NAS, and EfficientNet/MobileNet design.
Prerequisites
Table of Contents
- Learning Objectives
- Notation
- Core Intuition
- The NAS Problem
- Search Spaces
- RL-Based Search (NASNet)
- Evolutionary Search (AmoebaNet)
- DARTS: Differentiable NAS
- One-Shot NAS & Weight Sharing
- Hardware-Aware NAS
- Common Pitfalls
- Summary
- Exercises
Learning Objectives
- Formulate NAS as a bilevel optimization problem.
- Compare RL, evolutionary, and gradient-based search strategies.
- Derive DARTS continuous relaxation of the discrete search space.
- Explain weight sharing and why it reduces search cost.
- Design hardware-aware search with latency constraints.
Notation
- — search space (set of candidate architectures)
- — architecture parameters
- — network weights
- — validation and training loss
Core Intuition
Designing neural network architectures requires expertise and extensive experimentation. NAS automates this: define a SEARCH SPACE of possible architectures, then use SEARCH STRATEGIES to find the best one. Early methods (NASNet) used RL — training thousands of networks to evaluate each candidate. Modern methods (DARTS, one-shot) make the search differentiable or use weight sharing — finding architectures in GPU-hours instead of GPU-months.
Neural Architecture Search
The NAS Problem
Bilevel optimization:
Three components:
- Search space : What architectures are possible?
- Search strategy: How to explore efficiently?
- Performance estimation: How to evaluate a candidate cheaply?
Challenge: is combinatorially large (e.g., possible architectures). Can't evaluate all.
Search Spaces
Cell-based (NASNet): Search for two cell types (normal + reduction), then stack them:
- Operations: 3x3 conv, 5x5 conv, pooling, identity, dilated conv.
- Connections: which operations feed into which.
- Cell repeated times → full architecture.
Network-level: Search for depth, width, resolution per stage.
- EfficientNet: compound scaling of depth × width × resolution.
Operation-level: For each edge in a DAG, choose one operation from a set.
Macro search: Search overall topology (skip connections, branching). Micro search: Fix topology, search operation choices.
RL-Based Search (NASNet)
Zoph & Le (2017): Controller RNN generates architecture descriptions; trained with REINFORCE:
where = validation accuracy of architecture .
Process:
- Controller samples an architecture (sequence of choices).
- Train the architecture from scratch (full training).
- Evaluate on validation set → reward.
- Update controller with REINFORCE.
- Repeat for 20,000+ architectures.
Cost: 2000 GPU-days for original NASNet. Prohibitively expensive.
Result: Found architectures outperforming human-designed ones (NASNet-A on ImageNet).
Evolutionary Search (AmoebaNet)
Real et al. (2019): Tournament selection + mutation:
- Maintain population of architectures.
- Select two random candidates; keep the better one (tournament).
- Mutate winner (change one operation, add/remove connection).
- Train mutant; add to population.
- Remove oldest member.
Advantages over RL:
- Simpler (no controller training).
- More diverse exploration (multiple candidates simultaneously).
- Comparable results to RL-based search.
Cost: Similar to RL (thousands of full training runs).
DARTS: Differentiable NAS
Liu et al. (2019): Make architecture search differentiable:
Continuous relaxation: Instead of choosing ONE operation per edge, use a weighted sum:
where are learnable architecture parameters.
Bilevel optimization with gradient descent:
- Update on training loss: .
- Update on validation loss: .
After search: Discretize by keeping the top-1 operation per edge ().
Cost: 1-4 GPU-days (1000x cheaper than RL-based NAS).
Limitations: Skip connection collapse (DARTS often converges to mostly skip connections). Fix: early stopping of architecture search; regularization of .
One-Shot NAS & Weight Sharing
Key insight: Train a SUPERNET containing all possible architectures as subnetworks. Evaluate any architecture by extracting its weights from the supernet.
Process:
- Build a supernet (all operations on all edges active simultaneously).
- Train supernet with uniform path sampling (each step, randomly activate one subnetwork).
- After training: evaluate candidate architectures by using their paths' weights from the supernet.
- Select the architecture with best supernet-inherited performance.
Cost: One training run of the supernet (same cost as training ONE architecture).
Accuracy: Weight sharing introduces noise (shared weights aren't optimal for any single architecture). But ranking correlation with independent training is high enough for search.
Hardware-Aware NAS
Optimize for latency, not just accuracy:
or equivalently: subject to .
Latency prediction:
- Lookup table: measure latency of each operation on target hardware.
- Latency model: learned predictor from architecture → latency.
- On-device measurement: directly measure (slow but accurate).
MNASNet (Tan et al., 2019): Found architectures Pareto-optimal for accuracy vs mobile latency.
EfficientNet: NAS-found base architecture (B0), then compound-scaled (B1-B7) by jointly increasing depth/width/resolution.
Common Pitfalls
Pitfall 1. DARTS skip-connection collapse. Without regularization, DARTS converges to architectures dominated by skip connections (identity operations that reduce training loss but limit capacity). Use auxiliary loss on operation diversity.
Pitfall 2. Supernet weight coupling. In one-shot NAS, weights are shared but operations compete. A "bad" operation sharing weights with a "good" one may appear better than it is (free-riding).
Pitfall 3. Searching on proxy tasks that don't transfer. Architectures found on CIFAR-10 (small images, 10 classes) may not be optimal for ImageNet (large images, 1000 classes). Use search tasks similar to the deployment target.
Summary
- NAS: Automate architecture design as bilevel optimization.
- RL/Evolutionary: Train thousands of architectures; expensive but thorough.
- DARTS: Differentiable search via continuous relaxation; 1000x cheaper.
- One-shot: Weight-sharing supernet; cost of ONE training run.
- Hardware-aware: Optimize accuracy + latency jointly.
- Results: NAS-found architectures (EfficientNet, MobileNet) dominate human designs.
Exercises
Exercise 1. Define the search space for a 6-layer transformer NAS: specify what choices exist at each layer (attention heads, FFN size, activation).
Exercise 2. Derive the gradient in DARTS using the chain rule through the softmax relaxation.
Exercise 3. For one-shot NAS with 8 operations per edge and 14 edges: compute the total number of architectures in the search space.
Exercise 4. Build a latency lookup table for: 3x3 conv, 5x5 conv, 3x3 depthwise conv, skip connection on a target hardware. Use these to predict full network latency.
Exercise 5. Compare DARTS vs random search on a small search space (100 architectures). When does DARTS outperform random?