-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created CoSENTLoss.py #2454
Created CoSENTLoss.py #2454
Conversation
Hello! I've ran various scripts that use CosineSimilarityLoss with both that loss & CoSENT, and the Spearman correlation coefficient for cosine similarity against the STSBenchmark test set almost universally shows improvements for CoSENT versus CosineSimilarityLoss.
Code looks good too! Seems to match the other implementations. As for your comments, it makes sense to consider this a drop-in replacement of the CosineSimilarityLoss, and thus support that input format (anchor-sentence pairs with a similarity score label). The 1e12 choice is also good - I'd like to stick to the official implementation.
|
I think this might already be ready for merging! What do you think @johneckberg? |
@tomaarsen Go ahead! If you think that the documentation is clear and easy enough to follow, then I also think it's ready for merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added CoSENTLoss to the docs & updated the formatting slightly. I also mentioned my experiments where CoSENTLoss outperformed CosineSimilarityLoss.
cc: @bojone You might be interested in this work; we're impressed with the performance of CoSENT, and would like to implement it into Sentence Transformers to improve the accessibility of your loss function.
- Tom Aarsen
Updated documentation to match description in original article
@tomaarsen Wonderfull! I'm very happy to see CoSENT receiving further recognition. |
Very excited to see this loss function merged. I'll be experimenting with it myself! |
PR Overview
Details