SNAS: STOCHASTIC NEURAL ARCHITECTURE SEARCH
A BSTRACT
We propose Stochastic Neural Architecture Search (SNAS), an economical endto-end solution to Neural Architecture Search (NAS) that trains neural opera tion parameters and architecture distribution parameters in same round of back propagation
, while maintaining the completeness and differentiability of the NAS pipeline
In this work,
NAS is reformulated as an optimization problem on parameters of a joint distribution for the search space in a cell.
To leverage the gradient information in generic differentiable loss for architecture search, a novel search gradient is proposed.
We prove that this search gradient optimizes the same objective as reinforcement learning
-based NAS but assigns credits to structural decisions more efﬁciently
This credit assignment is further augmented with locally decomposable reward to enforce a resource-efﬁcient constraint.
In experiments on
CIFAR-
, SNAS takes fewer epochs to ﬁnd a cell architecture with state-of-the- art accuracy than non
-differentiable evolution-based and reinforcement-learningbased
NAS which is also transferable to
ImageNet
It is also shown that child networks of SNAS can maintain the validation accuracy in searching, with which attention
-based
NAS requires parameter retraining to compete, exhibiting potentials to stride towards efﬁcient NAS on big datasets
I NTRODUCTION
The trend to seek for state-of-the-art neural network architecture automatically has been growing since Zoph & Le (2016), given the enormous effort needed in scientiﬁc research.
Normally, a
Neural Architecture Search (NAS) pipeline comprises architecture sampling, parameter learning, architecture validation, credit assignment and search direction update.
There are basically three existing frameworks for neural architecture search.
Evolution-based NAS like NEAT (Stanley & Miikkulainen, 2002) employs evolution algorithm to simultaneously optimize topology alongside with parameters.
However, it takes enormous computational power and could not leverage the efﬁcient gradient back-propagation in deep learning.
To achieve the state-of-the-art performance as human-designed architectures, Real et al.
(2018) takes 3150 GPU days for the whole evolution.
Reinforcement-learning-based NAS is end-to-end for gradient back-propagation, among which the most efﬁcient one, ENAS (Pham et al., 2018)
learns optimal parameters and architectures together just like NEAT.
However, as NAS is modeled as a Markov Decision Process, credits are assigned to structural decisions with temporal-difference (TD) learning (Sutton et al., 1998), whose efﬁciency and interpretability suffer from delayed rewards (Arjona-Medina et al., 2018).
To get rid of the architecture sampling process, DARTS (Liu et al., 2019) proposes deterministic attention on operations to analytically calculate expectation at each layer.
After the convergence of the parent network, it removes operations with relatively weak attention.
Due to the pervasive non-linearity in neural operations, it introduces untractable bias to the loss function.
This bias causes inconsistency between the performance of derived child networks and converged parent networks, thus parameter retraining comes up as necessary.
A more efﬁcient, more interpretable and less biased framework is in desire, especially for future full-ﬂedged NAS solutions on large datasets.
In this work, we propose a novel, efﬁcient and highly automated framework, Stochastic Neural
Architecture Search (SNAS), that trains neural operation parameters and architecture distribution parameters in same round of back propagation, while maintaining the completeness and differentiability of the NAS pipeline.
One of the key motivations of SNAS is to replace the feedback mechanism triggered by constant rewards in reinforcement-learning-based NAS with more efﬁcient gradient feedback from generic loss .
We reformulate NAS with a new stochastic modeling to bypass the MDP assumption in reinforcement learning.
To combine architecture sampling with computational graph of arbitrary differentiable loss, the search space is represented with a set of one-hot random variables from a fully factorizable joint distribution, multiplied as a mask to select operations in the graph.
Sampling from this search space is made differentiable by relaxing the architecture distribution with concrete distribution (Maddison et al., 2016).
We name gradients w.r.t their parameters search gradient .
From a global view, we prove that SNAS optimizes the same objective as reinforcement-learning-based NAS, except the training loss is used as reward.
Zooming in, we provide a policy gradient equivalent of this search gradient , showing how gradients from the loss of each sample are used to assign credits to structural decisions.
By interpreting this credit assignment as Taylor Decomposition (Montavon et al., 2017a), we prove SNAS’s efﬁciency over reinforcementlearning-based NAS.
Additionally, seeing that existing methods (Liu et al., 2019) manually design topology in child networks to avoid complex architecture, we propose a global resource constraint to automate it, augmenting the objective with feasiblity concerns.
This global constraint could be linearly decomposed for structural decisions, hence the proof of SNAS’s efﬁciency still applies.
In our experiments, SNAS shows strong performance compared with DARTS and all other existing NAS methods in terms of test error, model complexity and searching resources.
Speciﬁcally,
SNAS discovers novel convolutional cells achieving 2.85 ± 0.02% test error on CIFAR-10 with only 2.8M parameters, which is better than 3.00 ± 0.14%-3.
M from 1st-order DARTS and 2.89%-4.6M from ENAS.
It is also on par with 2.76 ± 0.09%-3.
M from 2nd-order DARTS with fewer parameters.
With a more aggressive resource constraint, SNAS discovers even smaller model achieving 3.10 ± 0.04% test error on CIFAR-10 with 2.3M parameters.
During the architecture search process,
SNAS obtains a validation accuracy of 88% compared to around 70% of ENAS in fewer epochs.
When validating the derived child network on CIFAR-10 without ﬁnetuning, SNAS maintains the search validation accuracy, signiﬁcantly outperforming 54.66% by DARTS.
These results validate our theory that SNAS is less biased than DARTS.
The discovered cell achieves 27.3% top-1 error when transferred to ImageNet (mobile setting), which is comparable to 26.9% by 2nd-order DARTS.
[ℒ] (0, 1) (0, 2) (0, 3) (1, 2) (1, 3) (2, 3) (0, 1) (0, 2) (0, 3) (1, 2) (1, 3) (2, 3) % & 0 % ' % ( % & 0 % ' % ( )*+(- (&) ) . . .
[Figure] [Figure]
M ETHODOLOGY
The main initiative of SNAS is to build an efﬁcient and economical end-to-end learning system with as little compromise of the NAS pipeline as possible.
In this section, we ﬁrst describe how to sample from the search space for NAS in a cell, and how it motivates a stochastic reformuation for SNAS (Section 2.1).
A new optimization objective is provided and the attention-based NAS’s inconsistency is discussed.
Then in Section 2.2, we introduce how this discrete search space is relaxed to be continuous to let gradients back-propagate through.
In Section 2.3, the search gradient of SNAS is connected to the policy gradient in reinforcement-learning-based NAS (Zoph & Le, 2016; Pham et al., 2018), interpreting SNAS’s credit assignment with contribution analysis.
At last, we introduce in Section 2.4 how SNAS automates the topology search to reduce the complexity of child netowrk, as well as how it decomposes this global constraint in the context of credit assignment.
2. S EARCH S PACE AND A RCHITECTURE S AMPLING
Searching for structure of a cell that is later stacked as building blocks for a deep architecture is an ad hoc solution to trade-off search efﬁciency and result optimality (Zoph et al., 2017;
Liu et al., 2017a; Real et al., 2018; Pham et al., 2018; Liu et al., 2019).
As shown in the left of Figure 1, the search space, i.e. a cell, is represented using a directed acyclic graph (DAG), which is called parent graph .
Nodes x i in this DAG represent latent representation, whose dimensions are simply ignored to avoid abuse of notations.
In convolutional networks, they are feature maps.
Edges ( i, j ) represent information ﬂows and possible operations
O i,j to be selected between two nodes x i and x j .
To make the skip operation included, nodes are enforced to be ordered, while edges only point from lower indexed nodes to higher ones.
Thus we have intermediate nodes
[Equation]
where ˜ O i,j is the selected operation at edge ( i, j ) .
Analog to ENAS, SNAS search for operations and topology of this cell at the same time.
Rather than using two distributions, this is done by introducing a zero operation, as in DARTS.
Same as ENAS and DARTS, each cell is designed to have two inputs from the output of previous cells.
The output of a cell is the concatenate of intermediate nodes.
Thanks to the fact that the volume of structural decisions, which pick ˜ O i,j for edge ( i, j ) , is generally tractable in a cell, we represent it with a distribution p ( Z ) .
Multiplying each one-hot random variable Z i,j to each edge ( i, j ) in the DAG, we obtain a child graph , whose intermediate nodes are
[Equation]
In terms of how to parameterize and factorize p ( Z ) , SNAS is built upon the observation that NAS is a task with fully delayed rewards in a deterministic environment .
That is, the feedback signal is only ready after the whole episode is done and all state transition distributions are delta functions.
Therefore, a Markov Decision Process assumption as in ENAS may not be necessary.
In SNAS, we simply assume that p ( Z ) is fully factorizable, whose factors are parameterized with α and learnt along with operation parameters θ .
In Appendix A we connect the probability of a trajectory in the
MDP of ENAS and this joint probability p ( Z ) .
Following the setting in Zoph & Le (2016), the objective of SNAS is also
[Equation]
While the difference is that rather than using a constant reward from validation accuracy, we use the training/testing loss directly as reward, R ( Z )
=
L θ ( Z ) , such that the operation parameters and architecture parameters can be trained under one generic loss:
[Equation]
The whole process of obtaining a Monte Carlo estimate of this objective is shown in Figure 1.
An intuitive interpretation of this objective is to optimize the expected performance of architectures sampled with p ( Z ) .
This differentiates SNAS from attention-based NAS like DARTS, which avoids the sampling process by taking analytical expectation at each edge over all operations.
In Appendix
B we illustrate the inconsistency between DARTS’s loss and this objective, explaining its necessity of parameter ﬁnetuning or even retraining after architecture derivation.
Resembling ENAS, SNAS does not have this constraint.
We introduce in next subsection how SNAS calculates gradients w.r.t θ and α .
2. P ARAMETER L EARNING FOR O PERATIONS AND A RCHITECTURES
Though the objective (4) could be optimized with black-box gradient descent method as in Ranganath et al.
(2014), it would suffer from the high variance of likelihood ratio trick (Williams, 1992) and could not make use of the differentiable nature of L θ ( Z ) .
Instead, we use concrete distribution (Maddison et al., 2016) here to relax the discrete architecture distribution to be continuous and differentiable with reparameterization trick:
[Equation]
where Z i,j is the softened one-hot random variable for operation selection at edge ( i, j ) , G ki,j = − log( − log( U ki,j )) is the k th Gumbel random variable, U ki,j is a uniform random variable.
α i,j is the architecture parameter, which could depend on predecessors Z h,i if p ( Z i,j ) is a conditional probability.
λ is the temperature of the softmax, which is steadily annealed to be close to zero in SNAS.
In Maddison et al.
(2016), it is proved that p (lim λ → 0 Z ki
[Equation]
j = 1) =
α ki,j / ( (cid:80) nl =
α li,j ) , making this relaxation unbiased once converged.
The full derivation of ∇ E Z ∼ p
α
( Z )
[ L θ ( Z )] is given in Appendix C. Here with the surrogate loss L for each sample, we provide its gradient w.r.t x j , θ ki,j and α ki,j :
[Equation]
We name ∂ L ∂ α search gradient similar to the one in Wierstra et al.
(2008), even though no policy gradient is involved.
This renders SNAS a differentiable version of evolutionary-strategy-based
NAS.
2. C REDIT A SSIGNMENT
With the equivalence of p ( Z ) in SNAS and p ( τ ) in ENAS from Section 2.1 and the search gradient of SNAS from Section 2.2, we discuss in this subsection what credits SNAS search gradients assign to each structural decision.
To assign credits to actions both temporally and laterally is an important topic in reinforcement learning (Precup, 2000; Schulman et al., 2015; Tucker et al., 2018; Xu et al., 2018).
In ENAS, proximal policy optimization (PPO) (Schulman et al., 2017) is used to optimize the architecture policy, which distributes credits with TD learning and generalized advantage estimator (GAE) (Schulman et al., 2015).
However, as the reward of NAS task is only obtainable after the architecture is ﬁnalized and the network is tested for accuracy, it is a task with delayed rewards .
As proved by Arjona-Medina et al.
(2018), TD learning has bias with reward delay and corrects it exponentially slowly .
Different from ENAS, there is no MDP assumption in SNAS, but the reward function is made differentiable in terms of structural decisions.
From Section 2.2 we can derive the expected search gradient for architecture parameters at edge ( i, j ) :
[Equation]
(7) where [ · ] c emphasizes · is constant for the gradient calculation w.r.t.
α .
A full derivation is provided in Appendix D.
Apparently, the search gradient is equivalent to a policy gradient for distribution at this edge whose credit is assigned as
[Equation]
From a decision-wise perspective, this reward could be interpreted as contribution analysis of L with Taylor Decomposition (Montavon et al., 2017a), which distributes importance scores among nodes in the same effective layer.
Given the presence of skip connections, nodes may be involved into multiple effective layers, credits from which would be integrated.
This integrated credit of a node j is then distributed to edges ( i, j ) pointing to it, weighted by ˜
O i,j ( x i ) .
Details are given in
Appendix E. Thus for each structural decision, no delayed reward exists, the credits assigned to it are valid from the beginning .
This proves why SNAS is more efﬁcient than ENAS.
Laterally at each edge, credits are distributed among possible operations, adjusted with random variables
Z i,j .
At the beginning of the training, Z i,j is continuous and operations share the credit, the training is mainly on neural operation parameters.
With the temperature goes down and Z i,j becomes closer to one-hot, credits are given to the chosen operations, adjusting their probabilities to be sampled.
2. R ESOURCE C ONSTRAINT
Apart from training efﬁciency and validation accuracy, forwarding time of the child network is another concern in NAS in order for its feasible employment.
In SNAS, this could be taken into account as a regularizer in the objective:
[Equation] [Equation]
where C ( Z ) is the cost of time for the child network associated with random variables Z .
Rather than directly estimating the forwarding time, there are three candidates from the literature (Gordon et al., 2018; Ma et al., 2018) that can be used to approximately represent it: 1) the parameter size ; 2) the number of ﬂoat-point operations (FLOPs); and 3) the memory access cost (MAC).
Details about C ( Z ) in SNAS could be found in Appendix F.
However, not like L θ ( Z ) , C ( Z ) is not differentiable w.r.t.
either θ or α .
A natural problem to ask is, whether efﬁcient credit assignment from C ( Z ) could be done with similar decomposition introduced above, such that the proof of SNAS’s efﬁciency still applies.
And the answer is positive, thanks to the fact that C ( Z ) is linear in terms of all one-hot random variables
Z i,j :
[Equation]
mainly because the size of feature maps at each node is not dependent on the structural decision.
That is, the distribution at each edge ( i, j ) is optimized with local penalty, which is the conservative decomposition of the global cost, consistent with the credit assignment principle in SNAS.
In SNAS, p α ( Z ) is fully factorizable, making it possible to calculate E Z ∼ p
α [ C ( Z )] analytically with sum-product algorithm (Kschischang et al., 2001).
Unfortunately, this expectation is non-trivial to calculate, we optimize the Monte Carlo estimate of the ﬁnal form from sum-product algorithm
[Equation]
with policy gradients.
E XPERIMENTS
Following the pipeline in DARTS, our experiments consist of three stages.
First, SNAS is applied to search for convolutional cells in a small parent network on CIFAR-10 and we choose the best cells based on their search validation accuracy.
Then, a larger network is constructed by stacking the learned cells ( child graphs ) and is retrained on CIFAR-10 to compare the performance of SNAS with other state-of-the-art methods.
Finally, we show that the cells learned on CIFAR-10 is transferable to large datasets by evaluating their performance on ImageNet.
3. A RCHITECTURE S EARCH ON CIFAR-
Motivation We apply SNAS to ﬁnd convolutional cells on CIFAR-10 for image classiﬁcation.
Unlike DARTS, which evaluates the performance of child networks during the searching stage by training their snapshots from scratch, we directly take the search validation accuracy as the performance evaluation criterion.
This evaluation method is valid in SNAS since the searching is unbiased from its objective, as introduced in Section 2.1.
[Figure]
Dataset CIFAR-10 dataset (Krizhevsky & Hinton, 2009) is a basic dataset for image classiﬁcation, which consists of 50,000 training images and 10,000 testing images.
Data transformation is achieved by the standard data pre-processing and augmentation techniques (see Appendix G.1).
Search Space
Our setup follows DARTS, where convolutional cells ( parent graphs ) of 7 nodes are stacked for multiple times to form a network.
The input nodes, i.e. the ﬁrst and second nodes, of cell k are set equal to the outputs of cell k − 2 and cell k − 1 , respectively, with 1 × 1 convolutions inserted as necessary, and the output node is the depthwise concatenation of all the intermediate nodes.
Reduction cells are located at the 1/3 and 2/3 of the total depth of the network to reduce the spatial resolution of feature maps.
Therefore the architecture distribution parameters is ( α normal , α reduce ), where α normal is shared by all the normal cells and α reduce is shared by all the reduction cells.
Details about all operations included are shown in Appendix G.1.
Training Settings In the searching stage, we train a small network stacked by 8 cells ( parent graphs ) using SNAS with three levels of resource constraint for 150 epochs.
This network size is determined to ﬁt into a single GPU.
Single-level optimization is employed to optimize θ and α over the same dataset as opposed to bilevel optimization employed by DARTS.
The rest of the setup follows DARTS (Appendix G.1).
The search takes 32 hours 1 on a single GPU 2 .
Searching Process
The normal and reduction cells learned on CIFAR-10 using SNAS with mild resource constraint are shown in Figure 2.
In Figure 3, we give the validation accuracy during the search of SNAS, DARTS and ENAS with 10 Randomly Generated Seeds.
Comparing with ENAS,
SNAS takes fewer epochs to converge to higher validation accuracy.
Though DARTS converges faster than SNAS, this accuracy is inconsistent with the child network.
Table 1 presents their comparison of the validation accuracy at the end of search and after architecture derivation without ﬁne-tuning.
While SNAS can maintain its performance, there is a huge gap between those two in
DARTS.
[Table]
Normal cell
Reduction cell
Overall
DARTS
SNAS 0.
[Figure]
Normal cell
Reduction cell
Overall
DARTS
SNAS 0.
Normal cell
Reduction cell
Overall
DARTS
SNAS 0.
Normal cell
Reduction cell
Overall
DARTS
SNAS 1.
[Figure]
This gap is caused by the extra architecture derivation step in DARTS, consisting of the following two steps.
(1) Remove operations with relatively weak attention.
As shown in Figure 4, the entropy of the architecture distribution (softmax) at each edge, i.e. H p α , is relatively high in DARTS, indicating its uncertainty in structural decisions.
Hence removing other operations from the continuous relaxation will strongly affect the output of the network.
(2) Remove relatively ambiguous edges.
DARTS manually selects two inputs for each intermediate nodes, thus the topology is inconsistent with that in the training stage.
While SNAS employs architecture sampling and resource regularizer to automatically induce sparsity.
Phenomena shown in Figure 4 and Table 1 verify our claim that searching process in SNAS is less biased from the objective, i.e. Equation (4), and could possibly save computation resources for parameter retraining when extended to NAS on large datasets.
Searching Results Three levels of resource constraint, mild, moderate and aggressive are examined in SNAS.
Mild resource constraint lies at the margin of the appearance of zero operation to drop edges in child graphs , as shown in Figure 2.
Interestingly, every node takes only two input edges, just as in the designed scheme in ENAS and DARTS.
When the constraint level is increased to moderate, the reduction cell begins to discover similar structures as normal cells, as shown in
Appendix H. When a more aggressive resource constraint is added, the structure of reduction cells is further sparsiﬁed.
As shown in Figure 5, more edges are dropped, leaving only two, which leads to the drop of some nodes, including the input node c k − 1 , and two intermediate nodes x 2 and x 3 .
Note that this child graph is a structure that ENAS and DARTS are not able to discover 4 .
[Figure]
In the code from Liu
3. A RCHITECTURE E VALUATION ON CIFAR-
Motivation In the searching stage, we follow the economical setup of DARTS to use only one single GPU, which constrains the parameter size of the child network.
A conventional assumption in DARTS and ENAS 5 is that the ﬁnal search validation accuracy has exploited the parameter size, the ceiling of which can only be raised by allowing more parameters.
For a fair comparison, we follow this assumption in evaluation stage, stacking more cells ( child graphs ) to build a deeper network.
This network is trained from scratch as in DARTS and ENAS to report the performance of the cells learned by SNAS on CIFAR-
[Table]
Evaluation Settings A large network of 20 cells is trained from scratch for 600 epochs with batch size 96.
Other hyperparameters remain the same as those for architecture search.
Additional enhancements are listed in Appendix G.2.
The training takes 1.5 days on a single GPU with our implementation in PyTorch
[Table] [Table]
Results
The CIFAR-10 evaluation results are presented in Table 2.
The test error of SNAS is on par with the state-of-the-art RL-based and evolution-based NAS while using three orders of magnitude less computation resources.
Furthermore, with slightly longer wall-clock-time, SNAS outperforms 1st-order DARTS and ENAS by discovering convolutional cells with both a smaller error rate and fewer parameters.
It also achieves a comparable error rate compared to 2nd-order DARTS but with fewer parameters.
With a more aggressive resource constraint, SNAS can sparsify the architecture even further to distinguish from ENAS and DARTS with only a slight drop in performance, which is still on par with 1st-order DARTS.
It is interesting to note that with same single-level optimization,
SNAS signiﬁcantly outperforms DARTS.
Bilevel optimization could be regarded as a data-driven meta-learning method to resolve the bias proved above, whose bias from the exact meta-learning objective is still unjustiﬁed due to the ignorance of separate child network derivation scheme.
3. A RCHITECTURE T RANSFERABILITY E VALUATION ON I MAGE N ET
Motivation Since real world applications often involve much larger datasets than CIFAR-10, transferability is a crucial criterion to evaluate the potential of the learned cells ( child graphs ) (Zoph et al., 2017).
To show whether the cells learned on by SNAS CIFAR-10 can be generalized to larger datasets, we apply the same cells evaluated in Section 3.2 to the classiﬁcation task on ImageNet.
Dataset The mobile setting is adopted where the size of the input images is 224 × 224 and the number of multiply-add operations in the model is restricted to be less than 600M.
[Table]
Evaluation Settings We stack a network of 14 cells using the same cells designed by SNAS (mild constraint) and evaluated on CIFAR-10 (Section 3.2) and train it for 250 epochs with other hyperparameters following DARTS (see Appendix G.3).
The training takes 12 days on a single GPU.
Results Table 3 presents the results of the evaluation on ImageNet and shows that the cell found by SNAS on CIFAR-10 can be successfully transferred to ImageNet.
Notably, SNAS is able to achieve competitive test error with the state-of-the-art RL-based NAS using three orders of magnitude less computation resources.
And with resource constraints added, SNAS can ﬁnd smaller cell architectures that achieve competitive performance with DARTS.
R ELATED WORKS
Improving the efﬁciency of NAS is a prerequisite to extending it to more complicated vision tasks like detection, as well as larger datasets.
In the complete pipeline of NAS, parameter learning is a time-consuming one that attracts attention from the literature.
Ideas to design auxiliary mechanisms like performance prediction (Baker et al., 2017; Deng et al., 2017), iterative search (Liu et al., 2017a), hypernetwork generated weights (Brock et al., 2017) successfully accelerate NAS to certain degrees.
Getting rid of these auxiliary mechanisms, ENAS (Pham et al., 2018) is the state-of-the-art
NAS framework, proposing parameter sharing among all possible child graphs , which is followed by SNAS.
In Section 2 we introduced SNAS’s relation with ENAS in details.
Apart from ENAS, we are also inspired by Louizos et al.
(2017) to use continuous distribution for structural decision at each edge and optimize it along with an l 0 complexity regularizer.
The most important motivation of SNAS is to leverage the gradient information in generic differentiable loss to update architecture distribution, which is shared by DARTS (Liu et al., 2019).
In Section 2 and Appendix B we have introduced SNAS’s advantage over DARTS, a reward for maintaining the completeness of the NAS pipeline.
Actually, the idea to make use of this gradient information to improve the learning efﬁciency of a stochastic model has been discussed in the literature of generative model (Gu et al., 2015; Maddison et al., 2016) and reinforcement learning (Schmidhuber, 1990; Arjona-Medina et al., 2018).
But as far as we known, we are the ﬁrst one to combine the insights from these two ﬁelds to discuss possible efﬁciency improvement of NAS.
C ONCLUSION
In this work, we presented SNAS, a novel and economical end-to-end neural architecture search framework.
The key contribution of SNAS is that by making use of gradient information from generic differentiable loss without sacriﬁcing the completeness of NAS pipeline, stochastic architecture search could be more efﬁcient.
This improvement is proved by comparing the credit assigned by the search gradient with reinforcement-learning-based NAS.
Augmented by a complexity regu- larizer, this search gradient trades off testing error and forwarding time.
Experiments showed that
SNAS searches well on CIFAR-10, whose result could be transferred to ImageNet as well.
As a more efﬁcient and less-biased framework, SNAS will serve as a possible candidate for full-ﬂedged
NAS on large datasets in the future.
A CONNECTING p ( Z ) IN SNAS AND p ( τ ) IN ENAS
In ENAS, the NAS task is deﬁned as an MDP, where the observation o i = a 0 , a 1 ...a i − 1 .
Thus the transition probability
[Equation]
With the policy of RNN controller denoted as π ( a i | o i ) , the joint probability of a trajectory τ in this
MDP is
[Equation]
where a is a vector of all structural decisions, which is denoted as Z in SNAS.
So we have p ( τ ) =
p ( Z ) .
[Equation]
Note that if we factorize p ( Z ) with conditional probability to have Markovian property as in Equation 13, we have the factor
[Equation]
B DIFFERENCE BETWEEN SNAS AND DARTS
We take a search space with three intermediate nodes for example to exhibit the difference between
SNAS and DARTS (Liu et al., 2019), as shown in Figure 6.
This search space could be viewed as a unit search space whose property could be generalized to larger space since it contains nodes in series and in parallel.
The objective of a NAS task is
[Equation]
(16) where p α ( Z ) is the distribution of architectures, which is previously solved with reinforcement learning.
In both SNAS and DARTS, the reward function is made differentiable using the training/testing loss, R ( Z ) =
L θ ( ( Z )) , such that the architecture learning could leverage information in the gradients of this loss and conduct together with operation parameters training:
[Equation]
As introduced in Appendix A, SNAS solves (16) with a novel type of factorization, without relying on the MDP assumption.
Though independent assumption between edges would restrict the probability distribution, there is no bias introduced.
However, to avoid the sampling process and gradient back-propagation through discrete random variables, DARTS takes analytical expectation at the input of each node over operations at incoming edges and optimizes a relaxed loss with deterministic gradients.
Take the cell in Figure 6 as a base case, the objective before this relaxation is
[Equation]
DARTS relaxed this objective to
[Equation]
Considering that O ( x ) are ReLU-Conv-BN stacks as in ENAS (Pham et al., 2018), which are nonlinear, this transformation introduces unbounded bias.
Though it will not be perceivable in training, where the complete graph is used for accuracy validation, consistent this loss, the derived graph is never validated during training.
Hence the training is inconsistent with the true objective maximizing the expected performance of derived architectures .
After an architecture derivation introduced in
DARTS, the performance falls enormously and the parameters
C GRADIENTS IN SNAS
Figure 6(b) gives an illustration of a base three-intermediate-node unit in SNAS, where each edge has three operations (indexed by k ) to choose from.
In the search space of SNAS, intermediate nodes take input from all previous nodes.
We have
[Equation]
Let θ ki,j be the parameters in O ki,j , we have
[Equation]
As we use concrete disctribution here to make the sampling differentiable with reparametrization trick:
[Equation]
where G ki,j = − log( − log( U ki,j )) is the k th Gumbel random variable, U ki,j is a uniform random variable, the gradient w.r.t.
α i,j is:
[Equation]
[Equation]
The partial derivative ∂f α i,j ∂ α ki,j is
[Equation]
Substitute it back to (23), we obtain
[Equation]
We can also derive ∂x m ∂x j for chain rule connection:
[Equation]
[Equation]
Thus the gradient from the surrogate loss L to x j , θ ki,j and α ki,j respectively are
[Equation]
D CREDIT ASSIGNMENT FOR EQUIVALENT POLICY GRADIENT
From Appendix C we can see that the expected search gradient for architecture parameters at each edge is:
[Equation] [Equation]
where [ · ] c denotes · is a constant for the gradient calculation w.r
E TAYLOR DECOMPOSITION FOR CONTRIBUTION ANALYSIS
With d neurons (pixels) x i in the same layer of a deep neural network, whose output is f ( x ) , Montavon et al.
(2017a) decomposes f ( x ) as a sum of individual credits for x i .
This decomposition is obtained by the ﬁrst-order Taylor expansion of the function at some root point ˜ x for which f (˜ x ) = 0 :
[Equation]
) where the individual credits
[Equation]
30) are ﬁrst-order terms and O ( xx T ) is for higher-order information.
When ReLU is chosen as the activation function, O ( xx T ) can be omitted (Montavon et al., 2017b).
Thus ones can always ﬁnd a root point ˜ x
= lim (cid:15) → 0 (cid:15) x
that incidentally lies on the same linear region as point x , in which case the function can be written as
[Equation]
Noticing the similarity between (8) and (31), we try using Taylor Decomposition to interpret the credit assignment in SNAS.
Given a sample x 0 , ones can iterate all effective layers of the DAG and distribute credits from network output f among nodes x j in each layer.
In Figure 1 for example,
DAG ( Z (1) ) has 2 effective layers, while DAG ( Z (2) ) has 3 effective layers.
Given the presence of the skip connection, nodes may be involved into multiple layers and thus obtain integrated credits
[Equation]
e.g. x 1 in DAG(2) integrates credits from x 2 and x 3 .
According to (1), multiple edges ( i, j ) are pointing to j , which decompose (32) as:
[Equation]
Adjusting the weight of this sample with ∂ L /∂f and taking the optimization direction into account, we have
[Equation]
[Equation]
F CANDIDATES FOR LOCAL RESOURCE CONSTRAINTS
In the case of a convolutional layer, H , W and f , k correspond to the output spatial dimensions and the ﬁlter dimensions respectively and we use I , O to denote the number of input and output channels.
Since group convolution is also adopted in this paper to reduce the computational complexity, g is the number of groups.
Thus, the parameter size and the number of ﬂoat-point operations (FLOPs) of a single convolutional layer is
[Equation] [Equation]
By assuming the computing device has enough cache to store the feature maps and the parameters, we can simplify the memory access cost (MAC) to be the sum of the memory access for the input/output feature maps and kernel weights (Ma et al., 2018).
[Equation]
In SNAS, because all the operations on a single edge share the same output spatial dimensions and the input/output channels, FLOPs of a convolutional operation is directly proportional to its parameter size.
And although the memory access cost for the input/output feature maps HW ( I + O ) does not depend on the parameter size, since both are positively correlated to the number of layers used in the operation, we may say there is a positive correlation between MAC and the parameter size.
Thus, when only considering the convolution operations, solely using the parameter size as the resource constraint is sufﬁcient.
However, in SNAS, we also have the pooling operation and the skip connection, which are parameter free.
The equations to calculate the resource criteria of a pooling operation or a skip connection are as follows.
FLOPs of pooling:
[Equation]
FLOPs of skip connection:
[Equation]
MAC of pooling and skip connection:
[Equation]
We can see that MAC is the same for pooling and skip connection since they need to access the same input/output feature maps, therefore, to distinguish between pooling and skip connection, FLOPs need to be included in the resource constraint.
Similarly, to distinguish between skip connection and none (free, no operation), MAC also need to be included.
In conclusion, to construct a resource constraint which fully distinguishes the four types of operations, all three locally decomposable criteria, the parameter size, FLOPs and MAC, need to be combined.
G DETAILED SETTINGS OF EXPERIMENTS G. ARCHITECTURE SEARCH ON CIFAR-
Data Pre-processing and Augmentation Techniques
We employ the following techniques in our experiments: centrally padding the training images to 40 × 40 and then randomly cropping them back to 32 × 32 ; randomly ﬂipping the training images horizontally; normalizing the training and validation images by subtracting the channel mean and dividing by the channel standard deviation.
Implementation Details of Operations
The operations include: 3 × 3 and 5 × 5 separable convolutions, 3 × 3 and 5 × 5 dilated separable convolutions, 3 × 3 max pooling, 3 × 3 average pooling, skip connection and zero operation.
All operations are of stride one (excluded the ones adjacent to the input nodes in the reduction cell, which are of stride two) and the convolved feature maps are padded to preserve their spatial resolution.
Convolutions are applied in the order of ReLU-ConvBN, and the depthwise separable convolution is always applied twice (Zoph et al., 2017; Real et al., 2018; Liu et al., 2017a; 2019).
Detailed Training Settings We follow the training settings as in Liu et al.
The neural operation parameters θ are optimized using momentum SGD, with initial learning rate η θ = 0 .(annealed down to zero following a cosine schedule), momentum 0.9, and weight decay 3 × 10 − 4 .
The architecture distribution parameters α are optimized by Adam, with initial learning rate η α = 3 × 10 − 4 , momentum β = (0 . 5 , 0 . 999) and weight decay 10 − 3 .
The batch size employed is 64 and the initial number of channels is 16.
G. ARCHITECTURE EVALUATION ON CIFAR-
Additional Enhancement Techniques
Following existing works (Zoph et al.,
; Liu et al., 2017a; Pham et al., 2018; Real et al., 2018; Liu et al., 2019), we employ the following additional enhancements: cutout (DeVries & Taylor, 2017), path dropout of probability 0.2 (same as DARTS in the code publicly released by its authors) and auxiliary towers with weight 0.4.
G. ARCHITECTURE TRANSFERABILITY EVALUATION ON CIFAR-
Detailed Training Settings
The network is trained with batch size 128, weight decay 3 × 10 −and initial SGD learning rate 0.1, which is decayed by a factor of 0.97 after each epoch.
Auxiliary towers with weight 0.4 are adopted as additional enhancements
[Figure]
H CELLS LEARNED BY SNAS WITH A MODERATE RESOURCE CONSTRAINT
[Figure]