[GH-ISSUE #68] Why cosine loss instead of just dot product? #62

Closed
opened 2026-10-31 21:10:23 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @ekgren on GitHub (Mar 23, 2021).
Original GitHub issue: https://github.com/openai/CLIP/issues/68

Trying to find the motivation in the article but I'm left without a definitive answer.

What is the motivation of using L2 normed dot product instead of simply the dot product in the loss?

Originally created by @ekgren on GitHub (Mar 23, 2021). Original GitHub issue: https://github.com/openai/CLIP/issues/68 Trying to find the motivation in the article but I'm left without a definitive answer. What is the motivation of using L2 normed dot product instead of simply the dot product in the loss?
Author
Owner

@jongwook commented on GitHub (Mar 24, 2021):

The main purpose is to stabilize training, by limiting the dynamic range of the logits. With the cosine similarities being within [-1, 1] and an upper-bounded temperature parameter, it's a simple way to prevent the model predictions from exploding. Radovanovi et al. found that the "hubness phenomenon" is less severe with cosine similarity, although synthetic data was used.

<!-- gh-comment-id:805553688 --> @jongwook commented on GitHub (Mar 24, 2021): The main purpose is to stabilize training, by limiting the dynamic range of the logits. With the cosine similarities being within [-1, 1] and an upper-bounded temperature parameter, it's a simple way to prevent the model predictions from exploding. [Radovanovi et al.](https://www.jmlr.org/papers/v11/radovanovic10a.html) found that the "hubness phenomenon" is less severe with cosine similarity, although synthetic data was used.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openai/CLIP#62
No description provided.