Language Model Evaluation Beyond Perplexity (2021)

Abstract: We propose an alternate approach to quantifying how well language models learn natural language: we ask how well they match the statistical tendencies of natural language. To answer this question, we analyze whether text generated from language models exhibits the statistical tendencies present in the human-generated text on which they were trained. We provide a framework–paired with significance tests–for evaluating the fit of language models to these trends. We find that neural language models appear to learn only a subset of the tendencies considered, but align much more closely with empirical trends than proposed theoretical distributions (when present). Further, the fit to different distributions is highly-dependent on both model architecture and generation strategy. As concrete examples, text generated under the nucleus sampling scheme adheres more closely to the type–token relationship of natural language than text produced using standard ancestral sampling; text from LSTMs reflects the natural language distributions over length, stopwords, and symbols surprisingly well.

## introduction neural language models foot_0 have become shockingly good at modeling natural language data in recent years @xcite @xcite . thus, to test just how well neural language models capture language nlp researchers have started to look beyond standard evaluation metrics such as perplexity, endeavoring to understand which underlying attributes of human language these models are learning. to this end, a nascent literature has emerged that focuses on probing language models (belinkov and glass, 2019), i.e., determining whether models encode linguistic phenomena. for the most part, these works have been limited to analyses of sentence-level phenomenon, such as subject-verb agreement @xcite and garden path effects @xcite among a myriad of other properties @xcite . in this work, we attempt to understand which macro-level phenomena of human language today's language models reflect. that is, we pose the question: do neural language models exhibit the statistical tendencies of human language? phenomena that can be measured at this level provide an alternate view of a model's comprehension; for example, rather than exploring whether morphological agreement is captured, we look at whether our models learn the trends across a corpus as a whole, e.g., the token rank-frequency (zipf's) relationship. in comparison to standard probing techniques, this framework does not require we know a priori how linguistic phenomena should manifest themselves. that is, when there is no law stating the theoretical tendencies of an attribute of natural language or we have reason to believe our language domain does not follow such a law, we can use the statistical tendencies present in empirical data as our baseline. this characteristic both allows us to assess a model's fit to highly corpus-dependent distributions-like the length distribution-and mitigates the biases introduced by our own preconceptions regarding properties of natural language. 2 more concretely, our paper describes an experimental design and accompanying hypothesis tests to determine precisely whether text generated from language models follows the same empirical trends as human language. our experiments reveal that adherence to natural language tendencies varies widely with both model architecture and generation strategy, e.g., fig. 1 shows varying degrees of adherence to the empirical type-token relationship, an artifact that perplexity alone could not reveal. our findings suggest this framework is a valuable tool for gaining a deeper understanding of where today's language models are succeeding and failing at capturing human language. ## language models language models are probability distributions over natural language sentences. we define the support of a language model p ✓ with parameters ✓ as in the case when p ✓ is locally normalized, which is the predominant case for language models, p ✓ is defined as the product of probability distributions: ## statistical tendencies of language human languages are thought to exhibit statistical tendencies, several of which are explicitly quantified by laws @xcite . in this section, we review a subset of these distributionsboth with and without well-established formsover which we subsequently perform analyses. ## statistical distances in this work, we aim to quantify the degree to which the linguistic distributions of text generated from language models match-or differ from-those of natural language. to this end, we propose the use of several probability metrics @xcite as our notion of statistical distance. 4 for each of these metrics, we present nonparametric statistical significance tests, i.e., tests that may be used when the underlying distribution of observed data is not known. ## experiments we use the above framework to assess the degree to which language models learn various distributions of natural language, i.e., we report metrics outlined in §4 measured over the distributions and quantities defined in §3. we compare samples generated from language models to a reserved test set taken from the same corpus as the model's training data. each set contains 1 million samples. 8 we tokenize all samples using the moses decoder toolkit @xcite . all text is lower-cased and only complete unigrams are considered, i.e., when bpe is used, only the detokenized unigram is considered. length of a string is computed as the number of tokens separated by whitespace. note that when reporting the ks metric (d), we always report the metric between (a) an empirical cdf computed over the respective model-generated samples and (b) a reference cdf, where d p indicates direct comparison with empirical cdf of the test set. d p ✓ and d p indicate comparison with cdfs of a parametric distribution, whose parameters are estimated on the model and test set, respectively. natural language corpus. we use english wikipedia dumps, foot_8 preprocessing data following the steps used for xlm @xcite albeit with a 44.7e6 train-1e4 valid-1e6 test split. the test set is used in all statistical tests, however, we estimate standard deviations for statistics in tab. 4 (in the appendix) using samples from the training set; see this table for e.g., parameter estimates over test set. ## related work in the last few years, a number of works have extended language model analysis beyond simple p-values (estimated using monte carlo simulations @xcite ) for all ks metrics are ⌧ 0.001. these approaches have drawbacks; for example, introducing a secondary model to determine what the original model has learned presents confounding factors @xcite . the designing of auxiliary tasks for assessing linguistic knowledge requires large manual effort and lends itself to implicit bias about how linguistic phenomena should manifest. in contrast, our work allows us to take a hands-off approach to analyzing language models. we see the benefit of this in §5, where our results without an assumed model of statistical tendencies give us a much different sense of which empirical properties of human-generated text our models have learned. our work is closest to that of @xcite who use model generated text to visually analyze whether language models reflect well-established statistical tendencies. in contrast, our work provides a quantitative framework, along with appropriate significance tests, 16 for evaluating distribution fits. we additionally assess the fit of language models to our test set directly, rather than solely to established laws. further, our analysis includes different generation strategies, multiple neural architectures, and a wider variety of empirical language distributions. ## conclusion and future directions in this work, we present a framework for determining the linguistic properties learned by language models through analysis of statistical trends in generated text. we find that neural language models accurately capture only a subset of natural language distributions and that this subset is highly dependent on both model architecture and generation strategy; no one configuration stands out as capturing all linguistic distributions. ultimately, we see this analysis framework as a means for a more finegrained evaluation of language models than perplexity alone can provide. uncovering which linguistic properties language models have learnedand which they have not-should help us to understand both the inductive biases of various models and via which avenues they can still be improved. there are a number of important axes of variation that this work does not explore: perhaps most importantly, our results are limited to a single corpora in the english language. a cross-linguistic analysis may reveal whether different model architectures exhibit inductive biases compatible with different languages; observing how these metrics change as a function of corpus size would have implications about the effects of data availability. an exploration of the correlation of these metrics with other quantifications of model performance, such as perplexity or a model's ability to capture sentence level phenomenon, may help us understand how comprehensive other evaluation metrics are. we leave these analyses as future work.