HOW AI WORKS - FRAME BOOK
VOL. 01·SEP 2026

ATTENTION CONNECTS TOKENS.

EACH TOKEN LOOKS AT OTHERS AND COMBINES INFORMATION USING WEIGHTED RELATIONSHIPS.

  1. The
  2. cat
  3. sat
  4. on
  5. the
  6. mat
  7. .

ATTENTION AS WEIGHTED CONNECTIONS.

THICKER LINES REPRESENT HIGHER ATTENTION WEIGHTS. EACH TOKEN PRODUCES QUERIES, KEYS AND VALUES TO COMPUTE ATTENTION SCORES.

01TOKENS

The
cat
sat
on
the
mat
.

A SEQUENCE OF TOKENS REPRESENTED AS VECTORS.

X=[x1, x2, …, xn]X = [x_1,\ x_2,\ \ldots,\ x_n]
n=7n = 7

02Q, K, V

XX
WQW^{Q}
WKW^{K}
WVW^{V}
QQ
KK
VV

EACH TOKEN IS PROJECTED INTO QUERIES, KEYS AND VALUES.

Q=X WQK=X WKQ = X\,W^{Q} \quad K = X\,W^{K}
V=X WVV = X\,W^{V}

03ATTENTION WEIGHTS

The
cat
sat
on
the
mat
.
A=softmax(QKTdk)A = \mathrm{softmax}\left(\dfrac{QK^{T}}{\sqrt{d_k}}\right)
The
cat
sat
on
the
mat
.
The cat sat on the mat .
1.0
0.0

04PER-HEAD VIEW

Head 1
Head 2
Head 3

05WITH POSITION

The
cat
sat
on
the
mat
.
POSITIONAL ENCODING (SINE WAVES)
f=1f = 1
f=2f = 2
f=4f = 4
f=8f = 8
f=16f = 16
The
cat
sat
on
the
mat
.

ADD POSITIONAL INFORMATION USING SINUSOIDAL ENCODING.

PE(pos, 2i)=sin⁡(pos / 100002i/dmodel)PE(pos,\ 2i) = \sin\left(pos\,/\,10000^{2i/d_{\text{model}}}\right)
PE(pos, 2i+1)=cos⁡(pos / 100002i/dmodel)PE(pos,\ 2i+1) = \cos\left(pos\,/\,10000^{2i/d_{\text{model}}}\right)

Attention &Position

Connecting Meaning and Order

ATTENTION LETS TOKENS EXCHANGE INFORMATION THROUGH WEIGHTED RELATIONSHIPS. POSITIONAL ENCODING GIVES TOKENS A SENSE OF ORDER USING SINE WAVES OF DIFFERENT FREQUENCIES.

  1. The
  2. cat
  3. sat
  4. on
  5. the
  6. mat
  7. .
  1. The
  2. cat
  3. sat
  4. on
  5. the
  6. mat
  7. .

TOKENS (INPUT)

EMBEDDINGS

X∈Rn×dX \in \mathbb{R}^{n \times d}

+ POSITION

X+PEX + PE

ATTENTION

A=softmaxA = \mathrm{softmax}
(QKT/dk)\left(QK^{T} / \sqrt{d_k}\right)

OUTPUT

Z∈Rn×dZ \in \mathbb{R}^{n \times d}

ATTENTION WEIGHT

1.0
0.5
0.1

TOKEN

Current focus
Other token

MOTION NOTES

  1. Build sequence
  2. Increase weights
  3. Add position(waves)
  4. Combine (final)