Regression Bugs Are In Your Model! Measuring, Reducing and Analyzing Regressions In NLP Model Updates (2021)

Abstract: Behavior of deep neural networks can be inconsistent between different versions. Regressions during model update are a common cause of concern that often over-weigh the benefits in accuracy or efficiency gain. This work focuses on quantifying, reducing and analyzing regression errors in the NLP model updates. Using negative flip rate as regression measure, we show that regression has a prevalent presence across tasks in the GLUE benchmark. We formulate the regression-free model updates into a constrained optimization problem, and further reduce it into a relaxed form which can be approximately optimized through knowledge distillation training method. We empirically analyze how model ensemble reduces regression. Finally, we conduct CheckList behavioral testing to understand the distribution of regressions across linguistic phenomena, and the efficacy of ensemble and distillation methods.

## introduction regression-free model update is a desirable system property which guarantees interoperability of a new system with a legacy version, also known as backward compatibility. regression occurs when the newly updated system stops functioning as intended. as advances in deep learning spark industrial applications in ai areas such as natural language processing, the long-term maintenance of such systems is becoming ever more challenging. while models with complex neural architectures and huge parameter space continue to reach higher accuracy, the lack of interpretability and functional decomposibility in these models make it infeasible to apply traditional software regression testing methods such as unit tests. as result, validating and mitigating regressions during model update is often a long and painful engineering process, which often over-shadows the benefits of a new model. the model regression issue in deep learning first comes into sight in @xcite , where they inspect compatible representation learning for image retrieval. @xcite proposed the positive-congruent training (pct) for image classification that minimizes prediction errors and model regression at the same time. to our best knowledge, the model update regression has not been studied on nlp tasks. following @xcite , in this work we measure the model update regression in nlp by negative flips. in figure 1 , we demonstrate prediction flip scenarios. negative flips are shown in the upper-right quadrant where the old model makes correct predictions and the new model predictions are wrong. as we will show in section 2, regression are prevalent in nlu model updates even with the slightest changes in the new model training process. to develop a model with minimum regression, we first formulate the learning task into a constrained optimization problem by taking the regression-free conditions as constraints. we apply the lagrangian relaxation to bring the regressionfree constraint into the optimization objective as an additional penalty loss, and provide approximate solution via knowledge distillation. @xcite also observed that model ensemble can also reduce negative flips without explicit input from the old model. we evaluate both distillation and ensemble based methods on a diverse set of nlp tasks. to further understand how the above methods contribute to reducing it, we utilize checklist @xcite to quantify linguistic behavioral changes before and after applying proposed methods. we find that regressions are prevalent in nlp tasks, and their distribution correlates with different linguistic phenomena. our main contributions are as follows: ## measuring regression in nlp model update in this section, we first formulate the measure of model update regression on classification tasks. then we benchmark on glue tasks @xcite and show that there is a prevalent presence of regression when updating models in nlp. ## reducing regression in model update in this section, we first formulate regressionfree model update as a constrained optimization problem, then further reducing it to a joint optimization objective combining the training loss on the original task and a distillation loss with respect to the old model's behavior. unlike typical optimizations in neural model training where we minimizes a loss function on a training set, the regression-free model update requires the model to learn the target task as well as comply with conditions posed by the old model. ## full results on glue can be found in appendix a we can cast the regression-free model update as a constrained optimization problem by writing down the classification loss as the optimization objective and the regression-free conditions as constraints: training a model directly with the regressionfree constraint still remains difficult in that signals from old predictions are sparse and r n f is nondifferentiable. here, we propose two proxies of r n f to measure regression in continuous space. proxy from prediction probabilities. we use the kl divergence between the predicted probabilities of both models as one soft regression measure: proxy from deep representations. we can also use the l 2 distance between models' sentence representations, e.g. [cls] embedding in bert as another soft regression measure: a linear projection is used to align the representations if they initially lie in different spaces. reduce to knowledge distillation. finally, we apply the lagrangian relaxation to bring the regression-free constraint into the optimization objective as an additional penalty loss: ## analyzing regression in model updates in this section, we first analyze the model ensemble and present our hypothesis on how it reduces regression. next, we conduct behavioral testing across diverse linguistic phenomena to see where the reduced and remaining regressions reside. ## conclusion in this work, we investigated the regression in nlp model updates on classification tasks and show that it has a prevalent presence across tasks and models. we formulated the regression-free model update problem as a constrained optimization problem and reduce it into a joint learning objective on target task while distilling from the old model. together with the ensemble, these methods can cut down the regression by 60% at best. experiments on the glue benchmark showed that ensemble can be effective in reducing the regression when updating to homogeneous models. on the other hand, knowledge distillation produced more significant regression reductions under the heterogeneous setting. through linguistic behavioral testing we showed that distillation can reduce the regression across a wider range of linguistic phenomena than ensemble method. while the regression reduction achieved by the discussed methods are promising, they are far from reaching regression-free. we leave the design of more advanced regressionreduction methods as future works.