InstaNAS: Instance-aware Neural Architecture Search

11/26/2018 ∙ by An-Chieh Cheng, et al. ∙ 0

Neural Architecture Search (NAS) aims at finding one "single" architecture that achieves the best accuracy for a given task such as image recognition.In this paper, we study the instance-level variation,and demonstrate that instance-awareness is an important yet currently missing component of NAS. Based on this observation, we propose InstaNAS for searching toward instance-level architectures;the controller is trained to search and form a "distribution of architectures" instead of a single final architecture. Then during the inference phase, the controller selects an architecture from the distribution, tailored for each unseen image to achieve both high accuracy and short latency. The experimental results show that InstaNAS reduces the inference latency without compromising classification accuracy. On average, InstaNAS achieves 48.9 reduction on CIFAR-100 with respect to MobileNetV2 architecture.



There are no comments yet.


page 1

page 2

page 8

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Neural Architecture Search (NAS) aims at searching for the deep architectures that optimize learning objectives. The NAS framework is formulated by using an algorithm to search over a pre-defined space that contains sub-components of the model to find the best neural architecture that optimizes the task target (e.g

., image recognition). One popular way of implementing NAS is to leverage reinforcement learning, where the controller is an agent that takes actions by sampling the search space and gradually form a architecture. The performance of an architecture is evaluated on a target task and is used as the reward in reinforcement earning. Then the reward is used as a feedback so that the controller can update its policy to prioritize architectures that can achieve the highest reward. After the search process is done, a single architecture will be selected and trained to be the final solution of the task.


Figure 1: The concept of InstaNAS is to search for a distribution of architectures. The controller is responsible for selecting a corresponding child architecture for each given input image. Each child architecture within the final distribution may be an expert of specific domains or speedy inference. In contrast, a conventional NAS method only searches for a single architecture from the search space as the final result.

Neural Architecture Search usually optimizes exclusively for task-dependent metrics such as accuracy. Many recent papers propose device-aware neural architecture search algorithms that are capable of searching for architectures that fall into specific architecture-dependent metrics such as energy, power, or latency. Resource constrained multiple-objective architecture search has gained much traction. To name a few, [5; 8; 24; 30] aims at finding neural architectures that satisfy architecture-dependent metrics by achieving Pareto optimality over more than one objective.

Figure 2: The overview flow diagram of InstaNAS. Given task-dependent objectives (e.g., accuracy) and architecture-dependent objectives (e.g., latency) as reward, the controller is trained to optimize architecture for each input image.

A common characteristic of the models searched by classic NAS methods is that, a single model is usually used as the optimal architecture. In reality, however, using a single architecture might not be optimal for architecture-dependent metrics when samples of different patterns are present. The optimal architecture for individual samples might be different for metrics such as latency, which inspires us to develop InstaNAS, a NAS framework which converges to a distribution of architectures instead of a single one. Each architecture within the final distribution is an expert of one or multiple specific domains, such as different difficulty, texture, content style and speedy inference. For each new input image, the controller is trained to select a suitable architecture from its distribution. To the best of our knowledge, we are the first work toward building NAS with instance-awareness.

In Section 4, we take two-objective NAS as a case study and analyze the impact of InstaNAS. More specifically, we choose accuracy and latency as the targeting objectives, which are the two major model performance pointers in real-world applications. InstaNAS learns to automatically control the trade-offs between accuracy and inference speed by considering the low-level feature of each input image. In our experiments, we design a MobileNetV2 [21] based search space. InstaNAS brings significant trade-off frontier improvements to original MobileNetV2 in two different dimensions. In Section 4.3 and Section 4.5, our experiment observes 48.9% and 40.2% average latency reduction on CIFAR-10 and CIFAR-100 with comparable accuracy against MobileNetV2. Furthermore, if moderate accuracy drop is tolerable, InstaNAS can further achieve 82.6% and 50.0% average latency reduction on CIFAR-10 and CIFAR-100 against MobileNetV2.

We also introduce a dynamic reward function design inspired by curriculum learning. InstaNAS is trained with reinforcement learning which obtains rewards from a soft-constrained latency interval, in the meanwhile, the reward interval slowly decreases its upper bound through epochs. In Section 

4.4, we empirically observe the final policies through epochs forms a frontier which controls the trade-offs between accuracy and reward in different levels of balancing. The implementation will be released to public soon.

In conclusion, we summarize the main contributions of InstaNAS in following categories:

  • We propose InstaNAS , the first instance-aware neural architecture search framework.

  • Within a MobileNetV2 based search space, InstaNAS achieves 48.9% and 40.2% average latency reduction on CIFAR-10 and CIFAR-100 against MobileNetV2 with comparable accuracy.

  • We empirically observe the policies searched by InstaNAS through epochs forms a frontier, which controls different levels of trade-offs between objectives.

2 Related Work

Neural Architecture Search.

Neural Architecture Search (NAS) has emerged growing interest in the field of AutoML and meta-learning [26] in recent years. Seminal work by Zoph et al. [32] first proposed “Neural Architecture Search (NAS)” using reinforcement learning algorithm. They introduce a learnable RNN controller that generates a sequence of actions representing a child network within a predefined search space, while the validation performance is taken as the reward to train the controller. Since the process of NAS can also be framed as a natural selection problem, some works [19; 20; 29]

propose to use evolutionary approaches with genetic algorithms to optimize the architecture. However, all these works focus on optimizing model accuracy as their only objective. In real-world, these models may not be suitable for being deployed on certain (

e.g., latency-driven) applications, such as autonomous car.

Multi-objective Neural Architecture Search.

For better flexibility and usability in real-world applications, several works are dedicated to extending NAS into multiple-objective neural architecture search (MO-NAS), which attempts to optimize multiple objectives while searching for architectures. Elsken et al. [6] and Zhou et al. [31] use FLOPs and the number of parameters as the proxies of computational costs; Kim et al. [9] and Tan et al. [24] directly minimized the actual inference time; Dong et al. [5] proposed to consider both device-agnostic objectives (e.g., FLOPs) and device-related objectives (e.g., inference latency) using Pareto Optimization. However, all these aforementioned algorithms only consider searching for a single final architecture achieving the best average accuracy for the given task. In contrast, InstaNAS is a MO-NAS approach that searches for a distribution of architectures aiming to speed up the average inference time with instance-awareness.

One-shot Architecture Search.

Computational expensive is another fundamental challenge in NAS, conventional NAS algorithms require thousands of different child architectures to be trained from scratch and evaluated, which is often time costly. One shot architecture search is an approach using share-weight across child architectures to amortize the search cost. The concept of weight sharing has been widely adopted by different NAS approaches with various kinds of search strategies: with evolutionary algorithm 

[20; 19], reinforcement learning [18], gradient descent [14], and random search [1]. Instead of training each child architecture from scratch, they allow child architectures to share weights whenever possible. We also adopt the similar design principle of the one-shot model to not only accelerate InstaNAS but also to reduce the total number of parameters in InstaNAS . We will explain further detail of how we leverage the one-shot model in Section 3.2.

Conditional Computation.

Several conditional computation methods have been proposed to dynamically execute different modules of a model on a per-example basis [2; 12; 15; 25; 28; 27]. More specifically, Wu et al. [28] use policy network to generate a series of decision which selectively dropped a subset of blocks in a well-known baseline network (e.g., ResNet [7]) with respect to each input. However, all methods mentioned above assume their base model to be optimal across all samples, then perform their algorithm as post-processing method to further reduce computational costs. In contrast, InstaNAS is a neural architecture search framework with built-in instance awareness during architecture design and inference time decisions. InstaNAS is relatively a more flexible framework - covering but not limited to all possible solutions which can be provided by previous conditional computation frameworks.

3 Instance-aware Neural Architecture Search

InstaNAS consists of a one-shot model and a controller. We introduce the overall workflow and symbols of InstaNAS in Section 3.1. Then we describe how the one-shot model is constructed and trained in Section 3.2. Finally, we explain how to train and design the reward function of the controller in order to combine multiple objectives in Section 3.3.

3.1 Workflow overview

InstaNAS requires specifying two categories of objectives as search targets, task-dependent objective and architecture-dependent objective . The task-dependent objective is the main objective of the optimization target (e.g., the accuracy in a classification task). The architecture-dependent objective (e.g., latency and computational costs) can be seen as constraints which are taken into account when the task-dependent objective is secured.

The training phase consists of three stages, “Pre-training one-shot model”, “Joint training” and “Retraining one-shot model”. We first pre-train the one-shot model with . In the second stage, a controller is introduced to select architectures from the one-shot model with respect to each input instance . In this stage, the controller and the one-shot model are being trained alternatively, which enforces the one-shot model to adapt to the distribution change of the controller. Meanwhile, the controller is trained by policy gradient [23] with a reward function which is aware of both and . The detail of the controller training is described in Section 3.3. In the last stage, as each controller through all epochs is a valid search result with different levels of trade-offs between objectives, a suitable controller is hand-picked by empirical preference. Then the one-shot model is retrained from scratch with respect to the designated controller.

During inference phase, is applied to each unseen input instance . The generated is instance-aware and automatically controls the trade-offs between and . An important note is that since the controller is essential during inference, the final latency we reported has already included the latency introduced by the controller.

3.2 One-Shot model

A naive approach to constructing instance-awareness may be training multiple models, then introduce a controller model to assign each input instance to a corresponding down-stream model. However, this solution is not feasible in real-world, since its total number of parameters grows linearly against the number of down-stream models. To alleviate such problem, InstaNAS requires weight-sharing techniques to reduce the total number of parameters. For further sampling convenience, we choose to adopt the one-shot model described in [1], which is trained with weight sharing techniques. Furthermore, as any randomly sampled architecture within the one-shot model is a valid architecture with decent accuracy, the one-shot model is natively suitable for the controller to perform random exploration.

In the pre-training stage, the one-shot model is trained with only. This training process is essential since the controller training in the second stage has a complex reward function taking into account. A random initialized one-shot model provides incorrect and extremely sparse rewards, causing the controller hard to optimize.

Following [1]

, we design a large and expressive search space which allows us to represent a wide diversity of interesting candidate child architectures within a single model. We formulate each child model as a set of binary decisions, deciding whether each of the modules within the one-shot model is activated. In the controller training stage, we sample child architectures in the search space with Bernoulli distribution (

i.e., each decision of module is sampled with independent Bernoulli distribution), which zero-out large portions of modules in the one-shot model in order to evaluate specific child architectures. If directly train the one-shot model naively, the modules cannot smoothly co-adapt to the latter controller training stage. Even removing an inferior module from the one-shot model can cause the performance to break down. As a result, the one-shot model will provide incorrect reward which causes the controller hard to optimize. To tackle this problem, we apply drop-path [1; 33]

to each module. During training, each module are randomly zero out for each batch of input data. We achieve good results by setting the drop-path rate to 50% in the middle of pre-training. Note that among sub-modules with stride 2 or different input/output number of filters, to avoid errors, we ensure at least one module will be selected.

3.3 Controller

The controller takes each image instance as input and propose an architecture by . The design principle of the controller is to be fast and simple, which is a three-layer convolutional network with large kernels in our experiments. Its design should heavily consider efficiency since its latency is essentially included in the inference phase. Its structure can be simple since it only requires to capture the low-level representations of each input image. An empirical explanation is that the controller only needs to identify low-level features of the image (e.g., the overall color, texture complexity, and sample difficulty), then forward the image to the selected down-stream expert to make more accurate decisions. Some visualizations of how the controller categorize samples are shown in Figure 6.

The training process requires two important components, the exploration strategy, and the reward function. We also introduce an important policy random shuffling process to stabilize the InstaNAS joint training.

Exploration Strategy.

We formulate each architecture as a set of binary options of whether each convolutional kernel within the one-shot model is selected. The controller takes each input image and accordingly generates a probability matrix

for the binary options. We apply Bernoulli sampling to the probability matrix for exploration, which generally prefers high probability options, but still randomly pick or drop options with respect to the probability distribution proposed by the controller. We adopt the entropy loss mentioned in  

[17], which improves exploration by discouraging premature policy convergence. To further increase the diversity of sampling result, we adopt the encouragement parameter described in [28] which mutates the probability matrix by .

The controller is trained with policy gradient. Similar to which described in  [32], we introduce a self-critical baseline

to reduce the effect of high-variance of instance-wise reward

. The policy gradient is estimated by:


which is the parameters of the controller and each is sampled independently by a Bernoulli distribution with respect to .

Reward Function.

The controller is trained with policy gradient with a complex reward function combining and into account. The reward is computed instance-wise by:


, which and are obtained from and . The design of is based on the observation that the is generally more important and preferred than . As a result, is only taken into account when is secured. Otherwise, the controller is ensured to be fully-controlled by . For the cases which is positive, is still treated as a preference only. This is introduced by normalizing to the range , which becomes a discounting factor to and never provides negative penalties to the controller through policy gradient.

Another observation is that is generally hard to optimize and tends to collapse easily. The reason is that taking to be accuracy and to be latency as an example, architectures with both good latency and desirable accuracy at the same time are relatively rare. In the meanwhile, our “instance aware” setting observes reward in a “instance-wise” manner, finding architectures with extremely low latency for all samples is significantly easier than having generally high accuracy for any sample. Such pattern encourages the controller to generate shallow architectures and directly ignores accuracy. Eventually, the policy collapses to a single architecture with extremely low latency but poor accuracy similar to a random sampler.

Inspired by curriculum learning [3], we design a dynamic quadratic reward function for toward the policy collapsing problem. The quadratic function is built-up with an upper-bound and lower-bound , which is the number of epochs between range . Then with a observation , we calculate , which the gamma is a normalization factor that normalizes to the range by . The target of the controller is to maintain its expectation of near the center of the reward interval while still keeping aware of . The reward function is designed to be a quadratic function since making the highest rewarded child architectures to be in the center of the interval is more preferred. Otherwise, the child architectures may fall outside the reward interval easily during exploration or while the reward interval moves between epochs.

We first calculate the expectation of by considering the controller is a random sampler after random initialization. In the beginning, the boundary is set to and . Then the sliding window is slowly moved toward , which slowly enforce the controller to produce suitable architectures with respect to more and more difficult constraint for . The training process ends upon the training accuracy drops suddenly and significantly at some point, since the controller cannot find suitable policies anymore. All policies before this epoch are valid policies automatically control the trade-offs between and .

An important implementation detail is about the batch normalization. Since the feature map distribution changes intensely with respect to different architecture choices, the batch normalization should always set to training mode while evaluating validation accuracy for the reward function. Otherwise, each of the sampled architectures will produce unstable accuracy, eventually leads to total failure of the controller training.

Policy Random Shuffling.

An important implementation detail for joint training stage is that the fine-tuning stage is essential. As the policy of controller changes dramatically, the fine-tuning aims to guide the one-shot model to fit to current trend in policy, such as drop path rate during sampling and path preference. However, such fine-tuning process harms the one-shot accuracy, since each child architecture is trained with highly-biased samples. This phenomenon discards the one-shot characteristic of the one-shot model, the randomly sampled child architectures cannot guarantee stable accuracy anymore, which causes the policy collapses to single policy or simply total failure. To avoid aforementioned problem, we introduce random shuffling, which randomly pairs a policy to a sample within the batch during fine-tuning. This process keeps the particular child architecture from memorizing a subset of samples, but still directly craft the drop path rate and path preference into the one-shot model. We empirically observe that if without random shuffling, the search process will fail easily at very beginning.

4 Experiments

In this section, we explain and analyze the building blocks of InstaNAS. We start by demonstrating some quantitative results of InstaNAS against other models. Then we visualize and discuss some empirical insights of InstaNAS. Throughout the experiments, we use the same search space described in Section 4.1. We specify our main task to be image classification, though InstaNAS is expected to work for most vision tasks if given sufficient computation power. For the search objectives, we choose accuracy as our task-dependent objective and latency as the architecture-dependent objective, which are the most influential factors of architecture choice in real-world applications.

4.1 Search Space

Figure 3: The five module options in each cell of InstaNAS.

We validate InstaNAS in a search space similar to [24], using MobileNetV2 as the backbone network. Our search space consists of a stack of 17 cells and each cell has five module choices as shown in Figure 3. Specifically, we allow one basic convolution (BasicConv) and four mobile inverted bottleneck convolution (MBConv) layers with various kernel sizes {3, 5} and filter expansion ratios {3, 6} as choices in the cell, which equals to possible combinations. Different from [5; 33], we do not restrict all cells to share the same combination of architectures. Therefore, across the entire search space, there are approximately child architecture configurations. Note that for cells that consist of stride two convolutions or different numbers of input/output filter size, at least one module has to be selected (Module (a) in default).

4.2 Module Latency Profiling

Figure 4: The comparison between the accumulated latency and real latency of each one-shot child architecture under two different input resolutions. We sample 10,000 child architectures from the search space and bucketize the data points into 300 discrete bins. The result suggests a strong positive correlation between the accumulated latencies and the real latencies.

In the instance-aware setting, evaluating the latency reward is a challenging task as each input instance is possibly assigned to different child architectures. However, measuring the latency individually for each child architecture is considerably time costly during training.

Therefore, to accelerate training, we evaluate the latency reward with estimated values. Specifically, we build up module-wise look-up tables with pre-measured latency consumption of each module. For each sampled child architecture, we look up the table of each module and accumulate the layer-wise measurements to estimate the network-wise latency consumption. Figure 4 compares the estimated latency (the sum of module-wise latency from the module-wise look-up tables) and the real latency on a workstation with Intel Core i5-7600 CPU. The result shows real and estimated latency numbers are highly correlated: the overall correlation coefficient is 0.788 and 0.823 for input resolution 32, 64, respectively. This error rate is considerably small, which shows that our estimated value is a good approximation for real latency.

4.3 Experiments on CIFAR-10

Model Err. (%) Latency # Arc.
ResNet50[7] 6.38 0.051 0.003 -
ResNet101[7] 6.25 0.095 0.002 -
MobileNetV 0.4x [21] 7.44 0.038 0.003 -
MobileNetV 1.0x [21] 5.56 0.092 0.002 -
MobileNetV 1.4x [21] 4.92 0.129 0.002 -
ShuffleNetV 0.5x [16] 10.2 0.017 0.001 -
ShuffleNetV 1.0x [16] 7.40 0.035 0.001 -
ShuffleNetV 1.5x [16] 6.36 0.052 0.002 -
ShuffleNetV 2.0x [16] 6.18 0.074 0.008 -
IGCV-D 1.0x [22] 5.54 0.185 0.003 -
IGCV-D 0.5x [22] 5.27 0.095 0.006 -
NasNet- [33] 3.41 0.219 0.006 1
PnasNet- [13] 4.01 0.087 0.002 1
DARTS [14] 2.83 0.236 0.004 1
DPP-Net- [5] 5.84 0.062 0.004 1
MnasNet 0.5x [24] 7.08 0.056 0.006 1
MnasNet 0.7x [24] 6.62 0.076 0.002 1
MnasNet 1.0x [24] 5.88 0.108 0.002 1
InstaNAS-C10- 4.30 0.085 0.006 47
InstaNAS-C10- 4.50 0.055 0.002 15
InstaNAS-C10- 5.20 0.047 0.002 14
InstaNAS-C10- 6.00 0.033 0.001 8
InstaNAS-C10- 8.10 0.016 0.006 17
Table 1: Model performance comparison on CIFAR-10 [11]. InstaNAS shows competitive latency and accuracy trade-off against other state-of-the-art human-designed models (first row) and NAS-found models (second row). All five InstaNAS models are all obtained within a single search, and the controller latency is already included in the reported latency. Note that we measure the model’s error rates with our implementation if it is not reported in the original paper (e.g., [16; 21; 24]). 222

For fair comparison, all CPU latencies are measured in the same computing environment and the same framework (PyTorch v0.4.0).

We validate InstaNAS on CIFAR-10 with the search space described in the previous section. Across all training stages, we apply random copping, random horizontal flipping, and cut-out [4]

as data augmentation methods. For pre-training the one-shot model, we use Stochastic Gradient Descent (SGD) optimizer with naive momentum instead of Nesterov momentum. We set the weight decay as 0.0001 and the momentum as 0.9. The initial learning rate is 0.1, then reduce by a factor 10 at the 200, 300 and 350 training epochs. Each training batch consists of 32 images on a single GPU. Note that larger batch size is preferred if with sufficient memory capacity and computing power.

For the joint training stage, the controller and the one-shot model are trained alternatively for 100 epochs. We set the reward

to 30 if the sampled child architecture classifies the corresponding image correctly, otherwise,

is set to 0. The upper-bound starts from , and linearly reduced to half of the MobileNetV2 average latency. The controller is trained with Adam [10] optimizer, learning rate , and learning rate decays by at the 50th epoch and the 75th epoch individually. The one-shot model is fine-tuned with SGD, learning rate , and without momentum.

Model Err. (%) Latency # Arch.
MnasNet 0.5x [24] 30.58 0.055 ± 0.002 1
MnasNet 0.7x [24] 28.06 0.076 ± 0.002 1
MnasNet 1.0x [24] 27.06 0.108 ± 0.005 1
ShuffleNetV 0.5x [16] 34.64 0.016 ± 0.001 -
ShuffleNetV 1.0x [16] 30.60 0.035 ± 0.001 -
ShuffleNetV 1.5x [16] 28.30 0.052 ± 0.004 -
ShuffleNetV 2.0x [16] 28.88 0.072 ± 0.005 -
MobileNetV 0.4x [21] 30.72 0.049 ± 0.068 -
MobileNetV 1.0x [21] 27.00 0.092 ± 0.002 -
MobileNetV 1.4x [21] 25.66 0.129 ± 0.007 -
InstaNAS-C100- 24.20 0.089 ± 0.003 11
InstaNAS-C100- 24.40 0.086 ± 0.006 13
InstaNAS-C100- 24.90 0.065 ± 0.003 9
InstaNAS-C100- 26.60 0.055 ± 0.004 71
InstaNAS-C100- 27.80 0.046 ± 0.004 58
Table 2: Model performance comparison on CIFAR-100.

After the joint training ends, some controllers are picked by human preference by considering the accuracy and latency trade-off. At this point, the accuracy measured in the joint training stage can only consider as a reference value, the one-shot model needs to re-train from scratch with respect to the picked policy. We retrain each one-shot model with respect to each picked controller for 200 epochs. We use Adam optimizer and set learning rate to 0.001, then decays the learning rate by at the and the epoch.

Table 1 shows the quantitative comparison with state-of-the-art efficient classification models and NAS-found architectures. The result suggests InstaNAS is prone to find good trade-off frontier relative to both human-designed and NAS-found architectures. In comparison to MobileNetV2 (), which the search space is referenced to, InstaNAS-C10- improves accuracy by 1.26% without latency trade-off; InstaNAS-C10- reduces 48.9% average latency with comparable accuracy, and InstaNAS-C10- reduces 82.6% latency with moderate accuracy drop. Note that these three variances of InstaNAS are all obtained within a single search, then re-train from scratch individually.

To validate the stability of InstaNas, we evaluate our approach on a more fine-grained dataset, CIFAR-100. We ran the experiment using directly the same set of hyperparameters configuration from the CIFAR-10 experiment. As shown in Table 

2, the average latency consistently shows reduction - with 40.2% comparing to MobileNetV2 , 36.1% comparing to ShuffleNetV2 , and 49.1% comparing to MnasNet . We plot the trade-off frontier of InstaNAS in Figure 5. InstaNAS stably shows overall improvement in the trade-off frontier against competitive state-of-the-art models.

Figure 5: Performance trade-off frontier of InstaNAS on CIFAR-100. Other hand-crafted SOTA architectures (e.g., MobileNetV2 [21], ShuffleNetV2 [16]) and NAS-found architectures (e.g., MnasNet [24]) in different model size are also included for comparison.

Figure 6: We visualize instances that share the same architecture. The controller seems to discriminate a input instance base on its low-level characteristic, such as the background color, brightness, contrast, or object position. The results prove our hypothesis that the controller is instance-aware and is therefore, capable of selecting a corresponding down-stream expert architecture to perform more precise classification. We also provide all testing set results.444More examples with complete testing set results are provided anonymously in: Each folder corresponds to a unique child architecture selected by the controller.

4.4 Trade-Off Frontier Through Time

InstaNAS shows an interesting characteristic that each controller in different epoch controls different levels of trade-offs between objectives. Such characteristic is a by-product of two major algorithm designs. First, the design of dynamic reward function reduces its upper-bound through time, whose target aims to increase the task difficulty steadily. Second, as we design the complementary reward function to be a quadratic function, the most rewarded child architectures are mostly encouraged to be concentrated in the middle of the reward interval. These two designs cause the controller aims to optimize against different latency preference. As the reward interval becomes lower and thinner in the late epochs, the controller starts to fail to find architectures with high accuracy and low latency at the same time. As a result, the controller starts to partially compromise accuracy to meet the latency reward center. And this behavior makes the controller in different epochs shows different levels of trade-offs between objectives.

As shown in Figure 5, the four points of InstaNAS are four different controllers selected in different epochs within the same run of InstaNAS . The four models form a frontier shape in the figure, which indicates the trade-offs between the two objectives is formed. Such characteristic may be interesting as it can create multiple choices for human to empirically select suitable result states with different use cases or preferences. Note that, similarly, the five models from InstaNAS-C10- to InstaNAS-C10- in Table 1 are all obtained in the same search.

4.5 Qualitative Results

Figure 6 visualizes the testing set samples grouped by the assignment—images in the same group are assigned to the same architecture by the controller for making inferences. Each selected child architecture from the final distribution serves as an expert in a specific domain, such as different difficulty, texture, content style and speedy inference. The results agree with human perception, and confirm the hypothesis that the controller learns to discriminate each instance based on its low-level characteristic for the best assignment of the corresponding expert architecture.

5 Conclusion and Future Works

In this paper, we propose InstaNAS, the first instance-aware neural architecture search framework. InstaNAS exploits instance-level variation to search for a distribution of architectures; during the inference phase, for each new image InstaNAS selects one corresponding architecture that best classifies the image while using less computational resource for shorter latency. The experimental results confirm that better accuracy/latency trade-off is achieved on both CIFAR-10 (57.8% latency reduction) and CIFAR-100 (46.6% latency reduction) dataset comparing to MobileNetV2. Qualitative results further show that the proposed controller learns to capture the low-level characteristic (e.g., different difficulty, texture, content style and speedy inference) of the input image, which agrees with human perception.

There are many possible directions for future work, including downsizing the total number of parameters of InstaNAS . Although only a portion of modules is activated for each inference, considering system stableness, the full InstaNAS model still needs to be loaded into the memory. Although this may not be an issue for some latency-oriented scenarios with an adequate amount of memory (e.g., visual recognition on self-driving car and cloud service), this problem still becomes a drawback for InstaNAS to be deployed on edge devices or chips. How to further reduce the total parameters of InstaNAS is an important next step. Another potential solution for such problem may be restricting the controller from switching policies for some special applications that have relatively similar environment through time (e.g., surveillance camera, on-board camera, and drone).


We are grateful to the National Center for High-performance Computing for computer time and facilities, and Google Research, MediaTek, MOST 107-2634-F007-007 for their support. This research is also supported in part by the Ministry of Science and Technology of Taiwan (MOST 107-2633-E-002-001), MOST Joint Research Center for AI Technology and All Vista Healthcare, National Taiwan University, Intel Corporation, and Delta Electronics. We would like to thank Jin-Dong Dong and Wei-Chung Liao for their helpful comments and discussions.


  • Bender et al. [2018] Bender, Gabriel, Kindermans, Pieter-Jan, Zoph, Barret, Vasudevan, Vijay, and Le, Quoc. Understanding and simplifying one-shot architecture search. In

    International Conference on Machine Learning

    , pp. 549–558, 2018.
  • Bengio et al. [2015] Bengio, Emmanuel, Bacon, Pierre-Luc, Pineau, Joelle, and Precup, Doina. Conditional computation in neural networks for faster models. arXiv preprint arXiv:1511.06297, 2015.
  • Bengio et al. [2009] Bengio, Yoshua, Louradour, Jérôme, Collobert, Ronan, and Weston, Jason. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009.
  • DeVries & Taylor [2017] DeVries, Terrance and Taylor, Graham W. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
  • Dong et al. [2018] Dong, Jin-Dong, Cheng, An-Chieh, Juan, Da-Cheng, Wei, Wei, and Sun, Min. Dpp-net: Device-aware progressive search for pareto-optimal neural architectures. In Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part XI, pp. 540–555, 2018.
  • Elsken et al. [2018] Elsken, Thomas, Metzen, Jan Hendrik, and Hutter, Frank. Multi-objective architecture search for cnns. arXiv preprint arXiv:1804.09081, 2018.
  • He et al. [2016] He, Kaiming, Zhang, Xiangyu, Ren, Shaoqing, and Sun, Jian. Deep residual learning for image recognition. In

    Proceedings of the IEEE conference on computer vision and pattern recognition

    , pp. 770–778, 2016.
  • Hsu et al. [2018] Hsu, Chi-Hung, Chang, Shu-Huan, Juan, Da-Cheng, Pan, Jia-Yu, Chen, Yu-Ting, Wei, Wei, and Chang, Shih-Chieh. Monas: Multi-objective neural architecture search using reinforcement learning. arXiv preprint arXiv:1806.10332, 2018.
  • Kim et al. [2017] Kim, Ye-Hoon, Reddy, Bhargava, Yun, Sojung, and Seo, Chanwon.

    Nemo: Neuro-evolution with multiobjective optimization of deep neural network for speed and accuracy.

    ICML, 2017.
  • Kingma & Ba [2014] Kingma, Diederik P and Ba, Jimmy. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
  • Krizhevsky & Hinton [2009] Krizhevsky, Alex and Hinton, Geoffrey. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
  • Kuen et al. [2018] Kuen, Jason, Kong, Xiangfei, Lin, Zhe, Wang, Gang, Yin, Jianxiong, See, Simon, and Tan, Yap-Peng. Stochastic downsampling for cost-adjustable inference and improved regularization in convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7929–7938, 2018.
  • Liu et al. [2018a] Liu, Chenxi, Zoph, Barret, Shlens, Jonathon, Hua, Wei, Li, Li-Jia, Fei-Fei, Li, Yuille, Alan, Huang, Jonathan, and Murphy, Kevin. Progressive neural architecture search. In Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part I, pp. 19–35, 2018a.
  • Liu et al. [2018b] Liu, Hanxiao, Simonyan, Karen, and Yang, Yiming. Darts: Differentiable architecture search. arXiv preprint arXiv:1806.09055, 2018b.
  • Liu & Deng [2017] Liu, Lanlan and Deng, Jia. Dynamic deep neural networks: Optimizing accuracy-efficiency trade-offs by selective execution. In

    Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018

    , 2017.
  • Ma et al. [2018] Ma, Ningning, Zhang, Xiangyu, Zheng, Hai-Tao, and Sun, Jian. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part XIV, pp. 122–138, 2018.
  • Mnih et al. [2016] Mnih, Volodymyr, Badia, Adria Puigdomenech, Mirza, Mehdi, Graves, Alex, Lillicrap, Timothy, Harley, Tim, Silver, David, and Kavukcuoglu, Koray. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pp. 1928–1937, 2016.
  • Pham et al. [2018] Pham, Hieu, Guan, Melody Y, Zoph, Barret, Le, Quoc V, and Dean, Jeff. Efficient neural architecture search via parameter sharing. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmässan, Stockholm, Sweden, July 10-15, 2018, pp. 4092–4101, 2018.
  • Real et al. [2017] Real, Esteban, Moore, Sherry, Selle, Andrew, Saxena, Saurabh, Suematsu, Yutaka Leon, Tan, Jie, Le, Quoc, and Kurakin, Alex. Large-scale evolution of image classifiers. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pp. 2902–2911, 2017.
  • Real et al. [2018] Real, Esteban, Aggarwal, Alok, Huang, Yanping, and Le, Quoc V. Regularized evolution for image classifier architecture search. arXiv preprint arXiv:1802.01548, 2018.
  • Sandler et al. [2018] Sandler, Mark, Howard, Andrew, Zhu, Menglong, Zhmoginov, Andrey, and Chen, Liang-Chieh. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520, 2018.
  • Sun et al. [2018] Sun, Ke, Li, Mingjie, Liu, Dong, and Wang, Jingdong. Igcv3: Interleaved low-rank group convolutions for efficient deep neural networks. In British Machine Vision Conference 2018, BMVC 2018, Northumbria University, Newcastle, UK, September 3-6, 2018, pp. 101, 2018.
  • Sutton et al. [2000] Sutton, Richard S, McAllester, David A, Singh, Satinder P, and Mansour, Yishay. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems, pp. 1057–1063, 2000.
  • Tan et al. [2018] Tan, Mingxing, Chen, Bo, Pang, Ruoming, Vasudevan, Vijay, and Le, Quoc V. Mnasnet: Platform-aware neural architecture search for mobile. arXiv preprint arXiv:1807.11626, 2018.
  • Teja Mullapudi et al. [2018] Teja Mullapudi, Ravi, Mark, William R, Shazeer, Noam, and Fatahalian, Kayvon. Hydranets: Specialized dynamic architectures for efficient inference. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8080–8089, 2018.
  • Vilalta & Drissi [2002] Vilalta, Ricardo and Drissi, Youssef. A perspective view and survey of meta-learning. Artificial Intelligence Review, 18(2):77–95, 2002.
  • Véniat & Denoyer [2018] Véniat, Tom and Denoyer, Ludovic. Learning time/memory-efficient deep architectures with budgeted super networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
  • Wu et al. [2018] Wu, Zuxuan, Nagarajan, Tushar, Kumar, Abhishek, Rennie, Steven, Davis, Larry S, Grauman, Kristen, and Feris, Rogerio. Blockdrop: Dynamic inference paths in residual networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8817–8826, 2018.
  • Xie & Yuille [2017] Xie, Lingxi and Yuille, Alan L. Genetic cnn. In ICCV, pp. 1388–1397, 2017.
  • Yang et al. [2018] Yang, Tien-Ju, Howard, Andrew, Chen, Bo, Zhang, Xiao, Go, Alec, Sandler, Mark, Sze, Vivienne, and Adam, Hartwig. Netadapt: Platform-aware neural network adaptation for mobile applications. In Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part X, pp. 289–304, 2018.
  • Zhou et al. [2018] Zhou, Yanqi, Ebrahimi, Siavash, Arık, Sercan Ö, Yu, Haonan, Liu, Hairong, and Diamos, Greg. Resource-efficient neural architect. arXiv preprint arXiv:1806.07912, 2018.
  • Zoph & Le [2017] Zoph, Barret and Le, Quoc V. Neural architecture search with reinforcement learning. 2017.
  • Zoph et al. [2018] Zoph, Barret, Vasudevan, Vijay, Shlens, Jonathon, and Le, Quoc V. Learning transferable architectures for scalable image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.