What is: Absolute Position Encodings?
Source | Attention Is All You Need |
Year | 2000 |
Data Source | CC BY-SA - https://paperswithcode.com |
Absolute Position Encodings are a type of position embeddings for [Transformer-based models] where positional encodings are added to the input embeddings at the bottoms of the encoder and decoder stacks. The positional encodings have the same dimension as the embeddings, so that the two can be summed. In the original implementation, sine and cosine functions of different frequencies are used:
where is the position and is the dimension. That is, each dimension of the positional encoding corresponds to a sinusoid. The wavelengths form a geometric progression from to . This function was chosen because the authors hypothesized it would allow the model to easily learn to attend by relative positions, since for any fixed offset , can be represented as a linear function of .
Image Source: D2L.ai