Cosine similarity is a metric that measures the cosine of the angle between two non-zero vectors in an inner product space, quantifying their directional similarity irrespective of magnitude. In AI, it is the primary method for gauging semantic similarity between text or data embeddings, where a value of 1 indicates identical direction, 0 indicates orthogonality (no similarity), and -1 indicates opposite direction. This property makes it ideal for comparing high-dimensional vectors from models like BERT or GPT, where the vector's direction encodes meaning.
