ContraSim – Analyzing Neural Representations Based on Contrastive Learning

Adir Rahamim, Yonatan Belinkov


Abstract
Recent work has compared neural network representations via similarity-based analyses to improve model interpretation. The quality of a similarity measure is typically evaluated by its success in assigning a high score to representations that are expected to be matched. However, existing similarity measures perform mediocrely on standard benchmarks. In this work, we develop a new similarity measure, dubbed ContraSim, based on contrastive learning. In contrast to common closed-form similarity measures, ContraSim learns a parameterized measure by using both similar and dissimilar examples. We perform an extensive experimental evaluation of our method, with both language and vision models, on the standard layer prediction benchmark and two new benchmarks that we introduce: the multilingual benchmark and the image–caption benchmark. In all cases, ContraSim achieves much higher accuracy than previous similarity measures, even when presented with challenging examples. Finally, ContraSim is more suitable for the analysis of neural networks, revealing new insights not captured by previous measures.
Anthology ID:
2024.naacl-long.350
Volume:
Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers)
Month:
June
Year:
2024
Address:
Mexico City, Mexico
Editors:
Kevin Duh, Helena Gomez, Steven Bethard
Venue:
NAACL
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
6325–6339
Language:
URL:
https://aclanthology.org/2024.naacl-long.350
DOI:
Bibkey:
Cite (ACL):
Adir Rahamim and Yonatan Belinkov. 2024. ContraSim – Analyzing Neural Representations Based on Contrastive Learning. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 6325–6339, Mexico City, Mexico. Association for Computational Linguistics.
Cite (Informal):
ContraSim – Analyzing Neural Representations Based on Contrastive Learning (Rahamim & Belinkov, NAACL 2024)
Copy Citation:
PDF:
https://aclanthology.org/2024.naacl-long.350.pdf
Copyright:
 2024.naacl-long.350.copyright.pdf