CLSep 17, 2024

Norm of Mean Contextualized Embeddings Determines their Variance

arXiv:2409.11253v220 citationsh-index: 6
AI Analysis

This work provides incremental insights into embedding behavior for researchers studying representation learning in NLP, particularly regarding variance and anisotropy in Transformer models.

The study analyzed the distribution of contextualized embeddings in Transformer models, finding a strong trade-off where the norm of the mean embedding decreases as variance increases, influenced by layer normalization, and showed that deeper layers increase within-cluster variance while decreasing between-cluster variance, aligning with known anisotropy patterns.

Contextualized embeddings vary by context, even for the same token, and form a distribution in the embedding space. To analyze this distribution, we focus on the norm of the mean embedding and the variance of the embeddings. In this study, we first demonstrate that these values follow the well-known formula for variance in statistics and provide an efficient sequential computation method. Then, by observing embeddings from intermediate layers of several Transformer models, we found a strong trade-off relationship between the norm and the variance: as the mean embedding becomes closer to the origin, the variance increases. This trade-off is likely influenced by the layer normalization mechanism used in Transformer models. Furthermore, when the sets of token embeddings are treated as clusters, we show that the variance of the entire embedding set can theoretically be decomposed into the within-cluster variance and the between-cluster variance. We found experimentally that as the layers of Transformer models deepen, the embeddings move farther from the origin, the between-cluster variance relatively decreases, and the within-cluster variance relatively increases. These results are consistent with existing studies on the anisotropy of the embedding spaces across layers.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes