TL;DR
DARTS is a method for automatically designing the repeated building block of a neural network. Instead of trying architectures one at a time, it gives every possible connection a mixture of candidate operations, learns the mixing weights with gradient descent on validation data, and only at the end picks one operation per connection. The paper reports a convolutional cell with 2.76% test error on CIFAR-10 found in about 1.5 to 4 GPU days of search, against 2000 GPU days for the earlier reinforcement-learning search.
Builds on: Neural Architecture Search, Bilevel Optimization, Softmax · Leads to: differentiable architecture search methods that reuse the same relaxation idea
Why it mattered
Most of the image and language models people use today have architectures that were designed or tuned by hand, and automatic design (NAS) became a serious research line when it began to match those designs. The first wave worked, but it was expensive: the cell that NASNet-A used for CIFAR-10 and ImageNet took about 2000 GPU days of reinforcement-learning search, and the AmoebaNet evolution search took 3150 GPU days, according to the paper's introduction.
DARTS showed that the same kind of search could be run in a few GPU days by changing the search itself rather than adding more compute. Its code is public at the GitHub repository listed in the sources, which made it easy to build on. The continuous-relaxation idea it introduced is the starting point for a large family of later "differentiable" search methods, and it casts the search as a bilevel optimization problem, the framing the paper uses throughout.
The problem
Earlier NAS methods treat each candidate architecture as a black box. A controller proposes a network, the network is trained, a validation score comes back as a reward or fitness, and the loop repeats. The paper's diagnosis is that this is slow because the search space is discrete: there is no gradient that says "change this connection a little in this direction", so the method must evaluate a very large number of architectures.
The paper keeps the same goal, minimising validation loss, but asks whether the discrete choice can be made continuous so that gradients can be used. Two obstacles follow. First, the choice of architecture and the weights of the network depend on each other: a good architecture is only good once its weights are trained. Second, a naive gradient step on the architecture would be expensive to compute. Sections 2.2 and 2.3 of the paper deal with these two obstacles in turn.
How it works
The search space is a cell, a small directed acyclic graph of nodes. Each node is a feature map, and each directed edge carries one operation (a convolution, a pooling, an identity, or a "zero" meaning no connection). The cell has two input nodes and one output node. A full network stacks copies of a cell.
Here is the procedure on one edge, with three candidate operations: identity, doubling and zero.
- Give each candidate on the edge a score. Start them at zero. Call the three scores α = (0, 0, 0).
- Turn the scores into weights with a softmax. Each weight is exp(score) divided by the sum of all exp(score). With all scores zero, every weight is 1/3.
- Feed the same input to every candidate and add the outputs, each multiplied by its weight. The edge now outputs a weighted mixture instead of one operation. Check: with input 4 and all weights 1/3, the outputs are 4, 8 and 0, and the mixture is (4 + 8 + 0) / 3 = 4.
- Train the network weights w on training batches, with the mixture in place. The scores α are not changed in this step.
- Change α on validation batches, with a gradient step on the validation loss. Suppose the doubling operation is useful to the validation loss; its score rises and its softmax weight grows. Now the edge leans towards doubling.
- Repeat steps 4 and 5 for many batches, alternating the two updates.
- At the end, replace each mixed edge with its strongest operation: the one with the largest α, leaving out zero. Here the scores are α = (0, 1, 2), so the zero operation (score 2) is the largest and is dropped; doubling (score 1) wins over identity (score 0).
- Build the final network from the discrete cells, train it from scratch with new random weights, and report its test error. The test set is never used during the search.
flowchart LR A[Discrete cell space] --> B[Mix all candidates on each edge with softmax weights] B --> C[Step on network weights w using training loss] C --> D[Step on architecture scores alpha using validation loss] D --> C D --> E[Keep strongest operation per edge, drop zero] E --> F[Retrain from scratch and test]
The math
The mixed operation on edge (i, j) is a softmax-weighted sum over the candidate set O. Each candidate is a function o applied to the node x^(i):
Here α^(i,j) is a vector with one score per candidate, and the coefficients sum to one. The whole search is over the set of all scores α = {α^(i,j)}.
Step 2 in symbols
For the three-candidate example with α = (0, 1, 2), the weights are exp(0)/S, exp(1)/S and exp(2)/S, where S = 1 + 2.71828 + 7.38906 = 11.10734. So the weights are 0.090, 0.245 and 0.665. They sum to one.
Step 3 in symbols
With input x = 4, the three outputs are o_id(4) = 4, o_double(4) = 8 and o_zero(4) = 0. The mixture is 0.090 times 4 plus 0.245 times 8 plus 0.665 times 0, which is about 2.32.
Steps 4 and 5 in symbols
The two objectives are the training loss L_train(w, α) and the validation loss L_val(w, α). The paper writes the search as a bilevel problem. The upper variable is α, the lower variable is w:
Solving the inner problem exactly for each α is too expensive, so the paper replaces w^*(α) with one gradient step of size ξ on the training loss. Write w' = w − ξ ∇_w L_train(w, α). The approximate architecture gradient is then
The second term contains a Hessian-vector product, which is costly. The paper approximates it with a finite difference. Let and . Form and . Then the Hessian-vector product is about
This needs two forward passes and two backward passes, and reduces the cost from order to order .
Setting ξ = 0 removes the second term entirely. The paper calls that the first-order approximation; with ξ > 0 it is the second-order approximation.
The toy case in the paper
Figure 2 of the paper uses L_val = αw − 2α + 1 and L_train = w² − 2αw + α². Starting from (α, w) = (2, −2), the bilevel optimum is (α*, w*) = (1, 1). The paper uses it to show the learning dynamics of its iterative algorithm, which moves from the starting point to the bilevel optimum. Treat it as an illustration of the dynamics, not as a claim about deep networks.
- weight of the first of two candidates
Results
The paper reports the following numbers. Each one appears in the paper's text; the full comparison tables are in the original.
- CIFAR-10. The searched convolutional cell reaches 2.76 ± 0.09% test error with about 3.3M parameters, which the paper calls competitive with the regularized evolution result. The search cost is stated in the paper as 1.5 or 4 GPU days, depending on the variant. The paper's table captions say its search cost excludes one GPU day of cell selection and the final training of the selected architecture.
- Compared with random search. Random sampling from the same space gives 3.29 ± 0.15% on CIFAR-10 and 59.4 perplexity on Penn Treebank. DARTS gives 2.76 ± 0.09% and 55.7.
- Penn Treebank. The searched recurrent cell reaches 55.7 test perplexity. The paper says this is on par with the best mixture-of-softmaxes model it cites and better than an extensively tuned LSTM.
- ImageNet, mobile setting. The CIFAR-10 cell transfers and reaches 26.7% top-1 error. The paper calls this comparable with the best reinforcement-learning method.
- Joint optimisation ablation. Optimising α on the union of training and validation data, instead of the bilevel scheme, gives 4.16 ± 0.16% (coordinate descent) or 3.56 ± 0.10% (SGD) on CIFAR-10. The paper hypothesises that the scores then overfit the training data.
Limits, as the paper states them: the continuous architecture can differ from the discrete one it is turned into; the recurrent results depend on the random seed, so the paper ran four seeds and picked a cell by a short retraining; and the cell found on PTB transfers to WikiText-2 less well than the CIFAR cell transfers to ImageNet. The authors suggest annealing the softmax temperature to push the weights towards one-hot choices.
Reading guide
- Introduction (Section 1): the cost problem of earlier NAS methods. Needs Neural Architecture Search.
- Section 2.1, search space: a cell as a DAG with an ordered node sequence. Needs Convolutional Neural Network and Recurrent Neural Network at the level of "a cell is a block that gets stacked".
- Section 2.2, continuous relaxation: the softmax mixture and the bilevel problem. Needs Softmax and Bilevel Optimization.
- Section 2.3, approximate gradient: the one-step unrolled gradient and the finite difference. Needs Gradient Descent, Chain Rule, Hessian Matrix and Finite Difference Method.
- Section 2.4, deriving discrete architectures: top-k selection and why zero is excluded. Needs Softmax.
- Section 3, experiments: search, evaluation and transfer. Needs Perplexity for the language model numbers.
- Appendices A and C: the training settings and the size of the search space. The settings use Batch Normalization and Stochastic Gradient Descent.
Check yourself
QuestionRecall: what does the softmax in DARTS do to the scores α of the candidate operations on one edge?Show answer
It turns the scores into non-negative weights that sum to one. The edge output is the weighted sum of all candidate operations, so each candidate contributes in proportion to its weight.
QuestionComputation: an edge has candidates with scores α = (0, 0, 0, 0). What is each softmax weight, and what is the output for an input of 8 if the candidates return 8, 4, 2 and 0?Show answer
Each weight is 1/4 = 0.25. The output is 0.25 times (8 + 4 + 2 + 0) = 0.25 times 14 = 3.5.
QuestionWhy: the paper drops the zero operation when it derives the final cell, but keeps it in the search. Give the reason it gives for dropping it at the end.Show answer
Zero marks a missing connection. The paper wants exactly k non-zero incoming edges per node for a fair comparison with earlier models, and the strength of zero is underdetermined: with batch normalization after the operations, raising the zero logits only changes the scale of the node, not the classification outcome.
QuestionApplied: a search space has 14 learnable edges, and each edge has 8 candidates including zero. The paper writes the relaxed count as (7 + 1) to the power 14. Compute this and say what it tells you about the search.Show answer
8 to the power 14 is 2 to the power 42, which is about 4.4 times 10 to the power 12 (the paper rounds this to 4 times 10 to the power 12). The continuous relaxed space is therefore far larger than the number of discrete cells one can sample by hand, yet the search only moves a vector of about 14 times 8 scores, which is why gradient descent is practical.
Sources
- Liu, Simonyan and Yang (2018), DARTS: Differentiable Architecture Search. https://arxiv.org/abs/1806.09055
- Official code for the paper: https://github.com/quark0/darts
- Zoph and Le (2016), Neural Architecture Search with Reinforcement Learning. https://arxiv.org/abs/1611.01578