Neural Architecture Search 논문 리뷰

김상현·2022년 1월 25일
1

논문 제목: Neural Architecture Search with Reinforcement Learning

Introduction

사진 1. Overview of Neural Architecture Search

딥러닝 network들이 많은 성공을 이뤘지만, 딥러닝 achitecture들을 고안할 때 여전히 많은 전문 지식과 충분한 시간이 필요하다. 본 논문에서는 좋은 archtiectures를 찾기 위한 gradient-based 방식의 Neural Architecture Search(NAS)를 제공한다.

본 연구는 neural network의 structure와 connectivity를 가변 길이의 문자열로 명시할 수 있다는 관찰을 기반으로 한다. 따라서 recurrent network인 controller를 사용해서 이와 같은 문자열을 생성한다. 문자열에 따라 생성된 child network는 실제 데이터에서 학습되고, validation set에 대한 accuracy를 출력한다. 해당 출력을 reward로 사용하여 controller를 update하기 위한 policy gradient를 계산할 수 있다. 이 과정을 반복하여 controller는 향상된 구조를 생성할 수 있게 학습된다.

실험을 통해 NAS에 의해 고안된 새로운 ConvNet이 대부분의 사람에 의해 고안된 네트워크들 보다 좋은 성능을 보여줬다. 또한 NAS를 통해 새로운 recurrent cell을 고안했으며, 이는 기존의 RNN과 LSTM보다 성능이 좋았다.


Methods

1. Generate Model Descriptions with a Controller Recurrent Neural Network

사진 2

NAS에서 neural network의 architectural hyperparameters들을 생성하기 위해 controller를 사용한다. Controller는 RNN으로 구현된다. 사진 2와 같이 convolution layer들로만 구성된 feedforward nueral network를 예측하는 것을 가정하면, controller를 사용해서 token들의 sequence인 hyperparameters를 생성한다.

실험에서 architecture를 생성하는 과정은 layer들의 수가 특정 값을 초과하면 멈춘다. Controller가 architecture를 생성하면 neural network가 생성되고 학습된다. 제안된 network가 수렴하면 validation accuracy를 기록한다. Validation accuracy의 기대값이 최대화 되도록 controller의 parameter인 θc\theta_c가 최적화된다.

2. Training with Reinforce

Controller가 예측하는 token들의 list는 child network를 고안하기 위한 action들 a1:Ta_{1:T}의 list로 여길 수 있다. Child network가 수렴할 때, validation data에서 accuracy RR를 달성한다. R을 reward signal로 사용하고 강화학습을 이용해서 controller를 학습한다. Reward의 기대값을 최대화하도록 controller를 학습시키며 reward의 기대값 J(θc)J(\theta_c)는 다음과 같다.

J(θc)=EP(a1:T;θc)[R]J(\theta_c) = E_{P(a_{1:T};\theta_c)}[R]

RR은 미분 불가능하기 때문에 policy gradient 방법을 사용해서 반복적으로 θc\theta_c를 업데이트 한다.

θcJ(θc)=t=1TEP(a1:T;θc)[θclogP(ata(t1):1;θc)Rk]\nabla_{\theta_c}J(\theta_c) = \sum^{T}_{t=1}E_{P(a_{1:T};\theta_c)}[\nabla_{\theta_c} logP(a_t|a_{(t-1):1};\theta_c)R_k]

이를 empirical approximation 하면 다음과 같다.

1mk=1mt=1TθclogP(ata(t1):1;θc)Rk\frac{1}{m}\sum^m_{k=1} \sum^T_{t=1} \nabla_{\theta_c} logP(a_t | a_{(t-1):1};\theta_c)R_k

mm: the number of different architectures that the controller samples in one batch
TT: the number of hyperparameters our controller has to predict
RkR_k: the validation accuracy that the k-th neural network architecture

위의 수식은 unbiased estimate이지만, 매우 높은 분산을 갖는다. 따라서 estimate의 분산을 줄이기 위해 baseline function bb를 적용한다.

1mk=1mt=1TθclogP(ata(t1):1;θc)(Rkb)\frac{1}{m}\sum^m_{k=1} \sum^T_{t=1} \nabla_{\theta_c} logP(a_t | a_{(t-1):1};\theta_c)(R_k - b)

Baseline function bb가 현재 action에 의존(depend)하지 않는 한, 위의 수식은 여전히 unbiased estimate가 된다. 본 논문에서는 baseline bb를 이전 구조의 accuracies의 지수 이동 평균으로 했다.

Accelerate Training with Parallelism and Asynchronous Updates

사진 3

Child network를 학습시키는데 수 시간이 걸리기 때문에 분산 학습과 비동기(asynchronous) parameter 업데이트를 통해 controller의 학습 과정을 가속화 한다. Parameter-server 체계를 사용해서 사진 3과 같이 K개의 controller 복제들의 공유된 parameters를 저장하고 있는 S개의 parameter server를 갖고 있는다.

각각의 controller 복제는 병렬 학습되는 m개의 다른 child network를 샘플링 한다. Controller는 child network 학습에 따른 gradient를 수집하고 이를 parameter server로 보내서 모든 controller 복제들 전역의 가중치(weights)를 업데이트 한다. 본 연구에서 child network 각각의 수렴은 특정 수의 epoch을 초과한 때로 정했다.

3. Increase Architecture Complexity with Skip Connections and Other Layer Types

사진 4

Skip connection과 branching layers와 같은 구조를 controller가 예측하게 하기 위해서 본 논문에서는 attention mechanism을 기반으로 한 set-selection type attention을 사용한다. Layer NN에 이전 layer와 연결을 확인하기 위해 N1N-1 content-based sigmoids를 갖는 anchor point를 추가한다. 수식은 다음과 같다.

P(Layer j is an input to layer i)=sigmoid(vTtanh(Wprevhj+Wcurrhi))P(Layer\ j\ is\ an\ input\ to\ layer\ i) = sigmoid(v^T tanh(W_{prev} * h_j + W_{curr} * h_i))

hjh_j: the hiddenstate of the controller at anchor point for j-th layer
jj: ranges fromo 00 to N1N-1

이와 같은 연결들은 확률 분포로 정의되기 때문에 강화학습 방법을 여전히 사용할 수 있다.

본 논문에서 만약 하나의 layer가 많은 input layer들을 갖는다면, 모든 input layer들은 depth 차원으로 concatenate 된다. Skip connection은 하나의 layer가 다른 layer와 양립할 수 없거나 하나의 layer가 input 또는 output이 없는 경우 "compilation failures"를 야기할 수 있다. 이러한 문제를 완화하기 위해서 논문은 저자들은 다음 3가지 간단한 기술을 적용했다. 첫째, 만약 하나의 layer가 어떠한 input layer와도 연결되지 않은 경우 image를 input layer로 사용한다. 둘째, 최종 layer에서 이전에 연결되지 않은 모든 layer의 output들을 사용하고, 마지막 hiddenstate로 보내기 전에 concatenate 한다. 셋째, 만약 input layer들이 다른 크기들로 concatenate 되어야 한다면, padding을 사용해서 크기를 맞춰준다.

본 연구에서는 learning rate 예측을 하지 않고, convolutional layer들로 구성된 구조만을 가정했다. 하지만 추가적으로 learning rate를 예측하거나, pooling 및 normalization layer를 포함하는 구조를 예측할 수도 있다.

4. Generate Reccurent Cell Architectures

위의 방법을 수정하여 recurrent cell을 생성할 수 있다. 모든 time step tt에서 controller는 xtx_tht1h_{t-1}을 입력으로 사용해서 hth_t를 출력하는 함수를 찾아야 한다. 가장 간단한 방법은 ht=tanh(W1xt+W2ht1)h_t = tanh(W_1 * x_t + W_2 * h_{t-1})로 기본 recurrent cell의 공식이다.

사진 5

기본 RNN과 LSTM cell의 연산들은 xtx_tht1h_{t-1}를 입력으로 하고 hth_t를 최종으로 출력하는 step들의 tree 구조로 일반화할 수 있다. Controller RNN은 두 개의 입력을 합치고 하나의 출력을 생산하기 위해 tree의 각 노드를 combination method(addition, elementwise multiplication, etc.)와 activation function(tanh, sigmoid, etc.)로 라벨링 해야 한다. 이러한 method와 function을 controller RNN이 선택할 수 있게 node들에 순서를 정해서 각각의 node에 순차적으로 방문하게 한다.

LSTM cell 구조에서 영감을 받아 memory state를 나타낸드 cell variable들 ct1c_{t-1}ctc_t를 사용한다. Cell variable들에 대한 예측은 controller RNN의 마지막 두 블락에서 수행된다.

사진 5에 나온 예시의 과정은 논문에 상세히 설명되어 있다.


Experiments and Results

표 1

표 2

표1 과 표2를 통해 각각 이미지 처리와 자연어 처리에서 NAS를 통해 고안된 neural network와 recurrent cell이 기존의 방법들의 성능과 유사하거나 앞서는 것을 확인할 수 있다.


Conclusion

본 논문에서는 Neural Architecture Search를 도입했다. Network 구조를 생성하는 controller가 recurrent network를 사용하므로 가변 길이의 architecture space search에 flexible하다. 또한 실험을 통해 강력한 실증적 성능을 보여줬다.


References

Neural Architecture Search 논문

profile
Mucha Suerte

0개의 댓글