어텐션 메커니즘

🏷️ 정보 LLM

어텐션 메커니즘

어텐션 메커니즘(Attention Mechanism)은 입력 시퀀스의 각 요소가 출력을 생성할 때 다른 모든 요소들과의 연관성을 쿼리-키-밸류(Query-Key-Value) 구조로 계산하여 가중 합을 구하는 메커니즘이다.

핵심

수식

\[\text{Attention}(Q,K,V) = \text{softmax}\!\left(\frac{QK^T}{\sqrt{d_k}}\right)V\]