NAS
Neural Architecture Search
A technique for automatically searching neural network architectures. A core technology of AutoML.
Neural Architecture Search
A technique for automatically searching neural network architectures. A core technology of AutoML.
NAS (Neural Architecture Search) is an AutoML technique that automatically searches for and optimizes the structure of deep learning models. An algorithm automatically discovers neural network architectures that human researchers used to design manually, finding a network structure optimized for a specific task.
It began to attract serious attention after a paper published by the Google Brain team in 2017. Initially, the enormous computational cost, requiring thousands of GPU-days, was a problem, but it became practical as efficient search methods such as DARTS and ENAS were developed.
NAS consists of three core elements: Search Space, Search Strategy, and Performance Estimation. A variety of search strategies are used, including reinforcement learning, evolutionary algorithms, and gradient-based methods.
In practice, NAS is used to design lightweight models for mobile/edge devices and to develop models optimized for specific domains. Well-known models such as EfficientNet and MobileNetV3 were discovered through NAS, and there are many cases that achieved 10-30% performance improvements over manual design.
# NNI (Neural Network Intelligence)를 사용한 NAS 예제
# pip install nni
import nni
from nni.nas.evaluator import FunctionalEvaluator
from nni.nas.strategy import DARTS
# 탐색 공간 정의
import torch.nn as nn
from nni.nas.nn.pytorch import ModelSpace, LayerChoice
class NASModel(ModelSpace):
def __init__(self):
super().__init__()
# 레이어 선택지 정의
self.conv = LayerChoice([
nn.Conv2d(3, 64, 3, padding=1),
nn.Conv2d(3, 64, 5, padding=2),
nn.Conv2d(3, 64, 7, padding=3),
], label='conv_choice')
self.activation = LayerChoice([
nn.ReLU(),
nn.GELU(),
nn.SiLU(),
], label='act_choice')
self.classifier = nn.Linear(64 * 32 * 32, 10)
def forward(self, x):
x = self.conv(x)
x = self.activation(x)
x = x.view(x.size(0), -1)
return self.classifier(x)
# DARTS 전략으로 탐색 실행
model_space = NASModel()
strategy = DARTS()
# 평가자 정의
def evaluate_model(model):
# 모델 학습 및 검증 로직
accuracy = train_and_validate(model)
return accuracy
evaluator = FunctionalEvaluator(evaluate_model)
# 탐색 시작
# experiment = strategy.run(model_space, evaluator)
print("NAS 탐색 공간이 정의되었습니다.")
"We need to make the model lightweight for mobile deployment. How about applying NAS to search for an architecture with an optimized latency-accuracy trade-off? Models found through NAS, like EfficientNet-lite, are often more than 20% more efficient than manually designed ones."
"NAS consists of three elements: search space, search strategy, and performance estimation. Early NAS required thousands of GPU-days, but the cost has dropped significantly thanks to differentiable approaches like DARTS and weight sharing. In fact, MobileNetV3, EfficientNet, and others were discovered through NAS."
"Full NAS is expensive, so it would be a good strategy to use efficient methods like Once-for-All or ProxylessNAS, or to fine-tune an already-searched architecture (the EfficientNet family)."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
If the search space is poorly designed, good architectures may not be included in it to begin with. Search space design determines 80% of NAS performance.
Even when efficient methods are used, NAS still requires a lot of computation. Test first with a proxy task on a small dataset.
Validate the search space at a small scale, use an already-validated NAS result (such as EfficientNet) as a baseline, and then apply fine-grained NAS if needed.