TL;DR
This paper introduces IsoScore, a novel metric for quantifying how uniformly word embeddings utilize the dimensions of their vector space. Existing methods for measuring "isotropy" are shown to be flawed, leading to misleading conclusions about embedding models. IsoScore provides a more robust and mathematically sound measure, revealing that many contextualized embeddings utilize fewer dimensions than previously thought.
What Problem Does This Paper Address?
Natural language processing models represent words and sentences as vectors in high-dimensional spaces. Understanding how these vectors are distributed within this space is crucial for analyzing model behavior and performance. Previous research has suggested that contextualized word embeddings (like those from BERT or GPT) don't use all dimensions of their vector space uniformly, often forming "narrow cones." However, the methods used to measure this "anisotropy" (lack of uniformity) have been shown to be unreliable. These existing metrics, such as average random cosine similarity and partition score, are susceptible to issues like data mean and scalar changes, leading to inaccurate conclusions about the uniformity of embedding space utilization. The paper aims to address this by proposing a new, rigorous metric that accurately measures this uniformity.
Methods
The core contribution is the introduction of IsoScore, a novel metric designed to quantify the degree to which a point cloud (representing word embeddings) uniformly utilizes the ambient vector space. The IsoScore calculation involves several key steps:
- PCA-reorientation: The data is transformed using Principal Component Analysis (PCA) to align axes with directions of maximum variance, making the covariance matrix diagonal and eliminating correlations between dimensions.
- Variance Vector Calculation: The diagonal elements of the reoriented covariance matrix (representing variances along each dimension) are extracted.
- Normalization: The variance vector is normalized to have a specific Euclidean norm.
- Isotropy Defect Calculation: A metric called the "isotropy defect" is computed, measuring the deviation of the normalized variance vector from the identity vector (which represents perfect uniformity).
- IsoScore Calculation: The isotropy defect is then transformed into the final IsoScore, which ranges from 0 (perfectly anisotropic) to 1 (perfectly isotropic).
The paper also rigorously defines essential properties that any isotropy measure should possess (mean-agnostic, rotation-invariant, etc.) and empirically tests existing methods against these properties, demonstrating their shortcomings.
Datasets
The paper does not introduce new datasets. Instead, it uses existing datasets and models for evaluation:
- WikiText-2 corpus: Used to generate word embeddings from models like GPT, GPT-2, BERT, and DistilBERT.
- Synthetic data: Various synthetic point clouds (e.g., Gaussians with different means, covariances, and dimensions) are generated to test the essential properties of isotropy metrics.
Key Insights and Ideas
- Existing isotropy metrics are flawed: Average random cosine similarity and partition score are shown to be highly sensitive to the mean of the data, leading to false conclusions of isotropy when data is zero-meaned.
- IsoScore is mathematically grounded: IsoScore is derived directly from the mathematical definition of isotropy (uniform variance across dimensions) and is designed to satisfy essential properties like mean-agnosticism and rotation invariance.
- Contextualized embeddings utilize fewer dimensions than thought: Applying IsoScore to models like BERT and GPT reveals that they utilize significantly fewer dimensions than previously reported by studies using flawed metrics.
- "Narrow cone" hypothesis may be misleading: The paper suggests that the observed "narrow cones" in embedding spaces might not be as anisotropic as previously claimed, and that the geometry of isotropic spaces can vary.
- Importance of sample size: The paper highlights that for accurate cosine similarity calculations, the number of sampled pairs needs to be orders of magnitude larger than the embedding dimension.
Key Results
- IsoScore outperforms existing metrics: Through extensive testing against essential properties (mean invariance, scalar covariance invariance, maximum variance, rotation invariance, dimensions used, global stability), IsoScore is shown to be the only metric that consistently satisfies all criteria. Existing metrics fail on multiple fronts.
- GPT and BERT embeddings are highly anisotropic: IsoScore values for layers of GPT, GPT-2, BERT, and DistilBERT are consistently low (often below 0.18), indicating that these models do not utilize their embedding spaces uniformly, even in their deepest layers.
- Challenging prior conclusions: The paper re-evaluates previous claims about isotropy and performance, suggesting that many conclusions derived from brittle metrics are inaccurate. For instance, the claim that deeper layers are less isotropic is not supported by IsoScore.
Limitations and Future Work
- Computational cost: While an efficient Python implementation is shared, computing IsoScore for very large datasets might still be computationally intensive.
- Interpretation of "fraction of dimensions utilized": The paper provides heuristics for interpreting IsoScore values, but understanding the precise geometric implications of a specific IsoScore value (e.g., 0.5) can still be nuanced.
- Future Work:
- Investigating whether decreasing isotropy could improve performance in certain tasks, particularly in language modeling.
- Using IsoScore as a regularizer during fine-tuning of word embeddings to penalize anisotropic distributions.
- Applying IsoScore to other domains beyond NLP where point clouds are used, such as computer vision or recommendation systems.
Summary updated