Skip to content
Mar 5

Neural Architecture Search with DARTS

MT
Mindli Team

AI-Generated Content

Neural Architecture Search with DARTS

Designing an effective neural network architecture is a complex, time-consuming task that often requires expert intuition and extensive trial-and-error. Neural Architecture Search (NAS) aims to automate this process, but early methods were prohibitively expensive, requiring thousands of GPU days. Differentiable Architecture Search (DARTS) revolutionized the field by making the search process orders of magnitude more efficient through a simple yet powerful idea: relax the discrete search problem into a continuous, differentiable one that can be optimized with gradient descent, transforming architecture search from a combinatorial nightmare into a manageable optimization problem.

From Discrete Search to Continuous Relaxation

Traditional NAS treats the search for an architecture as a discrete optimization problem over a vast space of possible connections and operations (e.g., convolution, pooling, identity). This is like searching for a needle in a haystack, typically requiring reinforcement learning or evolutionary algorithms that train and evaluate thousands of candidate networks from scratch.

DARTS's fundamental breakthrough is its continuous relaxation of this discrete search space. Instead of forcing a hard choice between operations on a given network connection, DARTS considers a mixture of all possible operations. In practice, each edge between two nodes (or layers) in the search network is associated with every candidate operation. The output of an edge is computed as a weighted sum of the outputs from all these operations. The weight for each operation is determined by a softmax over a set of continuous, learnable architecture parameters (denoted as ). For a mixed operation on a single edge, the output is:

Here, is the set of candidate operations (e.g., 3x3 convolution, 5x5 convolution, max pool), and is the input to the edge. This formulation is key: by making the architecture selection a soft, weighted choice parameterized by , the entire search process becomes differentiable with respect to these parameters. You can now use gradient-based optimization to learn which operations are most important, rather than sampling them randomly.

Designing the Search Space and Super-Network

The search space in DARTS is typically defined as a directed acyclic graph (DAG), often structured as a cell that is then stacked to form the final network. A cell contains an ordered sequence of nodes, where each node is a latent representation (like a feature map), and each edge between nodes represents a candidate set of operations mixed via the softmax weighting described above. Common operation candidates include various convolutions, pooling layers, skip connections (identity), and a zero operation (representing no connection).

This results in an over-parameterized super-network or one-shot model that contains all possible architectural paths within the search space. During the search phase, you do not train individual subnetworks. Instead, you train this single, massive super-network. The weights of the operations (the standard network weights, ) and the architecture parameters () that govern the mixing are optimized simultaneously. This is far more efficient than training thousands of independent child networks to completion.

The Bi-Level Optimization Problem

Training the super-network is not a simple joint optimization. The goal is to find architecture parameters that lead to a network with good performance on unseen data after its weights are trained. DARTS frames this as a bi-level optimization problem:

  1. The upper-level objective is to minimize the validation loss with respect to the architecture parameters .
  2. The lower-level objective is to minimize the training loss with respect to the network weights .

Mathematically, this is expressed as:

In practice, this is solved using an alternating gradient-based approximation. You perform a few steps of gradient descent on the network weights on the training set, then perform a gradient step on the architecture parameters using the validation set. This alternating process encourages the search to find architectures () that generalize well, as they are evaluated based on validation performance. The use of the validation set for updates is critical to avoid overfitting the architecture to the training data.

Deriving the Final Discrete Architecture

After the search converges, you are left with a set of learned, continuous architecture parameters . However, you need a final, discrete architecture to train and deploy. DARTS uses a simple derivation step: for each edge between nodes in the cell, you retain only the operation with the highest learned architecture weight (i.e., the strongest component from the softmax mixture). Typically, you also select the two strongest incoming edges for each node to maintain a fixed, sparse connectivity.

This results in a clean, standard neural network cell where every connection is a single, specific operation. This discrete cell is then stacked to form the final model, which is trained from scratch on the full dataset. It's important to understand that the super-network's weights are discarded after the search; they served only to inform the search for a good architecture. The final model's weights are initialized randomly and trained anew.

Efficiency Compared to Reinforcement Learning-Based NAS

The primary advantage of DARTS is its staggering improvement in search efficiency. Pre-DARTS, reinforcement learning (RL)-based NAS methods could require thousands of GPU days (e.g., 2000-3000 GPU days for NASNet). This is because each proposed architecture is a separate "training job" that must be built and trained to a reasonable accuracy to evaluate its potential.

In contrast, DARTS consolidates the entire search into the training of a single super-network. By using continuous relaxation and gradient-based optimization, it reduces the search cost to the order of 1-4 GPU days—an improvement of three orders of magnitude. This democratized NAS, making it accessible to researchers and practitioners without massive computational budgets. The trade-off is that DARTS makes strong assumptions about the continuity of the search space and can sometimes be memory-intensive during search due to maintaining the full super-network.

Common Pitfalls

  1. Misunderstanding the Search Product: A common mistake is thinking the super-network's weights are the final model. Remember, the search phase only produces the architecture (the blueprint). The final model with this architecture must be trained from scratch, often achieving higher accuracy than the super-network ever did.
  2. Overfitting in the Search Phase: Because architecture parameters are updated based on a validation set, it's possible for the search to overfit to that specific validation split. This is known as search overfitting, where the found architecture performs well on the search validation set but generalizes poorly to new data. Using a separate validation set for the final evaluation of the derived architecture is crucial.
  3. Ignoring Memory and Computational Limits of the Super-Net: The super-network contains all possible operations in memory simultaneously. For large search spaces, this can lead to significant GPU memory consumption during the search phase, which may limit the size of the models you can explore without techniques like gradient checkpointing or progressive search spaces.

Summary

  • DARTS introduces continuous relaxation to Neural Architecture Search by replacing hard operation choices with a softmax-weighted mixture, making the search process differentiable.
  • The search operates on an over-parameterized super-network within a defined search space (typically a cell-based DAG), optimizing two sets of parameters: network weights and architecture parameters .
  • Optimization uses a bi-level formulation: is optimized on training data, while is optimized based on validation loss to promote generalization.
  • The final architecture is derived by selecting the strongest operation for each edge based on the learned values, resulting in a discrete network that is then trained from scratch.
  • Compared to reinforcement learning-based NAS, DARTS achieves a dramatic efficiency gain, reducing search time from thousands to just a few GPU days, though it requires careful handling to avoid search overfitting.

Write better notes with AI

Mindli helps you capture, organize, and master any subject with AI-powered summaries and flashcards.