Anisotropy Decides Cosine vs. Rank Metrics for Text Embeddings

· Source: Takara TLDR - Daily AI Papers · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Data Science & Analytics · Depth: Advanced, quick

Summary

A comprehensive empirical study investigated nineteen parameter-free similarity metrics across nineteen text encoders, ranging from compact sentence transformers to seven-billion-parameter large language models, on seven datasets. The research definitively establishes that the geometric property of anisotropy dictates the optimal metric choice for comparing text embeddings. When an encoder's variance is evenly distributed, cosine similarity is the best parameter-free option. However, if variance concentrates into a few dominant directions (anisotropy), rank-based and L1-type metrics significantly outperform cosine, yielding around a twenty percent relative improvement where cosine is weakest. This effect is driven by the embedding space's geometry, not the model's training. A single diagnostic number, the fraction of variance held by the most dominant dimension, accurately predicts the utility of alternative metrics, showing a 0.86 rank correlation and 0.95 linear correlation.

Key takeaway

For Machine Learning Engineers deploying text embedding models, your choice of similarity metric should not default to cosine. If you are working with encoders exhibiting high anisotropy, diagnose this using the provided one-number variance diagnostic. Switching to rank-based or L1-type metrics can yield a significant relative performance improvement, especially where cosine is weakest. Conversely, for well-spread, fine-tuned embedders, cosine remains the appropriate and effective tool.

Key insights

Anisotropy in text embedding spaces determines whether cosine or rank-based metrics are optimal for similarity comparisons.

Principles

Method

Calculate the fraction of variance held by the most dominant dimension as a predictive diagnostic for metric utility.

In practice

Topics

Best for: Research Scientist, AI Engineer, AI Scientist, Machine Learning Engineer, NLP Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Takara TLDR - Daily AI Papers.