-
Effective Approaches to Attention-based Neural Machine Translation 리뷰Paper Review 2020. 5. 17. 00:09
[Abstraction]
1. NMT 연구에서 attention 구조에 대한 비교 연구가 없었다. (2015년 기준. transformer가 2017년에 나옴)
2. Global attention model과 Local attention model을 비교할 것이다.
[3. Attention-based Models]
decoder의 h_t와 input sequence의 context를 나타내는 c_t를 concat한 뒤 선형/비선형 layer를 거쳐 context를 고려한 ~h_t를 만든다. c_t를 생성하는 방법에 따라 global/local attention으로 나뉜다.
[3.1 Global Attention]
- Alignment weight vector a_t가 새로 등장한다. global attention에서는 a_t를 계산하기 위해 encoder의 모든 hidden state h_s와 decoder의 현재 h_t의 attention score를 계산한다. 계산하는 방법은 아래 수식처럼 (dot, general, concat) 3가지 방법이 있다.
a_t를 얻은 후 이를 weight로 생각해서 h_s들의 weighted avg를 내면 c_t를 얻는다.
- Global attention은 train 방법이 단순하지만, 모든 encoder의 h_s를 계산해야하기 때문에 input seq length가 길어지면 expensive하다.
[3.2 Local Attention]
- Soft attention과 hard attention의 장점을 섞은 것이다.
1) Soft attention은 Global Attention과 같이 모든 input과의 attention을 고려하는 것이다.
2) Hard Attention은 input의 일부와의 attention을 고려하는 것이다. Hard Attention Model은 계산비용이 less expensive하지만, non-differenciable하기 때문에 학습 시에 복잡한 방법이 필요하다(e.g Variance Reduction, RL).
- 본 논문에서는 특정 window에 대한 attention을 고려하는 방법으로 soft/hard attention의 단점을 극복한다.
- 먼저 aligned positon이라 불리는 정수 p_t를 생성한다. p_t를 통해 encoder의 hidden state 중 [p_t - D, p_t + D] 만큼의 window를 고려해 context c_t를 생성한다.
- p_t를 선택하는 방법은 두 가지가 있다. monotonic한 방법은 p_t = t로 두어 decoder의 time step과 같은 부분의 encoder의 hidden state를 중심으로 window를 잡는다. predictive한 방법은 equation (9)를 통해 이루어진다. S는 encoder seq length이고, W_p, v_p는 trainable param이다. 쉽게 말해, fc layer 2개를 이용해 학습한다.
- 위 두 방법을 통해 Local Attention Model은 대부분 Differenciable해진다.
- p_t를 통해 어떤 window를 볼 지 선택했다면 a_t를 아래와 같이 만든다. align(h_t, h_s)부분은 global attention model에서의 a_t 수식과 같다. s는 현재 window [p_t - D, p_t + D] 범위 안에 있는 정수이다. 각각의 s에 대해 가우스 분포와 같은 weight을 주어서 window의 center인 p_t와 가까울 수록 attention score를 크게 준다.
[3.3 Input-feeding approach]
- Attention을 고려해 생성된 ~h_t를 다음 decoder input과 concat한다.
- 이렇게 되면 이전의 alignment 정보를 다음 layer에 전달 할 수 있고, network가 수직/수평으로 deep해지는 효과를 얻을 수 있다.
[6. Conclusion]
- WMT’14, WMT’15의 영어->독일어 번역에서 SOTA
- Global/Local Attention model에 대한 8가지 model을 Ensamble했을 때 성능이 가장 좋았다.
- Attention-based NMT model은 그렇지 않은 model에 비해 이름 번역, 긴 문장의 번역에서 탁월했다.
'Paper Review' 카테고리의 다른 글