First step, define an information element in the output sequence of the decoder as "Query", the sequence information in the encoder input sequence as a    "key". The "value" usually represents the sequence information with the same key (it is the semantic code corresponding to each word in the input sentence). That is to say, the input sequence is composed of "key-value" **data** pairs. The second step is to calculate the attention weight coefficient. First calculate the similarity of key and value. Then normalize the calculated similarity. The final result is the normalized coefficient, which is the weight coefficient i a .