How does the scoring function effect similarity performance of the model?

#29
by luciancap001 - opened

Coming to this page from https://www.sbert.net/docs/sentence_transformer/pretrained_models.html so not sure if this is the best place for this question, but the SentenceTransformer docs list dot-product, cosine-similarity, & euclidean-distance as suitable scoring functions for this model.

Is this any difference in performance for the different scoring functions used? Would using cosine-similarity vs euclidean-distance produce comparable results?

Regarding your question,
It is difficult to say that the performance is totally related to the scoring functions. Each of the scoring functions can reproduce different results. Also, the cosine similarity outputs the scores in a normalized manner (between 0 and 1), while others don't.
In each model card, it is possible to see the scoring function appropriate for its use case. However, all scoring functions work on all models as they produce mathematical matrixes plausible for calculation.
Directly answering your question -> The only main difference is computational time, as the mathematical expressions are different, the time to reproduce the results is distinct as well. In terms of performance, there is no semantic difference. However, you should choose the metric, mostly adapting it to your use case.

Hope this helps
Cheers

I guess I should elaborate a little more, what I was trying to get at is if one of the scoring functions outperforms the others in terms of semantic similarity results as documented on the SentenceTranformer site.

Sign up or log in to comment