Why not to use Cosine Similarity between Label Representations

📅 2026-03-31
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work demonstrates that the cosine similarity between label representations (unembeddings) in a softmax classifier cannot reliably reflect the model’s output probability distribution. For any given softmax classifier, the authors rigorously prove that one can always construct an equivalent model—exhibiting identical input–output behavior—whose label representations have pairwise cosine similarities of either +1 or −1. Through explicit mathematical construction, theoretical analysis, and empirical validation, the study reveals a fundamental limitation of using cosine similarity to interpret or infer prediction probabilities. Consequently, in both image classification and autoregressive language modeling, reliance on the cosine similarity of label embeddings as a proxy for predictive confidence or semantic relatedness is unwarranted.
📝 Abstract
Cosine similarity is often used to measure the similarity of vectors. These vectors might be the representations of neural network models. However, it is not guaranteed that cosine similarity of model representations will tell us anything about model behaviour. In this paper we show that when using a softmax classifier, be it an image classifier or an autoregressive language model, measuring the cosine similarity between label representations (called unembeddings in the paper) does not give any information on the probabilities assigned by the model. Specifically, we prove that for any softmax classifier model, given two label representations, it is possible to make another model which gives the same probabilities for all labels and inputs, but where the cosine similarity between the representations is now either 1 or -1. We give specific examples of models with very high or low cosine simlarity between representations and show how to we can make equivalent models where the cosine similarity is now -1 or 1. This translation ambiguity can be fixed by centering the label representations, however, labels with representations with low cosine similarity can still have high probability for the same inputs. Fixing the length of the representations still does not give a guarantee that high(or low) cosine similarity will give high(or low) probability to the labels for the same inputs. This means that when working with softmax classifiers, cosine similarity values between label representations should not be used to explain model probabilities.
Problem

Research questions and friction points this paper is trying to address.

cosine similarity
softmax classifier
label representations
model probabilities
representation ambiguity
Innovation

Methods, ideas, or system contributions that make the work stand out.

cosine similarity
softmax classifier
label representations
representation ambiguity
model equivalence
🔎 Similar Papers
No similar papers found.