Language Model Decomposition: Quantifying the Dependency and Correlation of Language Models (2022)

Abstract: Pre-trained language models (LMs), such as BERT (Devlin et al., 2018) and its variants, have led to significant improvements on various NLP tasks in past years. However, a theoretical framework for studying their relationships is still missing. In this paper, we fill this gap by investigating the linear dependency between pre-trained LMs. The linear dependency of LMs is defined analogously to the linear dependency of vectors. We propose Language Model Decomposition (LMD) to represent a LM using a linear combination of other LMs as basis, and derive the closed-form solution. A goodness-of-fit metric for LMD similar to the coefficient of determination is defined and used to measure the linear dependency of a set of LMs. In experiments, we find that BERT and eleven (11) BERT-like LMs are 91% linearly dependent. This observation suggests that current state-of-the-art (SOTA) LMs are highly “correlated”. To further advance SOTA we need more diverse and novel LMs that are less dependent on existing LMs.

## introduction large-scale pre-trained language models (lms) have pushed state-of-the-art (sota) of nlp recently @xcite . following bert @xcite , many variants and improvements have been proposed since then. they differ from bert in various aspects, in terms of training data @xcite , multilingual support @xcite , model size @xcite , pre-training objective @xcite , model architecture @xcite , attention structure @xcite , and sequence length @xcite . however, to the best of our knowledge, their relationships have not been studied from a mathematical perspective at the time of writing this paper. in this work, we present a quantitative frame-work for studying lm dependency and correlation. conceptually, we view lm (e.g., encoders like bert @xcite ) as a vector-valued function (or random vector) u(x) : ω → r d , where x is text sequence from the sequence space ω, and r d is the sequence embedding space. sequence embedding is defined as the mean pooling of the last layer's token embeddings. we define linear combination and dependency of lms analogously to vectors/functions, and based upon these definitions we propose the language model decomposition (lmd) algorithm to analyze the linear dependency of lms. a goodness-of-fit metric is defined for lmd to quantify the linear dependency and correlation of lms. in experiments, we find bert and its successors are highly linearly dependent. theoretically, the linear dependency between lms implies redundancy, since they can be represented by each other. practically, it simply means building more redundant lms do not bring in new knowledge. if lms are more linearly independent, we can potentially distill more knowledge @xcite from multiple diverse models, and combine them to create more powerful models. the contributions of this paper are: (1) we formalize the notion of linear dependency for lms, and propose language model decomposition (lmd) to study linear dependency; (2) we define an universal metric based on lmd to quantify the dependency and correlation of lms. (3) our experiments reveal that bert and its variants are 91% "correlated", suggesting current sota lms are highly redundant. the code is available at https://github.com/haozhg/lmd . ## limitations in our preliminary experiments, we study encoder lms similar to bert. it is worthwhile to inves-tigate other types of pre-trained lms, including encoder-decoder lms (e.g, t5 @xcite , bart @xcite ), decoder lms (e.g, gpt-2 @xcite ), pre-bert models (e.g, elmo @xcite , ulmfit @xcite ), and even domain-specific lms (e.g, finbert @xcite ). the proposed "dependency" and "correlation" measures quantify the "similarity" between lms, but there are still open questions related to interpretation. wikipedia and bookscorpus are used in our experiments, while the results on a "neutral dataset" (such as a large corpus that is not used in the pre-training of any of the lms) are also worth examination. we have chosen the mean pooling of the last layers embedding as the text sequence embedding because it is commonly used for many downstream tasks. this choice makes the lmd algorithm model agnostic, meaning that it treats lm as a black box. it only requires the final sequence embedding, but not the intermediate representations. however, for other task, the token level embedding is very important (e.g, determining the start and end location of the answer for question-answering). therefore, layer-wise and token-level (including the [cls] and [mask] token) "correlation" is of interest as well, and further research is needed.