While cosine similarity is usually preferred, it is sometimes desirable to use the raw dot product
In general, though, magnitude typically introduces unwanted distortions. For example, when comparing text documents, the magnitude of vectors derived from word counts can cause longer documents to “matter more” than shorter ones. For this reason, cosine similarity is far more common than inner product similarity.