I think the cosine similarity of negative values has its own meaning.
If you softmax the cosine similarity of Q and K, wouldn't it prevent Transformer from using information with the opposite meaning?
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this communityI think the cosine similarity of negative values has its own meaning.
If you softmax the cosine similarity of Q and K, wouldn't it prevent Transformer from using information with the opposite meaning?
Consider that before the attention block, you apply a (trainable) linear projection, and that there are many attention heads.
This gives the needed degrees of freedom to handle the potential logic of negative cosine similarity that you think the model is lacking. For instance, one head might learn to rotate the query while another one might learn not to rotate it.