On Isotropy Calibration of Transformer Models (2022)

Abstract: Different studies of the embedding space of transformer models suggest that the distribution of contextual representations is highly anisotropic - the embeddings are distributed in a narrow cone. Meanwhile, static word representations (e.g., Word2Vec or GloVe) have been shown to benefit from isotropic spaces. Therefore, previous work has developed methods to calibrate the embedding space of transformers in order to ensure isotropy. However, a recent study (Cai et al. 2021) shows that the embedding space of transformers is locally isotropic, which suggests that these models are already capable of exploiting the expressive capacity of their embedding space. In this work, we conduct an empirical evaluation of state-of-the-art methods for isotropy calibration on transformers and find that they do not provide consistent improvements across models and tasks. These results support the thesis that, given the local isotropy, transformers do not benefit from additional isotropy calibration.

## introduction the impressive performance of transformer models @xcite across almost all areas of natural language processing (nlp) has sparked indepth investigations of these models. a remarkable finding is that the contextual representations computed by transformers are strongly anistropic (ethayarajh, 2019), i.e., they are unevenly distributed and localized in a narrow cone of the embedding space. this discovery, labeled as the representation degeneration problem by @xcite is surprising since it suggests that most of the expressive capacity of these high-dimensional spaces is neglected by transformers. furthermore, previous work on static word representations, e.g., glove @xcite or word2vec @xcite , established that * first three authors in alphabetic order isotropy is a desirable property in non-contextual embedding spaces @xcite . indeed, @xcite and @xcite showed that post-processing static word embeddings in order to increase isotropy improves their performance in downstream tasks. based on these results, recent work has developed methods to correct the anisotropy of the contextual representations generated by transformers @xcite @xcite . these isotropy calibration methods have been reported to produce small gains in performance on some nlp tasks. however, in a recent study, @xcite show that the space of contextual embeddings of transformers is locally isotropic. by analyzing low dimensional sub-spaces the authors identify isolated clusters and manifolds and argue that isotropy does exist in these manifolds. in the same line, @xcite and @xcite find that in bert @xcite almost all of the embeddings present large values in the same two components of the embedding vector. these large components distort our understanding of the embedding spaces by making all the representations have high cosine similarity. in this work, we perform an extensive empirical evaluation of isotropy calibration methods across different tasks and models to determine if they provide consistent improvements. our results question the utility of isotropy calibration in transformers, implicitly supporting the argument that transformers do already benefit from local isotropy @xcite . ## related work since the appearance of the transformer architecture and its multiple variants, of which bert @xcite stands out as the most researched model, a lot of effort has been devoted to understanding their inner workings @xcite . unlike static word embeddings such as glove or word2vec, transformers build contextual embed-dings, i.e., dynamic representations that aggregate information from other context words. these representations have sparked a lot of research interest. @xcite showed that different transformer architectures produce similar contextual representations. @xcite studied the similarity and relatedness of contextual representations in the embedding spaces of bert, while @xcite studied how identifiable the intermediate representations of bert are with respect to the input. @xcite quantified the contextual knowledge of @xcite analyzed the embedding spaces of bert in order to quantify the non-linearity of its layers. following the discovery of anisotropy in transformers @xcite , different isotropy calibration methods have been developed to correct this phenomenon. @xcite and @xcite introduced regularization objectives that affect the embedding distances. @xcite presented a module inspired by batch-norm that regularizes the embeddings towards isotropic representations. @xcite proposed to control the singular value decay of the output layer of transformers and @xcite used normalizing flows to map transformer embeddings to an isotropic space. however, @xcite show that contextual representations are locally isotropic and suggest that this property allows transformers to exploit their full expressive capacity, questioning the utility of isotropy calibration. ## isotropy calibration methods the output distribution of transformers is typically parameterized as a softmax function: spectrum control. @xcite increase isotropy by mitigating the fast decay of the singular value distribution of the output matrix w . they decompose w using singular value decomposition (svd), such that @xmath0, where σ ∈ r d×d is the diagonal matrix of singular values. then, they add a regularization term to guide the singular value distribution towards a prespecified slow-decaying prior distribution. this term spreads the variance away from the first few dominating singular values, increasing the isotropy of the space. they propose the following two regularization terms: for exponential decay, where λ e , λ p , c 1 and c 2 are regularization constants, σ k is the k-th largest singular value and γ is a parameter which controls the rate of singular value decay. flow model. @xcite propose a method that leverages normalizing flows to learn an invertible mapping f -1 φ between the embedding space of the transformer model and an isotropic (gaussian) space z. first, an invertible flow model (kingma and dhariwal, 2018) f φ is trained to generate transformer embedding vectors h from gaussian noise z: z ∼ p z (z), @xmath1. then, the model f φ is inverted to map transformer embeddings h to the new (and isotropic) output embedding space z. ## experiments we evaluate the impact of each of these calibration methods on state-of-the-art transformer models in three prominent areas of natural language processing: language understanding, machine translation, and summarization. for all of the models, we use the implementation and fine-tuning parameters from huggingface @xcite (cf. appendix b). we run each experiment three times and report the mean and standard deviation. finetuning time is reported on a nvidia titan rtx gpu. to characterize the isotropy of the output embedding space we adopt the i 1 and i 2 isotropy measures from @xcite , with i 1 (w ) ∈ [0, 1] and i 2 (w ) ≥ 0. larger i 1 (w ) and smaller i 2 (w ) indicate more isotropic embeddings (cf. app. a for details). ## discussion our extensive evaluation shows that none of the considered isotropy calibration methods produce consistent improvements over the uncalibrated models across tasks, domains and architectures. in fact, we observe a negative relation between isotropy calibration and downstream performance. the most aggressive method, i.e., spectrum control, produces the largest improvement in isotropy according to @xcite , the local isotropy of the embedding space of transformers may enable them to exploit their full expressive capacity. furthermore, concurrent findings by @xcite and @xcite reveal that certain components of the contextual embeddings consistently present very large magnitudes, which distort the cosine distances in the embedding space and questions their anisotropy. this could explain why additional isotropy calibration does not consistently improve the performance of transformers in downstream tasks. in light of our results, we discourage isotropy calibration of transformers as a means of improving downstream performance. however, we believe that further investigation of the embedding space of transformers may be beneficial to increase our ability to interpret these models and improve their architecture.