Seq2Seq Model

image.png

일련의 단어를 Encoder로 입력받아, 변환된 일련의 단어를 Decoder로 출력

Encoder가 입력을 고정 크기의 Latent vector로 변환하고 이를 Decoder의 첫 State로 사용.

길이가 가변적인 입력과 출력을 다룰 수 있다.

문제점 - Bottlenect problem:

고정된 크기의 Latent vector는 긴 입력 정보를 모두 담기 어렵다.

Seq2Seq with Attention

image.png

Attention 점수 - 두 입력은 얼마나 관계가 있는가?

image.png

Attention 분포를 활용하여 Weighted Sum 계산

Encoder의 Hidden State에서 필요한 부분 추출

Attention 출력은 Attention 점수가 컸던 Hidden State의 내용을 많이 담는다.

Attention 출력Decoder hidden state를 concatenation 후, $\hat{y_1}$을 계산한다.