Characterizing and Measuring Linguistic Dataset Drift (2023)

Abstract: NLP models often degrade in performance when real world data distributions differ markedly from training data. However, existing dataset drift metrics in NLP have generally not considered specific dimensions of linguistic drift that affect model performance, and they have not been validated in their ability to predict model performance at the individual example level, where such metrics are often used in practice. In this paper, we propose three dimensions of linguistic dataset drift: vocabulary, structural, and semantic drift. These dimensions correspond to content word frequency divergences, syntactic divergences, and meaning changes not captured by word frequencies (e.g. lexical semantic change). We propose interpretable metrics for all three drift dimensions, and we modify past performance prediction methods to predict model performance at both the example and dataset level for English sentiment classification and natural language inference. We find that our drift metrics are more effective than previous metrics at predicting out-of-domain model accuracies (mean 16.8% root mean square error decrease), particularly when compared to popular fine-tuned embedding distances (mean 47.7% error decrease). Fine-tuned embedding distances are much more effective at ranking individual examples by expected performance, but decomposing into vocabulary, structural, and semantic drift produces the best example rankings of all considered model-agnostic drift metrics (mean 6.7% ROC AUC increase).

## introduction dataset drift, when test data distributions differ from a model's training data, can have detrimental effects on nlp model performance @xcite @xcite . in real world scenarios, models are regularly monitored for potential performance degradations by comparing incoming test data with the training data @xcite . for these scenarios, researchers have proposed a variety of linguistic dataset drift metrics that aim to predict nlp model performance degradations between training and test domains @xcite . however, previous drift metrics and performance predictions suffer from several limitations. first, previous metrics have generally been designed as holistic measures of linguistic dataset drift, despite the fact that different nlp tasks and models might be sensitive to different dimensions of linguistic drift. second, previous research has focused on drift metrics at the dataset level rather than the individual example level. not only does this require multiple labeled evaluation domain datasets to make out-of-domain performance predictions (regressions require multiple dataset-level drift values to fit to; @xcite , but drift metrics are often used in practice to predict model performance when individual real world examples are streamed in real time @xcite . we seek to overcome both of these limitations by proposing and evaluating specific dimensions of linguistic drift, predicting out-of-domain model performance at both the individual example level and the dataset level. specifically, we propose three dimensions of linguistic dataset drift along with corresponding drift metrics: vocabulary, structural, and semantic drift. because these dimensions capture distinct features that could have different effects on the performance of an nlp model, we hypothesize that decomposing into these three dimensions will allow nlp performance prediction models to better predict model performance on novel data. indeed, when compared to previous model-agnostic drift metrics predicting performance on english sentiment classification and natural language inference (nli), our metrics produce both improved predictions of dataset-level accuracies and improved rankings of individual examples by expected performance, for both in-domain and out-of-domain data (mean 16.8% accuracy root mean square error decrease, mean 6.7% roc area under the curve increase). although we find that previously-proposed finetuned embedding distances @xcite are far more effective at ranking individual examples by expected performance, those distances are extremely ineffective at predicting actual model accuracies. we conclude that decomposing linguistic drift into vocabulary, structural, and semantic drift is an effective approach for predicting out-ofdomain model accuracy, and for ranking individual examples when model-agnostic metrics are desired. ## related work past work has quantified the drift between nlp datasets using distances between token frequency distributions or tf-idf vectors @xcite @xcite , language model embedding distances @xcite , or the ability of domain classifiers to discriminate between datasets @xcite @xcite . notably, ramesh @xcite find that these metrics can predict performance degradations when an nlp model is transferred from a training dataset d train to an outof-domain evaluation dataset d eval . however, existing metrics have generally been designed as holistic measures of linguistic drift, failing to capture specific dimensions that might affect nlp model performance in different ways. furthermore, the traditional setup for evaluating drift metrics @xcite only allows for dataset-level drift metrics that predict overall model accuracy on out-of-domain datasets. in practice, when real world examples are streamed during test time, it is desirable to predict model performance for individual examples using example-level drift metrics (i.e. drift between an example x and a training dataset d train ; @xcite . in our work, we modify the setup from ramesh @xcite to predict performance for individual examples (section 4), using logistic regressions fitted to example-level drift metrics. in contrast to ramesh @xcite , we can fit our regressions to predict outof-domain performance even when only a single in-domain evaluation dataset is available. ## dimensions of linguistic drift as described above, previous measures of dataset drift in nlp suffer from (1) lack of specificity and (2) lack of validation at the example level, where such metrics are often used in practice. first, we address the lack of specificity by proposing three dimensions of linguistic dataset drift: vocabulary, structural, and semantic drift. as in previous work, we primarily focus on domain drift, i.e. divergence in the input probabilities p (x) rather than the joint probabilities over inputs and labels p (x, y). for each of our proposed drift dimensions, we propose a metric that quantifies the drift between an evaluation example x and a training dataset d train , allowing us to use our metrics to predict examplelevel model performance. we evaluate our metrics empirically in section 4. ## experiments previous work has evaluated drift metrics by assessing their ability to predict out-of-domain model performance at the dataset-level using dataset-level metrics (e.g. ramesh kashyap et al., 2021; section 2). we extend this work by predicting individual example-level performance (probabilities of getting individual examples correct) along with datasetlevel accuracies, using drift metrics between each 2 we exclude non-content tokens for lexical semantic change because non-content token embeddings (e.g. for function words and punctuation) are more likely to encode structural drift information rather than lexical semantic change. contextualized token embeddings are computed as the mean of the token representations in the last two roberta layers before fine-tuning @xcite . example x and the training dataset d train . using these example-level metrics instead of datasetlevel metrics allows us to fit regressions predicting model performance using only a set of examples (e.g. using only the in-domain evaluation set), rather than a set of multiple evaluation datasets covering different domains. thus, our approach can be used in common real world scenarios where labeled data is available only in one domain. in our experiments, we compare previous drift metrics with our proposed metrics for vocabulary, structural, and semantic drift, evaluating whether decomposing linguistic drift into these three dimensions improves nlp model performance predictions. foot_0 ## discussion we find that decomposing linguistic dataset drift into our proposed vocabulary, structural, and semantic drift metrics leads to improved out-ofdomain dataset-level accuracy predictions for sentiment classification and nli. furthermore, our decomposed drift metrics produce better rankings of individual examples by expected performance than previous model-agnostic drift metrics (e.g. token frequency divergences and pre-trained embedding distances), both in-domain and out-of-domain. although fine-tuned embedding distances produce by far the best example rankings, they also produce egregiously incorrect out-of-domain model accuracy predictions. our results suggest that fine-tuned embedding distances should still be used in cases where examples need to be ranked by expected performance (e.g. relative to a cutoff value, as in @xcite . vocabulary, structural, and semantic drift should be used in cases where either (1) the internal states of a model are unavailable, which is increasingly common as models are accessed through external apis, (2) the same metric values need to be applied across multiple models (i.e. model-agnostic metrics), or (3) raw model accuracy predictions are desired. our work also opens up future directions of research studying specific effects of linguistic dataset drift on nlp model performance. first, future work might assess whether there are systematic effects of particular drift dimensions on specific tasks or model architectures. second, it might consider new types of linguistic drift, potentially extending beyond domain drift (drift in p (x)) to consider concept drift p (y|x) in nlp @xcite . finally, future work might investigate methods of quantifying drift in natural language generation, where the outputs y are linguistic data. our work lays the groundwork for these future investigations. ## conclusion we propose three dimensions of linguistic dataset drift-vocabulary, structural, and semantic driftand we modify previous performance prediction methods to predict nlp model performance at the individual example level along with the dataset level. we validate existing drift metrics for particular use cases (e.g. fine-tuned embedding distances for example ranking), and we highlight complementary use cases where our decomposed drift metrics outperform previous metrics (e.g. when predicting model accuracies or when using model-agnostic metrics). our work lays the foundation for future research into specific and interpretable dimensions of linguistic dataset drift, improving our ability to predict nlp model performance on real world data.