Making Heads and Tails of Models with Marginal Calibration for Sparse Tagsets (2021)

Abstract: For interpreting the behavior of a probabilistic model, it is useful to measure a model’s calibration—the extent to which it produces reliable confidence scores. We address the open problem of calibration for tagging models with sparse tagsets, and recommend strategies to measure and reduce calibration error (CE) in such models. We show that several post-hoc recalibration techniques all reduce calibration error across the marginal distribution for two existing sequence taggers. Moreover, we propose tag frequency grouping (TFG) as a way to measure calibration error in different frequency bands. Further, recalibrating each group separately promotes a more equitable reduction of calibration error across the tag frequency spectrum.

## introduction an advantage of probabilistic models is that, in addition to providing a prediction, they also quantify uncertainty. knowing how certain a model is about a particular prediction can be crucial when using its output for downstream tasks or when weighing its trustworthiness. of course, the probability estimate associated with a predicted output is an artifact of the model, and is subject to error-separate from the accuracy or error of the prediction itself. by and large, nlp evaluations of multiclass classifiers and structured prediction models consider only the top prediction for an input and how closely it matches the gold standard. only in some studies is the probability assigned to the prediction taken into account at all (e.g. via a precision-recall curve). a more comprehensive evaluation would examine whether the model's probabilities are wellcalibrated, i.e., whether they correlate well with empirical accuracy (such that ≈ α% of predictions with probability close to α are in fact correct). @xcite showed that despite high accuracy, modern neural networks can still suffer from severe miscalibration. fortunately, calibration error is not completely random, and can be corrected post hoc with a second model fit on development data (or even a separate recalibration set if available) as in several recalibration techniques ( §2). in domains where nlp models help inform human decision-making (e.g., medicine), having a well-calibrated model is essential. even in less critical domains, a well-calibrated model has potential to benefit rare instance discovery, pre-annotation, and self-training. in this paper we consider a structured prediction setting of particular relevance in nlp: tagging tasks with sparse tagsets-output spaces with a handful of high-frequency tags and many more rare tags. many linguistic phenomena follow power law distributions and thus feature a long tail of individually rare events, which, as we will show, makes it nontrivial to measure calibration error with existing methods, including marginal calibration error (mce), which requires sufficient samples of each class to produce a reliable estimate @xcite . we evaluate two english sentence taggers foot_0 with closed sets of 100s of tags that disambiguate word tokens: a combinatory categorial grammar (ccg) syntactic supertagger with 426 tags @xcite , and a lexical semantic recognition (lsr) tagger with 598 tags @xcite . our main contributions are the following: ## background calibration studies have two components: a recalibration technique and an evaluation metric. we use similar notation as @xcite to describe both. that is, we assume a multiclass model f ∶ @xmath0,1] for each class @xmath1. in other words, for any input, the model gives @xmath2. if these predictions are the output of a softmax function (as is typical for the last layer of neural networks), they will sum to 1 and can be interpreted as uncalibrated confidence scores across the distribution of possible classes or tags. the goal of recalibration is to make these confidence scores more reliable. ## designing and evaluating the long tail of tags for ccg and lsr is of particular interest with respect to calibration. @xcite point out that most studies of multiclass calibration focus primarily on top-label calibration (reducing calibration error for only the top prediction out of the model for each input), also called top-1 or top-k when looking at several of the model's top predictions. while top-label scores are an important component of calibration, they don't tell the whole story, and we argue that the rest of the distribution (marginal calibration) shouldn't be ignored. recent works that address marginal calibration @xcite @xcite ) make similar arguments but still tend to focus on balanced datasets like cifar-100, which contains 600 examples for each of 100 classes, or datasets with fewer tags like mnist @xcite , mnist fashion @xcite , and cifar-10, which each have 10 classes. in our analysis of marginal calibration, we study two long tails of distributions related to calibrating a sparse tagset: low confidence scores and lowfrequency tags. we show how the standard onevs.-rest approach to multiclass calibration becomes infeasible as the size of the tagging space grows, and we provide specific recommendations for quantifying calibration error with sparse tagsets, where the lack of instances of rare tags poses unique challenges. extending section 4 of @xcite with a particular focus on sparse tagsets, we now discuss the many design decisions that need to be made regarding multiclass calibration. ## experiments in our experiments, we develop recalibration models for two taggers with sparse tagsets and measure the improvement over the uncalibrated confidence scores with smce (overall error) and gmce (pergroup error). ## conclusion we examined the challenges of evaluating and reducing calibration error with sparse tagsets. in particular, we introduced tfg to offer more control over how tags are pooled together given that some are too infrequent to be recalibrated/evaluated independently. we showed that scw and tfg are easily extensible from recalibration to the evaluation setting with the smce and gmce metrics, and that gmce gives more specific insight into where in a tag distribution the most calibration error exists and where it can be reduced. on one semantic task and one syntactic task, we found substantial improvement in calibration error for the head and tail of the tag distribution. opportunities for further research include devising methods for choosing and evaluating the optimal value for g and considering normalizing scores despite the elimination of scores below the threshold. while the recalibrated model would be unable to assign any confidence to tags excluded by thresholding, this effect may be minimal, and it could lead to improved interpretability since the distribution would sum to 1. it may also be worth relying not just on frequency but incorporating the structure of each tag into the grouping process. lsr and ccg tags, for example, are compositional, and could be grouped based on subtag. testing whether tfg has benefits for more balanced tagsets is another opportunity.