Learn Before
Self- Attention layer understanding - Step 1 - Getting rid of RNN
Note this is not how the actual self -attention layer in Transformer works but just modification of the seq_to_seq encoder. So over as the first step let’s just get rid of the RNNs used in seq2seq. For each word embedding we can score all others based on the dot attention score we already saw before. Each of those vectors we need to divide by square root of the dimension of the input vectors to the score function. This trick should help gradients be more stable. Then we take a softmax of those. And then calculate the weighted sum of the other embeddings based on those softmax scores. Add this vector to the embedding vector of the current word and we get the output for the current timestamp for the self-attention layer.

0
1
Tags
Data Science
Related
Self- Attention layer understanding - Step 1 - Getting rid of RNN
In the self-attention mechanism of a Transformer encoder layer, where are the queries, keys, and values sourced from?
True or False: Within the Transformer encoder stack, the number of primary sublayers contained in a layer varies depending on its position.
Identify the two primary sublayers that comprise every individual layer in the Transformer encoder stack.
Match each Transformer encoder component or data source to its correct architectural role.
Identify the architectural flaw in this encoder self-attention configuration and state the correct source for the queries, keys, and values.