16.4 Attention 메커니즘
- 각 Time Step에서, decoder가 적절한 단어에 초점을 맞추는 구조
- 기존 번역 모델에서는 input-output으로 이어지는 경로가 매우 길다.
- decoder가 (encoder의 아웃풋인) input 단어에 집중하는 구조가 있음으로써, RNN의 단기 기억 제한을 극복할 수 있음
a_{i,j} : i번째 decoder time step에서 i번째 encoder 출력의 가중값.
* ex) a_(3,2) > a_(3,0) : 3번째 Time step에서, 두 번쨰 단어에 집중한다.
< Attention 매커니즘 >
$ \tilde{h}_(t) \sum\alpha_{t,j}y_{i} $
$\alpha_(t,i) = \frac{exp(e_(t,j)}{\sum exp(e_(t,j)}$
$e_{i,j} = $
$ pos(v)= \left\{
pos(v) = \left\{
\begin{matrix}
0 & v < 0 \\
v & otherwise
\end{matrix}
\right.
$
16.5
* ELMo
* GPT-1 : Transformer decoder 구조(masking)를 사용하였으며, unsuperivsed pre-train & supervised fine-tuning 의 2stage 로 학습함.
* BERT :
참고할 글 : https://lsjsj92.tistory.com/618