Attention is all you need
attention 메커니즘은 기존의 NLP 모델이 사용하던 RNN(vanila RNN,seq2seq,LSTM) 구조의 gradient vanishing으로 인한 문제를 해결하고 Transformer 구조를 제안한다. self-attention을 활용하며 parallel 처리로 빠른 학습 속도를 가지며, long distance dependency 해결


weight update를 위한 backpropagation 시, vanishing(or exploding) gradient 문제로 long term effect 소실 가능성 있음.

RNN에 cell state(memory -> )를 추가함. sigmoid layer([0,1]로 만드는 함수) 인 forget gate(), input gate(), output gate()를 통해서 cell state내에 정보 조절함
encoder-decoder 구조 사용
encoder: input sequence를 읽고 encode to context vector(고정길이)
decoder: 벡터에서 output sequence 추출 (auto regressive)
->고정된 벡터 사용으로 인해서 모든 decoding step에서 동일 context 사용해야하는 문제(실제로는 각 decoding 부분마다 요구하는 context가 다름)
이후 RNN 구조에 attention 추가해서 해결
attention: query(decoder hidden state), key(encoder hidden state), value(encoder hidden state) 벡터들을 사용해 각 context의 확률을 계산
RNN
-> 먼 단어가 상호작용에 시간이 걸리고, 정보 손실이 존재(gradient 문제 있음)
-> unparallelizable(병렬 불가능), future hidden state 가 먼저 계산될 수 없음
encoder-decoder structure 을 통해서 auto regressive하게 작동한다.

tokenized + positional encoding(sin/cos 함수 & 상대적 거리 파악)
encoder


가 커질수록 Dot-product의 값이 커져 Softmax 함수에서 Gradient Vanishing 발생. 이를 방지하기 위해 로 나눔
(논문: 8개 헤드, 각 헤드 차원=64)


decoder

EN-DE & EN-FR 번역 과제에서 이전 모델보다 더 높은 BLEU 점수를 기록, 학습 비용 크게 절감
장점
한계