PRISM · Machine Learning PlaygroundPRISM · 머신러닝 놀이터
Attention lets each token build its new representation by looking at the whole sequence and taking a weighted average of the others. The weights come from compatibility: a query from one token is compared to a key from each token, and softmax(q·k / √d) turns those scores into a distribution. Pick a query and watch where it attends — and how the attention matrix carries the structure of the sequence.어텐션은 각 토큰이 시퀀스 전체를 바라보며 나머지의 가중 평균을 취해 새 표현을 만들게 한다. 가중치는 적합도에서 나온다: 한 토큰의 쿼리가 각 토큰의 키와 비교되고, softmax(q·k / √d)가 그 점수를 분포로 바꾼다. 쿼리를 골라 어디에 주목하는지, 그리고 어텐션 행렬이 시퀀스의 구조를 어떻게 담는지 보라.
Query token쿼리 토큰
Sequence시퀀스
Each token emits a query (what am I looking for), a key (what I offer), and a value (what I pass on). Attention weight A_ij = softmax_j(q_i·k_j/√d), and the output is Σ_j A_ij v_j — a content-addressed, differentiable lookup over the whole sequence.각 토큰은 쿼리(무엇을 찾는가), 키(무엇을 제공하는가), 값(무엇을 전달하는가)을 낸다. 어텐션 가중치는 A_ij = softmax_j(q_i·k_j/√d)이고, 출력은 Σ_j A_ij v_j — 시퀀스 전체에 대한 내용 기반의 미분 가능한 조회다.
Dot products of d-dimensional vectors grow like √d, which would saturate the softmax into a hard argmax. Dividing by √d keeps the scores in a sane range so gradients flow — the sharpness slider here plays that role in reverse.d차원 벡터의 내적은 √d처럼 커져 softmax를 하드 argmax로 포화시킨다. √d로 나누면 점수가 적정 범위에 머물러 기울기가 흐른다 — 여기 날카로움 슬라이더가 그 역할을 반대로 한다.
Stacking self-attention builds the Transformer — now used far beyond language: on clinical time series, genomic sequences, and medical images, wherever long-range relationships between elements matter. It is also modern Hopfield associative memory in disguise.셀프 어텐션을 쌓으면 Transformer가 된다 — 이제 언어를 훨씬 넘어 임상 시계열, 유전체 서열, 의료 영상 등 요소 간 장거리 관계가 중요한 곳 어디에나 쓰인다. 또한 이것은 변장한 현대 Hopfield 연상 기억이기도 하다.