Skip to content

Commit

Permalink
Merge pull request #22 from natema/fix_typo
Browse files Browse the repository at this point in the history
Fix typo in "Mental model" formula
  • Loading branch information
mlelarge authored Sep 15, 2023
2 parents a886cf7 + 683703a commit 5235695
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/12-attention.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ with the convention that $X_t\in \mathbb{R}^d$ (resp. $Y_s\in \mathbb{R}^d$) is
**Mental model for self-attention:** self-attention interpreted as taking expectation
$$
y_s = \sum_{t=1}^T p(x_t | x_s) v(x_t) = \mathbb{E}[v(x) | x_s],\\
\text{with, } p(x_t|x_s) = \frac{\exp(q(x_s)k(x_t))}{\sum_{r}q(x_s)k(x_r)},
\text{with, } p(x_t|x_s) = \frac{\exp(q(x_s)k(x_t))}{\sum_{r}\exp(q(x_s)k(x_r))},
$$
where the mappings $q(.), k(.)$ and $v(.)$ represent query, key and value.
Expand Down

0 comments on commit 5235695

Please sign in to comment.