What's the difference between content-based attention and dot-product attention?
The Attention is All you Need has this footnote at the passage motivating the introduction of the $1/\sqrt{d_k}$ factor:


To illustrate why the dot products get large, assume that the components of $q$ and $k$ are independent random variables with mean 0 and variance 1. Then their dot product, $q \cdot k = \sum^{d_k}_{i=1}q_ik_i$ has mean 0 and variance $d_k$.


I suspect that it hints on the cosine-vs-dot difference intuition. The cosine similarity ignores magnitudes of the input vectors - you can scale $h^{enc}$ and $h^{dec}$ by arbitrary factors and still get the same value of the cosine distance.
The footnote talks about vectors with normally distributed components, clearly implying that their magnitudes are important. This suggests that the dot product attention is preferable, since it takes into account magnitudes of input vectors.  And the magnitude might contain some useful information about the &quot;absolute relevance&quot; of the $Q$ and $K$ embeddings.
Edit after more digging: Note that transformer architecture has the Add &amp; Norm blocks after each
attention and FF block. At first I thought that it settles your question: since
every input vector is normalized then cosine distance should be equal to the
dot product. That's incorrect though - the &quot;Norm&quot; here means Layer
Normalization - analogously to batch normalization it has trainable mean and
scale parameters, so my point above about the vector norms still holds.
Finally, since apparently we don't really know why the BatchNorm works
same thing holds for the LayerNorm. Interestingly, it seems like (1) BatchNorm
(2) LayerNorm and (3) your question about normalization in the attention
mechanism - all of it look like different ways at looking at the same, yet
undiscovered and clearly stated thing.