Unsupervised training data re-weighting for natural language understanding with local distribution approximation (2022)

Abstract: One of the major challenges of training Natural Language Understanding (NLU) production models lies in the discrepancy between the distributions of the offline training data and of the online live data, due to, e.g., biased sampling scheme, cyclic seasonality shifts, annotated training data coming from a variety of different sources, and a changing pool of users. Consequently, the model trained by the offline data is biased. We often observe this problem especially in task-oriented conversational systems, where topics of interest and the characteristics of users using the system change over time. In this paper we propose an unsupervised approach to mitigate the offline training data sampling bias in multiple NLU tasks. We show that a local distribution approximation in the pre-trained embedding space enables the estimation of importance weights for training samples guiding re-sampling for an effective bias mitigation. We illustrate our novel approach using multiple NLU datasets and show improvements obtained without additional annotation, making this a general approach for mitigating effects of sampling bias.

## introduction production natural language understanding (nlu) models are typically trained on the offline annotated data. models learn from the offline data to perform classification on the online live data in production after the model being deployed. the core of voice-controlled assistants, such as google home, amazon alexa, or siri, apply nlu models to perform both intent classification and slot labelling @xcite . for example, the input utterance "set alarm at 9 am", would be classified as "setalarmintent" intent, and the slots "9" and "am" would be labelled as time. in the deployed nlu systems, a distribution mismatch between training and live data is common. some factors contributing to such a mismatch are changes of the live data distribution over time (due to, for example, new users or to seasonal changes), and usage of data from other more or less unrelated tasks to enrich the training data, so called out-of-domain data. the issue with this mismatch in distribution between training and inference time is that models learn a bias towards specific classifications that is not existing at inference time. even if the label distributions are matched, it is still possible that the model will have biased performance, since demographic and speech differences need not perfectly correlate with label distribution, resulting in degraded accuracy and possibly unequal performance across populations @xcite . thus, mitigation of this distribution mismatch is an important step in the development of models. while a common approach of dealing with this kind of bias is manual upsampling of classes in the training data @xcite , this approach is not always optimal, due to the complexity and variation of natural language. data of the same class in a classification task often come from very different forms of language, for example slang vs. formal language. a simple upsampling based on the classes does not mitigate differences in usage of slang during inference time compared with the training data. another difficulty in class based resampling is to get the correct label distribution from the live data in the case that it is missing ground-truth. for example, when a model is deployed, its training data will ideally match the distribution of the current live data, since this is the data the model will be applied to. this current live data distribution will be more similar to recent live data, compared to historical data. however, manually annotating data to obtain the ground-truth labels takes time. thus, during deployment, the training data should match the unannotated live data, and in this case it is only feasible to use bias reduction methods which don't rely on manual annotation. in this work we build on top of importance weighting, which is an approach that has gained traction in other machine learning fields, but until now has found little attention on natural language understanding. we propose a method to assign weights to every individual utterance in a training corpus based on observed live usage of the system, by using utterances' neighbourhood in the embedding space. we choose to find the neighbourhood of utterances with knn and kmeans (in the case of kmeans, each cluster is considered a neighbourhood). we choose these methods due to their easy interpretation: for example, in the kmeans case, one can observe a cluster of utterances, its frequency online and offline, and easily understand why this specific pattern has a high or small weight. the two unsupervised re-weighting based on knn and kmeans are compared with two baselines: keeping the training data as it is (with the distribution mismatch), and, on the other hand, a semi-supervised intent-based approach, in effect class up/down-sampling. we evaluate our methods on both public data and in a deployed commercial nlu system. in the public datasets, we simulate a distribution mismatch by both introducing a label mismatch and also combining different sources of data with different distributions. we show that the unsupervised approaches can better mitigate certain kinds of sampling bias compared to the intent-based approach, while also having the advantage that we can perform re-weighting of the training data without need of annotation: thus our method is suitable for test data with fast-changing distribution. without the need for any labeled data, our unsupervised approaches are generic enough to be applicable to multiple different natural language processing tasks. ## related work the problem of dealing with training data sampling bias in machine learning is well studied. the idea of adjusting training data distribution to meet the distribution at inference time is discussed in @xcite , @xcite and @xcite . these methods however require estimation of biased densities or selection probabilities, which pose a challenge in the real world. similarly in @xcite , to deal with bias in generative models, a classifier is learned to distinguish the data distribution from the generative model. this allows guidance of the generation of additional data to better mimic the existing data. in this work we extend on the work above towards natural language understanding, and focus on the real world problem in which the training data is biased with respect to the unannotated real world application data (live data). in @xcite unsupervised modelagnostic importance weights for every training sample are computed. our unsupervised approach differs from theirs in that we calculate the weights based on the neighbourhood, which makes interpretation of the individual weights easier in the case of natural language data. a closer investigation of importance weighting can also be found in @xcite providing theoretical bounds, as well as in the recent work of @xcite that looks specifically at the application of importance weighting and weight estimation for deep learning tasks. an important difference to these approaches is that they focus on including importance weighting directly into the learning of the models. in our work we focus however solely on the underlying data distribution of utterances, while keeping the estimation model the same. in contrast to importance weighting, another common approach in real world applications is the use of pure upsampling of training utterances for certain classes, based on automatic labelling of the live data. in @xcite the effect of upsampling for certain underrepresented classes is investigated, showing its effectiveness. on the other hand looking at the class distribution alone will also not reduce data bias as described in sec 1, making the requirement of an automatic way of handling different kinds of distribution mismatch more pronounced. ## utterance weight estimation in this section, we describe our approach on how to estimate the weight of each individual utterance in offline training data based on a random sample from online live data. let x represent the random variable of an utterance from online live data, where x follows some distribution p x , denoted as x ∼ p x . let y be the random variable of true labels of x, where y follows some distribution p y , denoted as y ∼ p y . also, let x and y be the corresponding random variables of x and y in offline data, where x ∼ p x and y ∼ p y . the issue we aim to resolve is that typically p @xmath0 analysing the difference in distributions of utterances p x and p x is particularly challenging in nlp because the different surface forms of utterances do not necessarily imply the semantic difference in classification tasks. however, due to the advance of natural language embeddings, we are now able to efficiently approximate the local distributions over the semantic meanings of text which allows the estimation of p x and p x . specifically, we propose to approximate the difference of local distributions in offline and online utterances summarized as follows: ## experiments in our experiments we evaluated our methods on multiple different nlu datasets to verify the feasibility of the approach. ## conclusion and future work in this work, we showed how the reweighting of training data using local distribution approximation helps in mitigating sampling bias in natural language understanding production models. we simulated the bias in public training datasets to mimic real world application scenarios in which different data sources are used, and they each come from different distributions. we reweighted utterances based on the approximation of local distribution to minimise the mismatch between the training and online live traffic data. the simplicity of our approach, and the fact that it does not require manual or machine annotation, means that it can be used to quickly adapt the training data to the ever-changing live data in deployed models. experiments in both a commercial dataset and two public datasets have shown that our approach can mitigate the mismatch and bias in training data without additional manual tuning. in the future, we want to experiment the combined impact of our method with different data augmentation techniques, study the impact on fairness across populations, as well as bias detection methods to trigger the reweighting model.