iMTE

Meta-Learning 3. Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks 본문

Deep learning study/Meta-Learning

Meta-Learning 3. Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks

Wonju Seo 2019. 4. 30. 22:51

Paper : Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks

Download : https://dl.acm.org/citation.cfm?id=3305498

워낙 중요하고 의미있는 내용들이 있으니, 직접 논문을 다운받아 읽어보는 것을 '적극' 추천한다!


Abstract

이 논문은 model-agnostic (독립적인) meta-learning을 위한 algorithm을 제안하는데, 이는 Gradient descent로 훈련되는 classification, regression, reinforcement learning을 포함하는 다양한 학습 문제에 적용가능한 모델과 호환된다. Meta-learning이 목표는 적은 수의 training sample을 사용하여 다양하고 새로운 learning task를 해결하는 것이다. 논문의 접근에서, model의 parameters는 new task의 적은 training data로 적은 수의 gradient descent 단계가 해당 task에서 좋은 generalization performance를 생성하도록 명시적으로 학습된다. 논문의 방법은 model을 fine-tuning하기 쉽도록 학습시킨다. 본 논문에서는 이 접근 방식을 사용해서 두개의 few-shot image classification benchmark에서 state-of-the-art 성능을 끌어내고, few-shot regression에서 좋은 결과를, neural network policies를 통한 policy gradient reinforcement learning의 fine-tuning을 가속화 함을 보여준다.


Introduction

학습은 적은 수의 examples으로 부터 물체를 인지하거나 단 몇 분만의 경험으로 새로운 기술을 빠르게 습득하는 것과 관련된 인간 지능의 특징이다. 우리의 artificial agents는 적은 example로 빠르게 학습하고 적용하고 많은 data에 계속적으로 적용이 될 수 있어야한다. 하지만, 이는 매우 어려운데 이는 agent가 새로운 data에 대해서 over-fitting을 피하면서, prior experience와 적은 수의 새로운 정보를 결합해야만 하기 때문이다. 더 나아가, prior experience와 새로운 데이터의 형태가 task에 의존한다. 훌륭한 적용성을 위해서 learning to learn 구조는 task에서 일반적이게 되어야하며, task를 마무리하기 위해 필요한 계산의 형태이어야 한다.

"In this work, we propose a meta-learning algorithm that is general and model-agnostic, in the sense that it can be directly applied to any learning problem and model that is trained with a gradient descent procedure."

Meta-learning에서 학습된 모델의 목표는 적은 양의 새로운 데이터로 부터 새로운 task를 빠르게 학습하는 것이고, 그 모델은 많은 다른 tasks에 학습이 되도록 meta-learner에 의해 학습하는 것이다.

이 논문의 방법에 깔려있는 주요 아이디어는 새로운 task로 부터의 적은 양의 데이터로 부터 계산되는 적은 양의 gradient step을 통해서 parameters가 update 된 이후에 model이 이 새로운 task에 최대 성능을 낼 수 있는 model의 initial parameters를 학습시키는 것이다. ("The key idea underlying our method is to train the model's initial parameters such that the model has maximal performance on a new task after the parameters have been updated through one or more gradient steps computed with a small amount of data from the new task.")

"The process of training a model's parameters such that a few gradient steps, or even a single gradient step, can produce good results on a new task can be viewed from a feature learning standpoint as building an internal representation that is broadly suitable for many tasks."

만약 많은 tasks에 대해서 internal representation이 적합하다면, 간단하게 parameters를 fine-tuning하는 것은 좋은 결과를 만들어낸다. 

이 논문의 주요 기여는

1) 새로운 task에 fast learning을 이끌 수 있는 적은 수의 gradients update와 같은 model parameters를 update하는 meta-learning 에 대한 간단하고 model and task-agnostic algorithm을 제안한다. 저자는 different model type (fully-connected, convolutional networks), several distinct domains (e.x., few-shot regression, image classification, reinforcement learning)에 적용시켰다.


2. Model-agnostic Meta-Learning

2.1 Meta-Learning Problem Set-Up

Few-shot meta-learning의 목표는 적은수의 datapoints와 training iterations으로 새로운 task에 빠르게 적용할 수 있는 모델을 학습시키는 것이다. 

"To accomplish this, the model or learner is trained during a meta-learning phase on a set of tasks, such that the trained model can quickly adapt to new tasks using only a small number of examples or trials."

사실상, meta-learning problem은 전체 tasks를 training examples로 다룬다. 이 session에서는 different learning domains의 짧은 예제를 포함하여, 일반적인 방법으로 meta-learning problem을 공식화한다. 

f: a model, 입력 x를 output a에 mapping 한다.

Meta-learning 중에, 모델은 매우 큰 수의 tasks에 적용이 될 수 있도록 학습된다. classification부터 reinforcement learning 까지 다양한 learning problem에 제안된 framework를 적용하고 싶어하기 때문에 아래와 같이 learning task의 일반적인 개념에 대해서 소개한다.

L : a loss function

q(x_1) : a distribution over initial observations

q(x_{t+1}}x_{t},a_t) : a transition distribution

H : an episode length (supervised learning에서는 1)

Meta-learning scenario에서 모델이 적용되는 a distribution of tasks p(T)가 고려된다. Meta-learning 중에 task T_i는 p(T)로 부터 sampling되고, model은 T_i로부터 계산된 L_T_i의 feedback과 K개의 sample로 학습된다. Model f는 parameters에 대한 q_i의 변화로부터 새로운 data의 test error를 고려함으로 개선된다. Sampled task T_i의 test error는 meta-learning process의 training error로서 역할을 한다. Meta-training의 마지막 단계에서, p(T)에서 새로운 task를 sample하고 K개의 sample로 부터 학습한 이후 model의 성능을 평가하여, meta-performance를 측정한다. 일반적으로, meta-testing에 대해 사용되는 tasks는 meta-training 동안 고정된다.

2.2 A Model-Agnostic Meta-Learning Algorithm

전체 데이터 셋을 고려한 recurrent neural networks를 학습하거나 test time에서 non-parametric methods와 함께 통합된 feature embeddings을 학습시키는 이전 연구와 달리, 이 논문에서는 fast adaptation을 위한 model을 준비하는 방법으로 meta-learning을 통해 any standard model의 parameters를 학습할 수 있는 방법을 제안하였다.

"The intuition behind this approach is that some internal representations are more transferrable than others". 이 논문에서는 명시적인 접근 방법을 취한다. Model이 새로운 task에 대한 gradient-based learning rule을 사용하여 fine-tuning이 되므로, 이 gradient-based learning rule이 빠른 작업을 할 수 있는 방식으로 model을 학습하는 것을 목표로 한다. 사실상, parameters의 작은 변화가 p(T)에서 끌어낸 task의 loss function을 크게 향상시키도록 task의 변경에 sensitive한 model의 parameters를 찾는 것을 목표로 한다.

저자는 model의 형태에 대해 어떤 parameters vector에 의해 paramaetrization 되어 있다고 가정하는 것 이외에 어떠한 가정도하지 않았으며, loss function은 gradient-based learning techniques를 사용할 수 있는 theta에서 충분히 부드러운 형태를 갖는다. Parameter theta를 갖는 parameterized function (f)를 model로 표현한다. 새로운 task T_i에 적응할 때, model의 parameter theta는 theta'_i가 된다. 이 방법에서, updated parameter vector theta'_i는 task T_i에 한번이나 그 이상의 gradient descent updates를 사용해서 계산된다. 예를 들어, gradient가 한번 update될 때, 

Step size alpha는 hyper-parameter로 고정되거나 메타 학습된다. p(T)로 부터 sample된 tasks를 거쳐서 theta에 대해 f_theta'_i의 성능을 최적화 함으로써 model의 parameters를 학습한다. 보다 구체적으로, meta-objective는 다음과 같다.

Meta optimization은 model parameters에 대해 수행되는 반면에, updated model parameter theta'를 사용하여 objective가 계산된다. 저자의 제안된 방법은 model parameter를 최적화하여 새로운 task에 대해 하나 또는 적은 gradient step이 해당 task에 대해 최대로 효과적 동작을 만들도록 하는 것이다.

Task 전반에 걸쳐, meta-optimization은 SGD를 통해 수행이되므로, model의 parameters는 다음과 같이 update가 된다.

Beta는 meta step size이고, 전체 알고리즘은 밑에 표현되어 있다.

MAML meta-gradient update는 gradient를 통해 gradient를 포함한다. 계산적으로, Hessian-vector products를 계산하기 위해 f를 통해 추가적인 backward pass를 요구한다.


3. Species of MAML

3.1 Supervised Regression and Classification

Meta-learning을 위한 유사한 tasks로 부터의 이전 data를 사용하여, 해당 task의 몇 가지 입력/출력 쌍에서 새로운 기능을 학습하는 것이 목표인 supervised tasks에서 Few-shot learning은 잘 연구되었다. 예를 들어, Segway의 이미지를 한 번 또는 몇 번 보았을 때 Segway의 이미지를 분류하고 다른 많은 유형의 객체를 본 적 있는 모델을 목표로 삼을 수 있다. 마찬가지로, 몇 번의 회귀 분석에서, 목표는 유사한 통계적 특성을 가진 많은 함수를 학습 한 후에 그 함수로부터 sampling 된 소수의 data point에서 연속 값 함수의 출력을 예측하는 것이다.

Supervised classification and regression 에 대한, 두개의 common loss functions은 cross-entropy와 mean-squared error (MSE) 이다.

x(j)와 y(j)는 task T_i로 부터 sample된 input/output pair이다. K-shot regression tasks에서는 K개의 pair가 각 task에 대해 학습으로 사용된다. 유사하게, discrete classification tasks는 다음과 같은 loss를 갖는다.

이전의 terminology에 따르면, K-shot classification tasks는 K개의 input/output pairs를 각 class에서 추출해서 사용한다. N개의 class라면 NK의 data points가 sample된다.

3.2 Reinforcement Learning (생략)

4. Related work (생략)

5. Experimental Evaluation

저자의 experimental evaluation의 목표는 다음과 같은 질문에 대답하는 것이다.

1) Can MAML enable fast learning of new tasks?

2) Can MAML be used for meta-learning in multiple different domains, including supervised regression, classification, and reinforcement learning?

3) Can a model learned with MAML continue to improve with additional gradient updates and/or examples?

5.1 Regression

MAML의 기본 원리를 보여주기 위해서, 간단한 regression 문제를 시작한다. 각 task는 진폭과 위상이 각 task마다 다른 sine의 출력을 입력으로 regression하는 문제를 포함한다. 따라서, p(T)는 continuous 하며, 여기서 진폭은 [0.1,5.0]이고 위상은 [0,pi]이고 입력과 출력은 둘 다 차원이 1이다. Training 및 testing 중에 data point는 [-5.0,5.0]에서 sampling 된다. Loss는 f(x)와 참값 사이의 mean-squared error이다. regressors는  40개 unit (ReLU가 activation function)의 2 hidden layers를 갖는 neural networks이다. MAML로 학습할 때, 고정된 step size를 갖는 K=10 examples을 사용하여 한번의 gradient를 계산되고, Adam이 meta-optimizer로 사용된다. Baseline은 Adam과 마찬가지로 학습된다. Performance를 평가하기 위해서 다양한 K example에서 하나의 meta-learning model을 세분화하고 성능을 두 개의 baseline과 비교한다.

(a) network에서 임의의 sine wave function으로 regression되도록 training하는 모든 작업을 pretraining 하고, test 시간에 자동으로 tuning된 step size를 사용하여 K개의 points에 대해 gradient descent로 fine-tuning 하고,

(b) 진폭 및 위상을 입력으로 받는 oracle을 선택한다.

저자는 MAML에서 trained된 모델과 pre-trained된 모델을 K={5,10,20}에서 fine-tuning하여 성능을 평가했다. Fine-tuning 중에 각 gradient step은 동일한 K개의 data points를 사용하여 계산된다. 밑의 그림의 결과는 5개의 data points 만으로도 신속하게 adaptation이 가능하는 것을 보여주지만, 모든 tasks에서 standard supervised learning을 사용하여 pretrained된 모델은 사용이 불가능했다. (over-fitting)

결정적으로, K개의 data points가 모든 입력 범위의 절반에 있을 때, MAML로 training된 모델은 나머지 범위의 진폭과 위상을 여전히 추론할 수 있으며, MAML training model f가 periodic property를 modeling 하는 것을 배웠음을 보여준다. 또한, MAML에서 배운 모델은 한 단계의 gradient step 후에 최대 성능을 학습하였음에도 불구하고 추가 gradients step을 통해 지속적으로 성능이 향상된다는 것을 알 수 있었다. 이러한 결과는 MAML이 fast adaptation이 가능하고 p(T)의 loss function에 민감한 지역에 속하도록 parameters를 최적화한다는 것을 제안한다.

5.2 Classification

meta-learning

5.3 Reinforcement learning (생략)

이전의 Meta-learning과 few-shot learning algorithms을 비교하여, MAML을 평가하기 위해 Omniglot 및 MiniImagenet 데이터의 few-shot image recognition에 이 방법을 적용하였다. Omniglot dataset은 50개의 다른 alphabet으로 구성된 1623개의 문자로 구성된 20개의 instance로 구성된다. MiniImagenet dataset는 64개의 training classes, 12개의 validation classes, 24개의 test classes를 포함한다. 

1 or 5 shots으로 N개의 class를 구분하는 classification을 빠르게 학습해야 한다. (N-way classification) N-way classification problem은 다음과 같이 설정된다. 1) N개의 unseen class를 선택하고, N개의 class 각각에 대해 K개의 다른 instance를 모델에 제공한다. 2) N개의 class에서 새 instances를 분류하는 모델의 기능을 평가한다. (네트워크에 대한 설명은 생략.)

결과는 밑의 표에 나타나있다. MAML에서 배운 convolutional model은 task에 대한 state-of-the-art와 잘 비교 되며, 이전의 방법보다 narrow한 성능을 보인다. 또한, MAML로 학습된 model은 algorithm이 classifier 그 자체의 weights 이상으로 additional parameters를 사용하지 않으므로 matching networks 및 meta-learner LSTM에 비해 전체 parameters의 개수가 적다.

6. Discussion and Future Work

저자는 Gradient descent를 통해 쉽게 적용 가능한 model parameters를 학습하는 데에 기반한 meta-learning methods를 제안하였다. 저자의 접근 방식은 여러 가지 이점이 있다.

1) "it is simple and does not introduce any learned parameters for meta-learning."

2) "it can be combined with any model representation that is amenable to gradient-based training, and any differentiable objective, including classification, regression, and reinforcement learning"

3) "since our method merely produces a weight initialization, adaptation can be performed with any amount of data and any number of gradient steps, though we demonstrate state-of-the-art results on classification with only one or five examples per class." 

과거의 tasks의 지식을 재사용하는 것은 deep neural networks와 같은 high-capacity scalable models을 만드는데 중요한 요소가 될 수 있으며, 작은 data set을 사용하여 빠르게 교육할 수 있다. 저자는 이 작업이 모든 문제 및 모든 모델에 적용할 수 있는 간단하고 일반적인 meta-learning 기술을 향한 한 걸음이라고 믿는다. 이 영역에 대한 추가 연구를 통해 multi-tasking initialization가 deep learning 및 reinforcement learning의 standard가 될 수 있다.


7. 개인의견

너무 내용이 복잡하지만, 간단하게 다양한 task에 쉽게 + 빠르게 적용할 수 있는 weight을 학습을 통해서 찾아내겠다는 것이 핵심이다. 따라서, 이 과정을 통해서 다양한 task 및 different architecture와 different problem에 적용을 할 수 있다는 점과, state-of-the-art에 버금가는 성능을 보일 수 있음을 보였다. 



Comments