Abstract

The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. The best performing models also connect the encoder and decoder through an attention mechanism. We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train. Our model achieves 28.4 BLEU on the WMT 2014 Englishto-German translation task, improving over the existing best results, including ensembles, by over 2 BLEU. On the WMT 2014 English-to-French translation task, our model establishes a new single-model state-of-the-art BLEU score of 41.0 after training for 3.5 days on eight GPUs, a small fraction of the training costs of the best models from the literature.


대표적인 문장 번역 모델들은 인코더와 디코더를 포함한 순환 또는 컨볼루션 신경망으로 구성된다.

가장 우수한 모델은 어텐션 메커니즘을 통해 인코더와 디코더를 연결한다.

우리는 순환 및 컨볼루션 신경망을 완전히 배제하고 어텐션 메커니즘을 사용하는 새로운 모델 아키텍쳐 Transformer를 제안한다.

두 가지 기계번역의 실험에서 제안한 모델은 우수한 성능과 병렬화가 가능하고, 학습 시간을 감소시킨다.

영어 -> 독일 28.4 2 BLEU는 앙상블을 포함하여 현존 최고의 성능이다.

영어 -> 프랑스어 작업에서는 8개의 GPU로 3.5일동안 학습시킨 결과 최고의 성능을 얻었다. 학습 비용 측면에서도 우수하다. 


요약

  • self-attention은 연산량이 O(1)로 낮으며, 시퀀스의 모든 값들을 비교분석해볼 수 있다. 예를 들어, CNN 같은 경우는 필터의 크기만큼에 해당하는 값만 비교할 수 있었다.

  • 논문에서는 CNN과 RNN을 사용하지 않고 오로지 어텐션만 사용하여 모델을 구성하였다. 위의 그림에서 N = 6이다.
  • 어텐션은 대표적으로 Additive와 dot--product attention이 사용된다.

  • dot-product 어텐션은 sparsity에 강하다. self-attention은 컨볼루션과 다르게 위치에 관한 정보를 가지지 않게 되는데, 이를 Multi-head 어텐션을 통해 보완해준다.

 

 

Reference

Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., ... & Polosukhin, I. (2017). Attention is all you need. In Advances in neural information processing systems (pp. 5998-6008).
https://www.youtube.com/watch?v=6zGgVIlStXs&list=PLWKf9beHi3Tg50UoyTe6rIm20sVQOH1br&index=50