Attention Mechanisms
# Scaled Dot-Product Attention

Introduced by Vaswani et al. in Attention Is All You Need
#### Papers

#### Tasks

#### Usage Over Time

####
Categories

**Scaled dot-product attention** is an attention mechanism where the dot products are scaled down by $\sqrt{d_k}$. Formally we have a query $Q$, a key $K$ and a value $V$ and calculate the attention as:

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

If we assume that $q$ and $k$ are $d_k$-dimensional vectors whose components are independent random variables with mean $0$ and variance $1$, then their dot product, $q \cdot k = \sum_{i=1}^{d_k} u_iv_i$, has mean $0$ and variance $d_k$. Since we would prefer these values to have variance $1$, we divide by $\sqrt{d_k}$.

Source: Attention Is All You NeedPaper | Code | Results | Date | Stars |
---|

Task | Papers | Share |
---|---|---|

Language Modelling | 73 | 9.22% |

Object Detection | 22 | 2.78% |

Semantic Segmentation | 22 | 2.78% |

Question Answering | 21 | 2.65% |

Image Classification | 19 | 2.40% |

Knowledge Distillation | 16 | 2.02% |

Text Classification | 16 | 2.02% |

Sentiment Analysis | 13 | 1.64% |

Text Generation | 13 | 1.64% |