encoder 6개 decoder 6개

encoder 한번에 모든 sequence → unmasked

decoder에서는 순서에 따라 masked

Self-attention

The encoder are all identical in structure

Positional Encoding

input embedding에 더해주는 positional encoding은 concat이 아니라 말 그대로 더해주는 것

512 + 512 → 512 vector

Untitled

Untitled

word embedding과 똑같은 크기로 더해줘야함

→ 모든 word가 같은 크기로 변화하는 것 보장

input sequence에서 거리가 멀어지게 되면 positional encoding도 멀어져야함

Untitled

대각행렬에서 멀어지면 멀어질수록 값이 커져야함

→ The further the two positions, the larger the distance

Self-attention

self-attention is the method the Transformer uses to bake the understanding of other relevant words into one we’re currently processing