Solving Cosine Similarity Underestimation between High Frequency Words by L2 Norm Discounting

Saeth Wannasuphoprasit, Yi Zhou, Danushka Bollegala
5/17/2023
10 citations
cs.CL

Official code: LivNLP/cosine-discounting (3 stars, Jupyter Notebook, last commit 2023-05-20).

Abstract

Cosine similarity between two words, computed using their contextualised token embeddings obtained from masked language models (MLMs) such as BERT has shown to underestimate the actual similarity between those words (Zhou et al., 2022). This similarity underestimation problem is particularly severe for highly frequent words.

Show full abstract

Although this problem has been noted in prior work, no solution has been proposed thus far. We observe that the L2 norm of contextualised embeddings of a word correlates with its log-frequency in the pretraining corpus. Consequently, the larger L2 norms associated with the highly frequent words reduce the cosine similarity values measured between them, thus underestimating the similarity scores. To solve this issue, we propose a method to discount the L2 norm of a contextualised word embedding by the frequency of that word in a corpus when measuring the cosine similarities between words. We show that the so called stop words behave differently from the rest of the words, which require special consideration during their discounting process. Experimental results on a contextualised word similarity dataset show that our proposed discounting method accurately solves the similarity underestimation problem.

View on arXivView PDF

Code Implementations(1)

31Jupyter NotebookSep 23, 20223 years ago

Similar Papers

Cite this paper

@article{wannasuphoprasit2023solving,
  title  = {Solving Cosine Similarity Underestimation between High Frequency Words by L2 Norm Discounting},
  author = {Saeth Wannasuphoprasit and Yi Zhou and Danushka Bollegala},
  year   = {2023},
  eprint = {2305.10610},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.10610v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.10610.svg)](https://codeofpaper.com/paper/2305.10610)

Discussion