How Small Transformation Expose the Weakness of Semantic Similarity Measures

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Nikiema, Serge Lionel, Djire, Albérick Euraste, Bonkoungou, Abdoul Aziz, Moumoula, Micheline Bénédicte, Samhi, Jordan, Kabore, Abdoul Kader, Klein, Jacques, Bissyande, Tegawendé F.
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911151119400960
author Nikiema, Serge Lionel
Djire, Albérick Euraste
Bonkoungou, Abdoul Aziz
Moumoula, Micheline Bénédicte
Samhi, Jordan
Kabore, Abdoul Kader
Klein, Jacques
Bissyande, Tegawendé F.
author_facet Nikiema, Serge Lionel
Djire, Albérick Euraste
Bonkoungou, Abdoul Aziz
Moumoula, Micheline Bénédicte
Samhi, Jordan
Kabore, Abdoul Kader
Klein, Jacques
Bissyande, Tegawendé F.
contents This research examines how well different methods measure semantic similarity, which is important for various software engineering applications such as code search, API recommendations, automated code reviews, and refactoring tools. While large language models are increasingly used for these similarity assessments, questions remain about whether they truly understand semantic relationships or merely recognize surface patterns. The study tested 18 different similarity measurement approaches, including word-based methods, embedding techniques, LLM-based systems, and structure-aware algorithms. The researchers created a systematic testing framework that applies controlled changes to text and code to evaluate how well each method handles different types of semantic relationships. The results revealed significant issues with commonly used metrics. Some embedding-based methods incorrectly identified semantic opposites as similar up to 99.9 percent of the time, while certain transformer-based approaches occasionally rated opposite meanings as more similar than synonymous ones. The study found that embedding methods' poor performance often stemmed from how they calculate distances; switching from Euclidean distance to cosine similarity improved results by 24 to 66 percent. LLM-based approaches performed better at distinguishing semantic differences, producing low similarity scores (0.00 to 0.29) for genuinely different meanings, compared to embedding methods that incorrectly assigned high scores (0.82 to 0.99) to dissimilar content.
format Preprint
id arxiv_https___arxiv_org_abs_2509_09714
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle How Small Transformation Expose the Weakness of Semantic Similarity Measures
Nikiema, Serge Lionel
Djire, Albérick Euraste
Bonkoungou, Abdoul Aziz
Moumoula, Micheline Bénédicte
Samhi, Jordan
Kabore, Abdoul Kader
Klein, Jacques
Bissyande, Tegawendé F.
Computation and Language
Artificial Intelligence
This research examines how well different methods measure semantic similarity, which is important for various software engineering applications such as code search, API recommendations, automated code reviews, and refactoring tools. While large language models are increasingly used for these similarity assessments, questions remain about whether they truly understand semantic relationships or merely recognize surface patterns. The study tested 18 different similarity measurement approaches, including word-based methods, embedding techniques, LLM-based systems, and structure-aware algorithms. The researchers created a systematic testing framework that applies controlled changes to text and code to evaluate how well each method handles different types of semantic relationships. The results revealed significant issues with commonly used metrics. Some embedding-based methods incorrectly identified semantic opposites as similar up to 99.9 percent of the time, while certain transformer-based approaches occasionally rated opposite meanings as more similar than synonymous ones. The study found that embedding methods' poor performance often stemmed from how they calculate distances; switching from Euclidean distance to cosine similarity improved results by 24 to 66 percent. LLM-based approaches performed better at distinguishing semantic differences, producing low similarity scores (0.00 to 0.29) for genuinely different meanings, compared to embedding methods that incorrectly assigned high scores (0.82 to 0.99) to dissimilar content.
title How Small Transformation Expose the Weakness of Semantic Similarity Measures
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2509.09714