Transformer는 Inductive Bias이 부족하다라는 의미는 무엇일까?

daewoo kim
6 min readMay 19, 2021

--

Inductive Bias가 딥러닝 알고리즘에 미치는 영향은 무엇일까……?

이전에 ViT(Vision Transformer) 논문을 읽을 때 Inductive Bias라는 용어를 처음 접하였다. 이번 MLP-Mixer 논문을 읽을 때도 Inductive Bias라는 용어가 또 언급이 되었다. 과연 Inductive Bias는 무엇이고, 딥러닝 알고리즘에 어떠한 영향을 미치는 것일까?

ViT(Vision Transformer)에서 Inductive bias 언급 내용

Transformer는 CNN에 고유한 inductive biases이 부족하므로 충분하지 못한 양의 데이터으로 학습할 때 일반화가 잘 되지 않는다.

먼저 inductive bias가 무엇인지? inductive bias이 부족하다는 것의 의미는? inductive bias와 데이터양과 의 관계는? 에 대해서 차례대로 알아보도록 하겠다.

먼저 Inductive Bias의 정의가 무엇인지?

Stackoverflow에 나온 Inductive Bias에 대한 Q&A를 참고하면 다음과 같다.

Q: What is inductive bias in machine learning? Why is it necessary?

A1. Every machine learning algorithm with any ability to generalize beyond the training data that it sees has some type of inductive bias, which are the assumptions made by the model to learn the target function and to generalize beyond training data. For example, in linear regression, the model assumes that the output or dependent variable is related to independent variable linearly (in the weights). This is an inductive bias of the model.

머신러닝 알고리즘은 타겟 함수를 학습하고 학습 데이터를 넘어 일반화하기 위해 모델에 의해 가정된 Inductive Bias(유도 편향)를 의도적으로 사용한다는 의미이다. 예를들어 linear regression 모델은 종속 변수는 독립 변수(출력)와 선형적으로 관련이 있다는 것을 가정한다.

즉, 머신러닝 문제를 더 잘 풀기 위해 사전 정보를 통해 추가된 가정을 Inductive bias라고 할 수 있다.

Inductive bias이 부족하다는 것의 의미는?

Deepmind와 Google Brain이 공동 저술한 “Relational inductive biases, deep learning, and graph networks” 논문은 딥러닝 레이어에 따른 Relational inductive bias 정도를 설명한다. (2018년도에 나온 논문이라서 최근 대세인 Self-attention(Transformer)는 빠져있다.)

딥러닝 컴포넌트에 따른 Relational inductive bias (“Relational inductive biases, deep learning, and graph networks”)

일반적으로 머신러닝 모델은 특정 데이터셋에 대해 더 좋은 성능을 얻고자 Inductive bias를 의도적으로 강제해준다. 예를들어 Vision 정보는 인접 픽셀간의 locality가 존재한다는 것을 미리 알고 있기 때문에 Conv는 인접 픽셀간의 정보를 추출하기 위한 목적으로 설계되어 Conv의 inductive bias가 local 영역에서 spatial 정보를 잘 뽑아낸다. RNN은 순차적인(Sequential) 정보를 잘 처리하기 위해 설계되었다. 반면 Fully connected(MLP)는 all(input)-to-all (output) 관계로 모든 weight가 독립적이며 공유되지 않아 inductive bias가 매우 약하다. Transformer는 attention을 통해 입력 데이터의 모든 요소간의 관계를 계산하므로 CNN보다는 Inductive Bias가 작다라고 할 수 있다. 따라서 Inductive Bias의 순서는 CNN > Transformer > Fully Connected 라고 예상할 수 있다.

Inductive bias와 데이터양과 의 관계는?

Inductive Bias가 강할수록, 작은 데이터셋에 대해서도 학습 성능이 더 좋아지는 경향이 있다. 하지만 최신 딥러닝 알고리즘은 사전 표현 및 계산 가정을 최소화하는 End-to-End 설계 철학으로 만들어지는 경향이 있다.

따라서 최신 딥러닝 알고리즘은 Inductive bias를 낮추어서 generalization을 높이는 대신 data-intensive한 경향을 보인다. 이로 인해 Transformer가 부족한 Inductive bias 때문에 성능 향상을 위해 많은 양의 데이터셋이 필요한 대신, robust하게 동작하므로 NLP를 비롯한 다양한 task에서 좋은 성능을 보일 수 있는 것이다.

Bias-Variance Trade-off

머신러닝은 특정 문제를 풀기 위해 학습 데이터에 대해서 가장 loss가 작은 Hypothesis를 찾는다. 하지만 Hypothesis의 제한이 없다면 overfitting이 일어나므로 제한을 걸어주는데 이 제한이 바로 Inductive bias이다. 하지만 Inductive bias가 적절하지 못하거나 지나치게 강하면 학습을 통해 얻은 Hypothesis의 성능이 좋지 않을 수 있다.

Inductive Bias이 강하면 오히려 generalization(variance)이 떨어져 오히려 학습을 방해하여 성능을 저해할 요소가 될 수 있으므로 Inductive Bias과 generalization은 trade-off가 있다. 결국, ViT 논문에서 나오는 것과 같이 CNN보다 Inductive Bias가 부족하다라는 것은 Bias-Variance Trade-off로 설명할 수 있다.

레퍼런스

[1] https://stackoverflow.com/questions/35655267/what-is-inductive-bias-in-machine-learning

[2] Relational inductive biases, deep learning, and graph networks : https://arxiv.org/pdf/1806.01261.pdf

[3] https://en.wikipedia.org/wiki/Bias%E2%80%93variance_tradeoff

--

--

daewoo kim

AI developer & Author | Working@semiconductor-industry. I write and share about what I learn.