Hybrid Uncertainty Quantification for Selective Text Classification in Ambiguous Tasks
Year: 2023

Abstract:
Many text classification tasks are inherently ambiguous, which results in automatic systems having a high risk of making mistakes, in spite of using advanced machine learning models. For example, toxicity detection in usergenerated content is a subjective task, and notions of toxicity can be annotated according to a variety of definitions that can be in conflict with one another. Instead of relying solely on automatic solutions, moderation of the most difficult and ambiguous cases can be delegated to human workers. Potential mistakes in automated classification can be identified by using uncertainty estimation (UE) techniques. Although UE is a rapidly growing field within natural language processing, we find that stateof-the-art UE methods estimate only epistemic uncertainty and show poor performance, or under-perform trivial methods for ambiguous tasks such as toxicity detection. We argue that in order to create robust uncertainty estimation methods for ambiguous tasks it is necessary to account also for aleatoric uncertainty. In this paper, we propose a new uncertainty estimation method that combines epistemic and aleatoric UE methods. We show that by using our hybrid method, we can outperform state-of-the-art UE methods for toxicity detection and other ambiguous text classification tasks1.

heading: 1 Introduction
text: Many natural language processing (NLP) tasks are subjective and contain inherent ambiguity. For example, the notion of toxicity is inherently subjective (Waseem, 2016) and can be defined in a number of ways that may conflict with one another and differ according to the demographic that the methods are applied to (Thylstrup and Waseem, 2020). For many datasets, implicit or ambiguous toxicity can comprise more than 90% of the labeled toxic
1The code for reproducing experiments is available online at https://github.com/AIRI-Institute/hybrid_ uncertainty_estimation
content (Hartvigsen et al., 2022). Such ambiguity introduces a high risk of classification mistakes for machine learning (ML) models. Classification mistakes for toxicity detection can result in the removal of legitimate non-toxic content on one hand, and the lack of sanction for toxic content, on the other. A common method for addressing this concern for content moderation is to abstain from predictions on ambiguous instances and process them with the help of human workers (Roberts, 2019).
A classification task where some model predictions can be “rejected” is called selective classification (Geifman and El-Yaniv, 2017). The common approach to solving it is applying uncertainty estimation (UE) techniques. UE is a field of ML that seeks to model the degree to which model predictions can be trusted by correlating model mistakes and performance. Better UE methods improve the performance of selective classification and the trade-off between the amount of labor and the reliability of downstream applications. In toxicity detection, better UE methods minimize the amount of content that is reviewed by human moderators to predominately be classification errors.
Recent works have suggested deterministic approaches to UE of neural network predictions based on fitting the density of latent instance representations (Lee et al., 2018; van Amersfoort et al., 2020; Mukhoti et al., 2023; Yoo et al., 2022; Kotelevskii et al., 2022). They have shown good performance in NLP for the detection of out-of-distribution (OOD) instances, adversarial attacks, and misclassified objects in non-ambiguous tasks. However, they primarily capture epistemic uncertainty, i.e. uncertainty related to the lack of knowledge about model parameters and training data, overlooking aleatoric uncertainty, i.e. uncertainty that arises from ambiguity and noise in data.
This work aims to create a UE method for more reliable selective classification in ambiguous tasks such as toxicity detection by combining different
11659
types of uncertainty. Instances that carry a high risk of classification mistakes come from two sources: a) OOD areas, which can be detected with epistemic UE methods; and b) in-distribution ambiguous areas, for detection of which, aleatoric UE methods are appropriate (for illustration see Figure 1). Therefore, we propose a Hybrid Uncertainty Quantification (HUQ) method that switches between epistemic and aleatoric uncertainties or linearly combines them. It produces better scores of total uncertainty, which subsequently leads to better selective classification. The experiments on various ambiguous tasks show that HUQ in a majority of cases significantly outperforms other state-of-theart UE techniques. To summarize, the contributions of this work are the following.
• In Section 4, we propose a new uncertainty estimation method HUQ that combines epistemic and aleatoric UE techniques in a special way that allows to improve the quality of selective classification in ambiguous tasks.
• To the best of our knowledge, this work is the first to conduct an empirical investigation of state-of-the-art UE methods for ambiguous text classification tasks such as toxicity detection. Our analysis shows that the proposed HUQ approach outperforms state-of-the-art methods in selective text classification on ambiguous tasks; see Sections 5 and 6.
• We analyze the limitations of the proposed method and suggest conditions to be met for
achieving the improvements; see Section 7.

heading: 2 Related Work
text: Quantifying uncertainty of deep neural network predictions can be successfully accomplished using deep ensembles (DE; Lakshminarayanan et al., 2017), Bayesian models (Blundell et al., 2015), or their approximations. However, most of these methods have various drawbacks, including large computational overhead. For example, for DE, we need to multiply training time, the occupied memory, and inference time, since this network requires training, storing, and running inference for multiple versions of the same model. This makes DE hardly applicable in real-world scenarios.
Recent work has investigated computationally efficient deterministic approaches (e.g., Lee et al., 2018; van Amersfoort et al., 2020; Liu et al., 2020). However, most work is based on feature space density and focuses only on the OOD detection task and epistemic uncertainty estimation. Another computationally efficient approach is SelectiveNet (Geifman and El-Yaniv, 2019), which was designed for computer vision tasks. It introduces two separate heads for prediction and selection within the model architecture and adds a special loss component to minimize selective risk with a specified coverage.
Most similar to our work is Mukhoti et al. (2023), which also considers both aleatoric and epistemic uncertainty. DDU uses a combination of feature-
space density for epistemic uncertainty and the softmax predictive distribution for aleatoric uncertainty. They advocate for the usage of different methods for quantifying uncertainty, depending on whether a considered instance is ID or OOD. However, they overlook using a linear combination of uncertainty scores, relying solely on feature-space density for instances considered OOD. We note that these instances can also be borderline (instances from middle to low-density areas), for which using aleatoric uncertainty measures may also be appropriate. Besides, Mukhoti et al. (2023) do not provide results for selective classification and mostly experiment with image classification tasks.
Recently, selective classification (or misclassification detection) has been studied for NLP tasks.One line of such work has proposed adding a regularization term to the training loss. Xin et al. (2021) introduces a penalty term for confident instances with a high loss value. Another approach proposed by Zhang et al. (2019) uses a metric regularization that minimizes the inter-class distance in the latent feature space while maximizing the margin between classes. He et al. (2020) propose a regularization technique based on self-ensembling that aims to minimize the difference between predictions of the two versions of the model. They also combine this approach with mix-up (Thulasidasan et al., 2019) and a distinctiveness score based on the MD. Some work has also considered approximations of deep ensembles based on Monte-Carlo dropout (e.g., Shelmanov et al., 2021; Vazhentsev et al., 2022). Vazhentsev et al. (2022) conduct a vast empirical investigation and suggest several promising combinations of regularizers and featuredensity-based methods. They also highlight the importance of spectral normalization for obtaining good results. Kotelevskii et al. (2022) propose a new UE method NUQ and test it for text classification models trained in the low-resource regime.
Despite the aforementioned efforts, highly ambiguous text classification tasks such as toxicity detection have been overlooked in the previous work. Moreover, to the best of our knowledge, no prior work in NLP takes into account aleatoric uncertainty and combines multiple types of uncertainty for a holistic view of uncertainty.

heading: 3 Background
text: Two types of uncertainty have been documented in the literature: aleatoric and epistemic (Der Ki-
ureghian and Ditlevsen, 2009). Aleatoric, or data uncertainty, arises from ambiguity and noise in data. It should be high, for example, for groups of instances prone to annotation discrepancy. Epistemic, or model uncertainty, pertains to a lack of knowledge about model parameters and can often be mitigated through additional training data collection. Epistemic uncertainty is particularly important for OOD detection (Hendrycks and Gimpel, 2017) and active learning (Settles, 2009).
According to the Bayesian approach to measuring uncertainty in deep learning networks (Blundell et al., 2015; Gal, 2016; Depeweg et al., 2018), the total uncertainty of a model prediction x is a sum of aleatoric UA(x) and epistemic uncertainty UE(x):
UT(x) = UA(x) + UE(x). (1)
High total uncertainty should correlate with classification mistakes and can be used to flag model predictions for human review.

heading: 3.1 Out-of-Distribution and (Ambiguous)
text: In-Distribution Instances
We define out-of-distribution (OOD) instances XOOD as those located either outside a training data distribution or in its low-density regions. They can be identified by high epistemic uncertainty.
In-distribution (ID) instances we define to belong to the domain of the dataset D located “inside” the training data distribution. ID instances are those, for which model predictions have very small epistemic uncertainty, i.e. below some threshold δmin:
XID = {x : UE(x) ≤ δmin}. (2)
Note that for the in-distribution data, on the basis of (1) and taking into account (2), we can empirically approximate UT (x) ≃ UA(x).
We also define ambiguous in-distribution (AID) instances as those, predictions on which having the highest values of aleatoric uncertainty with a lower bound δmax. AID instances lie around the class-decision boundaries virtually established by the discriminative model:
XAID = {x∈ XID : UA(x) > δmax}. (3)

heading: 3.2 Quantifying Epistemic Uncertainty
text: Recent works have proposed a variety of computationally efficient methods for quantifying epistemic uncertainty on the basis of fitting the probability density of latent instance representations. In
this work, we experiment with Mahalanobis Distance (MD, Lee et al., 2018), Robust Density Estimation (RDE, Yoo et al., 2022), and Deep Deterministic Uncertainty (DDU, Mukhoti et al., 2023).
Let D be a training dataset, h(x) be a latent representation of an instance x (it is usually taken from the penultimate layer of the network), and c ∈ C be a class. The UE method based on MD (Lee et al., 2018), for each class, fits a Gaussian centered in a class centroid {µc}c∈C with a covariance matrix Σ shared across classes. The highest classconditional probability density p(h(x) | y = c) determines the confidence of the prediction, and the uncertainty score is computed as the Mahalanobis distance between h(x) and the closest centroid:
UMDE (x) = min c∈C (h(x)− µc)TΣ−1(h(x)− µc).
RDE (Yoo et al., 2022) improves on MD by computing the covariance matrix Σc for each individual class using the Minimum Covariance Determinant estimation (Rousseeuw, 1984) and by reducing the dimensionality of the hidden representations via PCA decomposition with an RBF kernel. These modifications aim to minimize the determinant of the covariance matrix and reduce the influence of outliers in the training data.
DDU (Mukhoti et al., 2023) fits a Gaussian Mixture Model (GMM) p(h(x), y) with a single mixture component per class. The uncertainty score is the probability density of h(x) under the GMM:
UDDUE (x) = ∑
c∈C p(h(x) | y = c) p(y = c),
where p(h(x) | y = c) ∼ N (h(x) | µc, Σc) and p(y = c) = 1|D| ∑ (xi,yi)∈D 1[yi = c].
Methods based on the fitting density of latent representations are suitable for finding OOD instances but are not capable of identifying AID instances. More generally, they are not good estimators of uncertainty in XID. Therefore, for ambiguous tasks where AID instances comprise a large portion of the data, these epistemic UE methods cannot fully cover all potential misclassifications.

heading: 3.3 Quantifying Aleatoric Uncertainty
text: As measures of aleatoric uncertainty, we use two well-known methods based on probabilities from the output softmax layer of a neural network: entropy (Gal, 2016) and Softmax Response (SR, Geif-
man and El-Yaniv, 2017):
UEntA (x) = − ∑
c∈C p(y = c | x) log p(y = c | x),
USRA (x) = 1−max c∈C p(y = c | x).
Entropy and SR have been proposed also as measures of total uncertainty (Malinin and Gales, 2018). However, this assumption holds only when one has access to the full posterior distribution under the Bayesian paradigm, i.e. all possible uncertainties are quantified within the model. In practice, training datasets are limited, and we can only approximate considered probability distributions. Thus, these methods could not capture all the epistemic uncertainty and mostly reflect the aleatoric one (van Amersfoort et al., 2020; Mukhoti et al., 2023).

heading: 4 Hybrid Uncertainty Quantification
text: There are two major sources of mistakes in model predictions: OOD instances and instances that lie in proximity to the decision boundary (AID instances). Aleatoric uncertainty can help to detect AID instances, while epistemic uncertainty can help to detect OOD instances. In many tasks, we have to deal with both types of mistakes arising from task ambiguity or from a marked covariate shift between training and test data. To address this issue, we propose a hybrid method that combines the strengths of aleatoric and epistemic uncertainty.
Our hybrid uncertainty quantification (HUQ) method first uses Eq. (2) to determine whether an instance x is ID or OOD. If x ∈ XID, HUQ applies Eq. (3) to determine if x is near a class-decision boundary, i.e., x ∈ XAID. Once the type of instance has been identified, we can apply an appropriate uncertainty estimation method for it or combine multiple uncertainty scores into a single estimate.
Uncertainty scores from different methods may however not be comparable with one another due to different magnitudes. Therefore, instead of using absolute values, we propose to rank instances in some dataset D by their uncertainty scores and as a final score use these ranks or their combinations. Ranking can be considered as a form of normalization. Moreover, such an approach is desirable for the selective classification task, as we are only interested in the ability to rank predictions by their uncertainty. We define a ranking function R(u,D) as the rank of u over a sorted dataset D, so u1 > u2 implies R(u1,D) > R(u2,D).
Having the ranks according to epistemic and aleatoric scores and the type of x, we can define the final total uncertainty score. We consider predictions for ID instances as the most trustworthy, therefore, we define their total uncertainty score as the rank of their aleatoric score R(UA(x),DID) only among known ID instances DID = {xi : xi ∈ D ∩ xi ∈ XID}. Predictions on AID instances are considered the most error-prone. Their total score is the rank of the aleatoric score among all known instances R(UA(x),D). Lastly, for x /∈ XID, we calculate a linear combination of ranks of aleatoric and epistemic scores among all known instances: (1−α)R(UE(x),D)+αR(UA(x),D), where α ∈ [0, 1] is a task-specific hyperparameter that depends on the quality of the softmax classifier, and a number of training instances. The usage of a mixture rather than only the epistemic score is justified by the fact that the generalization capabilities of models allow them to make meaningful predictions also in OOD regions, so aleatoric scores to some extent remain meaningful in these areas.
Thus, the total uncertainty score for x according to HUQ is
UHUQ(x) =    R(UA(x),DID),∀x ∈ XID \ XAID, R(UA(x),D), ∀x ∈ XAID, (1− α)R(UE(x),D)+ αR(UA(x),D), ∀x /∈ XID.
Note that HUQ can plug-in various “base” methods for the estimation of epistemic and aleatoric uncertainty. Algorithm 1 summarizes the uncertainty score calculation procedure according to HUQ.
The threshold hyperparameters (δmin, δmax) that determine x ∈ {XID | XAID | XOOD} can be set using the validation dataset. We set δmin to be the epistemic uncertainty score of the instances x with the lowest β% epistemic uncertainty on the training set. Similarly, the hyperparameter δmax is selected as the uncertainty score of the most confident instances x from topγ% of instances in the training set with the highest aleatoric uncertainty:
δmin = UE(β%); δmax = UA(γ%).

heading: 5 Experimental Setup

heading: 5.1 Models
text: We experiment with two pre-trained Transformers: ELECTRA (“electra-base-discriminator”) (Clark
Algorithm 1: The HUQ algorithm with MD for epistemic UE and SR for aleatoric UE.
Input :Target text x, Some dataset D = {xi}Ni=1, Hyperparameters: δmin, δmax, α Output :Uncertainty score UHUQ(x)
1 UE(x)← MD(x); UA(x)← SR(x) 2 XID ← {x : UE(x) ≤ δmin}; 3 DID = {xi : xi ∈ D,∩xi ∈ XID} 4 if x ∈ XID then /*When x is ID*/ 5 XAID ← {x : UA(x) > δmax} 6 if x ∈ XAID then 7 UHUQ(x)← R(UA(x), D) 8 else 9 UHUQ(x)← R(UA(x), DID) 10 end 11 else /*When x is not ID*/ 12 UHUQ(x)← (1−α)R(UE(x), D)+αR(UA(x), D) 13 end
et al., 2020) and BERT (“bert-base-uncased”) (Devlin et al., 2019) with 110 million parameters. We use a spectral normalization of the weight matrix in the penultimate linear layer of the classification heads of the models (Liu et al., 2020) as it can be helpful for density-based methods (Vazhentsev et al., 2022). The details on the model hyperparameter optimization procedure and optimal values are presented in Appendix A. To report the deviation of results, for each experiment, we train 5 models with optimal hyperparameters, but different random seeds.

heading: 5.2 Datasets
text: There are several tasks that contain highly subjective data, e.g., toxicity detection, particularly detecting implicit hate and sentiment analysis. We conduct experiments on five datasets for toxicity detection: PARADETOX (Logacheva et al., 2022), JIGSAW with binary labels,2 a collection of tweets with annotation of hate and offensive language (TWITTER; Davidson et al., 2017), TOXIGEN (Hartvigsen et al., 2022), and IMPLICITHATE (ElSherief et al., 2021); and three multi-class classification tasks with high ambiguity: 20 NEWS GROUPS (Lang, 1995), Stanford Sentiment Treebank with 5 classes (SST-5; Socher et al.,
2Jigsaw Kaggle Toxic Comment Classification Dataset.
2013), and AMAZON REVIEWS (McAuley and Leskovec, 2013) (sports and outdoors categories). Note that for TOXIGEN and IMPLICITHATE, implicit hate speech accounts for more than 95% of the positive class. The TWITTER dataset does not contain a predefined test set, so we create it by ourselves. It is constructed from the documents with high annotator disagreement. In all other cases, we use original test sets. See Appendix B for dataset statistics and the analysis of their ambiguity.
To reduce the computational burden of the experiments, the datasets are randomly subsampled. For training, we sample 10% from AMAZON, IMPLICITHATE, and JIGSAW; and 20% from PARADETOX. For evaluation, we sample 10% from PARADETOX, IMPLICITHATE, and JIGSAW.

heading: 5.3 Metrics
text: Selective classification differs from the standard classification task as low certainty predictions are rejected and deferred to alternate procedures, e.g., human review. Therefore, for performance evaluation in this task, a special metric is used: area under the risk coverage curve (AUC-RC; El-Yaniv and Wiener, 2010). Consider all predictions in a dataset are sorted in ascending order by uncertainty, so we can discard some % of the most uncertain predictions. The % of predictions remaining after that is called a coverage rate, and the total loss of the remaining predictions is called the selective risk. The RC curve plots a dependence of the selective
risk from the coverage rate. Finally, the AUC-RC is a cumulative sum of the selective losses for each coverage rate. Lower values of AUC-RC indicate better performance.

heading: 5.4 Hyperparameter Selection for HUQ
text: To find optimal hyperparameters for HUQ, we select 20% of the training set as a validation set and optimize AUC-RC on it, using a grid search. For each variant of models trained with different random seeds, we select its specific set of hyperparameters. The hyperparameter grid is the following: α ∈ [0; 1] with a step size 0.1; δmin ∈ {0%, 0.05%, 0.1%, 0.15%, 0.2%}; δmax ∈ {0.9%, 0.95%, 1.0%}. The values of δmax and δmin in % are converted into absolute values, when we apply them to the test data.

heading: 6 Results
text: In our illustrative example of the two moons dataset in Figure 1, the state-of-the-art epistemic UE methods, MD and RDE, separate the ID area from the remaining feature space well. However, the middle area between the two classes is marked with high confidence, yet for SR and Entropy, this area is marked as highly uncertain due to the presence of instances with high aleatoric uncertainty. HUQ, which combines aleatoric and epistemic uncertainty, accurately detects both areas of uncertainty, thereby overcoming the weaknesses of aleatoric and epistemic uncertainty individually applied.

heading: 6.1 HUQ Against its Base Methods
text: When presenting results, we denote HUQ with a specific base epistemic UE method as HUQ (<UE method>). Note that in the main part of the paper, we present the results only with SR as a base aleatoric UE method. The results for entropy are very similar to SR and are presented in Appendix E.
HUQ-MD yields significant improvements over its base methods (MD and SR) on 6/8 datasets for both ELECTRA and BERT (see Table 1). The largest improvements are achieved on 20 NEWS GROUPS and PARADETOX, where HUQ reduces AUC-RC by 13.0% and 4.9% (ELECTRA), and 6.6% and 7.0% (BERT).
HUQ-DDU produces improvements over DDU and SR on all 8 datasets for ELECTRA and on 5 datasets for BERT (see Table 2). For ELECTRA, HUQ produces large effects on PARADETOX and TOXIGEN with 4.6% and 11% AUC-RC reduction, and with BERT on PARADETOX with a 10.6% reduction. Interestingly, vanilla DDU is significantly outperformed by SR for ELECTRA on JIGSAW. Applying HUQ addresses this issue, and improves on the results using SR by 1.8%.
The results for HUQ-RDE are more ambiguous than for DDU and SR (see Table 3). RDE is a good method for selective classification and is a hard-to-beat baseline for HUQ. This is because, in addition to OOD detection RDE computes a covariance matrix for each class, thereby making it suitable for identifying decision boundaries. For
RDE as the base epistemic UE method, HUQ improves results on 4 datasets for ELECTRA and on 6 datasets for BERT. On some datasets, HUQ does not improve on SR and RDE, e.g., for TWITTER (ELECTRA) and PARADETOX (BERT). However, on others, HUQ shows big improvements in RCAUC, e.g., 18.0% for 20 NEWS GROUPS (ELECTRA) and 5.0% for TOXIGEN (BERT).
Overall, we see that HUQ usually improves upon its base methods, but in some cases, retains the same performance. We suspect that the configurations where HUQ does not outperform the baselines are due to the presence of large covariate shifts between the training and test data. We discuss this in detail in Section 7.

heading: 6.2 Overall Comparison
text: Here, we compare HUQ in selective classification tasks with various other UE techniques, including strong, yet computationally intensive deep ensembles (DE Lakshminarayanan et al., 2017) and SelectiveNet (Geifman and El-Yaniv, 2019) specifically designed for selective classification, but previously tested only in computer vision. Figure 2 presents results for the ELECTRA model and Figure 9 in Appendix D presents results for BERT.
The base epistemic UE methods sometimes cannot outperform even the weak SR baseline or even fall behind it by a large margin. It is especially noticeable for RDE on TWITTER and AMAZON reviews and for DDU on JIGSAW and AMAZON re-
views. This effect might appear because the majority of model mistakes arise from ambiguity rather than OOD instances, while these methods are better suitable for OOD detection. On some datasets, it is very hard to overcome the weak SR baseline. For example, on IMPLICITHATE and AMAZON, only DE confidently outperforms SR.
The results for our implementation of SelectiveNet for text classification models and the detailed experimental setup for this method are presented in Appendix F. On all considered datasets, SelectiveNet never outperforms the SR baseline and significantly falls behind it.
Variants of HUQ are usually the best or the second best after DE. For example, HUQ outperforms this strong baseline on PARADETOX, 20 NEWS GROUPS, and SST-5. However, while DE introduces computational overhead of 400%, HUQ requires additionally less than 5% of standard model inference time (see Table 15 in Appendix G).

heading: 6.3 Analyses
text: Hyperparameter for mixing aleatoric and epistemic uncertainty scores in HUQ. When varying the hyperparameter α, we change the impact of aleatoric and epistemic uncertainty for the final score. Figure 3 reports the impact of α on the TOXIGEN dataset. When α is close to 0, the performance of the total score approximates the epistemic uncertainty represented by MD, which is even worse in terms of AUC-RC than the SR baseline. When α is close to 1, we use solely the SR score in the mixture of uncertainties, while treating AID, ID, and other instances differently, which results in better performance compared to vanilla SR. The best results are obtained when we select α on the validation set. We can see that obtained α = 0.5 is very close to its optimum on the test set. HUQ-MD in this case outperforms MD by 10.6% and SR by 9.6% in terms of AUC-RC. This again illustrates the importance of mixing different types of uncertainties for selective classification. Similar charts for other considered datasets are presented in Figure 6 in Appendix C and for other hyperparameters in Figures. 7 and 8 in Appendix C.
Qualitative analysis. Table 16 in Appendix H presents several instances from various datasets, as well as model predictions and their normalized uncertainty scores. The qualitative analysis reveals that baseline uncertainty scores MD and SR may be high regardless of whether a classification of
an instance is correct. For example, we see that four correctly classified instances in PARADETOX are marked with high uncertainty by at least one of the methods. Moreover, MD and SR disagree with each other: MD yields high uncertainty scores for the first two instances, whereas SR produces low uncertainty. For the last two instances, the pattern is reversed. In all of these cases, the MD score is not low enough to consider instances as ID. Therefore, HUQ-MD linearly mixes the SR and MD scores, producing more balanced results with moderately low uncertainty, which is consistent with the fact that classifications are correct.
For the last example from Jigsaw, MD falls below a threshold α obtained for this dataset. Consequently, the example is classified as an ID instance, leading to the HUQ-MD score being equal to the SR score for this particular case. Contrary to MD, which yields low uncertainty, high uncertainty of SR and HUQ correctly indicates a prediction error.
For two examples, HUQ-MD contradict the results. Specifically, in the third example of ToxiGen and the second example of Jigsaw, the predictions are accurate, but uncertainty is moderately high. This discrepancy arises from both SR and MD being erroneously high. In such cases, the hybrid method is unable to correct the uncertainty score.

heading: 7 Limitations
text: While HUQ outperforms individual aleatoric and epistemic UE methods for most datasets considered, for some, the effects are negligible. To understand this pattern, we analyze the difference between the training and test sets. We generate latent representations of instances in the datasets
using a fine-tuned ELECTRA model and fit a logistic regression model to discriminate between train and test sets using these representations as features. Good performance of the discriminator indicates a covariance shift between the training and test data, while bad performance indicates that instances come from the same distribution.
Table 4 presents F1 scores for this task aligned with the performance gains of HUQ-DDU in percentages over the best method from the pair <SR, DDU>. As we can see, high F1 scores often correspond to low values of performance gains (the Spearman rank correlation = 0.8). This means that HUQ is unlikely to provide improvements to the base methods for the tasks with big covariate shifts. In our analysis, this is due to prediction mistakes primarily arising from OOD instances, which are well-handled by epistemic UE methods.
Visualizing the differences between the datasets using a t-SNE decomposition of the latent representations (see Figure 4), we can see that for IMPLICITHATE and TWITTER, where HUQ does not provide improvements, some regions of the test data are not covered by the training set. For PARADETOX and TOXIGEN, on the other hand, the training dataset completely overlays all regions of
the test data, and using HUQ improves AUC-RC on the base methods.

heading: 8 Conclusion
text: In this work, we proposed a hybrid uncertainty quantification method for selective text classification. It combines pre-existing methods for aleatoric and epistemic uncertainty, providing scores of total uncertainty. Experimentally, we find that HUQ usually outperforms in terms of RC-AUC other UE methods that aim at quantifying only one type of uncertainty. In real terms, the improved uncertainty estimation offered by our method affords improved identification of erroneous predictions for ambiguous text classification tasks.
Although the HUQ method often provides better results, there are some cases where it is unable to surpass its base methods and performs at a comparable level to them. In our analysis of these examples, we find that this issue arises when there is a substantial covariate shift between the training and test data. In future work, we are planning to analyze other factors that affect the performance of UE methods in selective classification tasks. Our goal is to achieve more consistent and stable improvements over baselines across diverse datasets.

heading: Acknowledgements
text: We are very grateful to Zeerak Talat for generously sharing their expertise in toxicity detection, offering valuable suggestions for text edits, and the help with the work in general. We thank anonymous reviewers for their insightful feedback towards improving this paper. The financial support was provided by the Russian Science Foundation, grant 20-71-10135.
Ethical Considerations
The task of uncertainty estimation is one that is closely tied to the construction of ethical machine learning methods, as it pertains to the identification of potential misclassified instances. For the task of toxic content classification, uncertainty estimation is particularly important due to the speech concerns surrounding toxicity detection. Moreover, toxicity detection has shown disparate performance along gendered and racialized lines, uncertainty estimation provides an avenue for identifying when a model may no longer be applied without further improvement. However, while uncertainty estimation may have potential benefits to the tasks under the umbrella of abusive language detection, approaching misclassifications and uncertainty without an intersectional (Crenshaw, 1991) lens, and without appropriate measures for deep engagements with affected communities may propagate issues of social control, and particularly of enforcing respectability politics of language use. It is therefore important to understand that uncertainty estimation can only provide a partial perspective to the challenges that are faced in abusive language detection. For instance, data that is mislabeled, or labeled such that it propagates stereotypes can exhibit low levels of uncertainty while being undesirable in relation to the goal of equitable machine learning methods for content moderation.

heading: A Hyperparameter Values and Hardware Configuration
text: The optimal hyperparameters are obtained using Bayesian optimization with early stopping. We train a model on 80% of the training dataset and validate on the remaining 20%. The optimal hyperparameters are selected according to the best accuracy score on the validation set. After the hyperparameters are selected, we use them to fine-tune the model on the full training set. The hyperparameter grid is the following: Learning rate: [5e-6, 6e-6, 7e-6, 9e-6, 1e-5, 2e-5, 3e-5, 5e-5, 7e-5, 1e-4]; Num. of epochs: {n ∈ N | 2 ≤ n ≤ 15}; Batch size: [4, 8, 16, 32, 64]; Weight decay: [0, 1e-2, 1e-1].
Table 6 presents the hardware configuration used in experiments. In addition, we provide the approximate number of GPU hours that are needed for training and evaluating all models for all datasets.

heading: B Dataset Statistics and Analysis of Ambiguity in Datasets
text: Figure 5 presents the t-SNE decomposition of latent representations from ELECTRA for various test sets, where classes are marked with different colors. For TOXIGEN, JIGSAW, and IMPLICITHATE, we can see that there is no clear boundary between the “neutral” and “toxic” classes. For SST-5 and AMAZON, we can see a smooth transition from the “very negative” to the “very positive” classes. This illustration reveals the presence of noisy and ambiguous instances in these datasets.
Table 7 presents the dataset statistics with the number of instances in the test and training sets and the number of labels.

heading: C Contribution of Different Components of HUQ
text: Figures. 6 to 8 present the dependence of the AUC-RC score when varying one of the hyperparameters in HUQ, while others are fixed to optimal values. According to the results, the most valuable hyperparameter of HUQ is α. In Figure 6, for all datasets, except IMPLICITHATE, we see that there exists an optimal value of α different from 0 or 1 that gives the smallest AUC-RC. This means that for these datasets, the contributions of both types of uncertainties are important. In addition, we can see that our validation strategy finds α̂ close to its optimal value.
Hyperparameters δmin and δmax contribute to the final score, but their effect is less significant. Nevertheless, it is crucial to take into account all components of HUQ to achieve the best results.

heading: D Overall Comparison of UE Methods for BERT

heading: E Additional Experiments with Different Aleatoric Uncertainty Estimation Methods
text: Tables 8 to 10 present the comparison of AUC-RC when using SR or Entropy as measures of aleatoric uncertainty in various versions of HUQ. Only for SST-5, we see a small significant difference between them: SR is better than Entropy in terms of AUC-RC by 2.5% in HUQ-MD, by 2.7% in HUQ-DDU, and by 1.7% in HUQ-RDE.

heading: F Additional Experiments with SelectiveNet
text: Tables 11 to 13 present the comparison of the SelectiveNet performance (Geifman and El-Yaniv, 2019) with the performance of the SR baseline. The experiments are conducted with the ELECTRA model on the PARADETOX, TOXIGEN, and 20 NEWS GROUPS datasets. SelectiveNet is designed only for a specific coverage, which is fixed during training. Therefore, we select multiple coverage values and for each value, we fine-tune a separate model, following the standard approach for training SelectiveNet. Since the coverage for each model is fixed, the AUC-RC metric is not appropriate for evaluation of this method. Therefore, instead, we use the selective risk for the specified coverage as an evaluation metric. The results show that for the considered text classification datasets, SelectiveNet significantly falls behind the standard SR baseline, which is different from the results obtained by Geifman and El-Yaniv (2019) on computer vision tasks. The optimal hyperparameters for SelectiveNet are presented in Table 14.

heading: G Computation Overhead for Uncertainty Estimation
text: Table 15 presents the computation time for various UE methods. The HUQ-MD during the inference stage introduces only 0.02% of overhead in comparison with the MD and less than 5% of overhead in comparison with the SR baseline. On the contrary, a deep ensemble of 5 models introduces 400% of overhead in comparison with the MD and the SR, which makes it impractical.

heading: H Qualitative Analysis
text: ACL 2023 Responsible NLP Checklist

heading: A For every submission:
text: 3 A1. Did you describe the limitations of your work?
8
3 A2. Did you discuss any potential risks of your work? 8
3 A3. Do the abstract and introduction summarize the paper’s main claims? 1
7 A4. Have you used AI writing assistants when working on this paper? Left blank.
B 7 Did you use or create scientific artifacts? Left blank.
B1. Did you cite the creators of artifacts you used? No response.
B2. Did you discuss the license or terms for use and / or distribution of any artifacts? No response.
B3. Did you discuss if your use of existing artifact(s) was consistent with their intended use, provided that it was specified? For the artifacts you create, do you specify intended use and whether that is compatible with the original access conditions (in particular, derivatives of data accessed for research purposes should not be used outside of research contexts)? No response.
B4. Did you discuss the steps taken to check whether the data that was collected / used contains any information that names or uniquely identifies individual people or offensive content, and the steps taken to protect / anonymize it? No response.
B5. Did you provide documentation of the artifacts, e.g., coverage of domains, languages, and linguistic phenomena, demographic groups represented, etc.? No response.
B6. Did you report relevant statistics like the number of examples, details of train / test / dev splits, etc. for the data that you used / created? Even for commonly-used benchmark datasets, include the number of examples in train / validation / test splits, as these provide necessary context for a reader to understand experimental results. For example, small differences in accuracy on large test sets may be significant, while on small test sets they may not be. No response.
C 3 Did you run computational experiments? 5
3 C1. Did you report the number of parameters in the models used, the total computational budget (e.g., GPU hours), and computing infrastructure used? Section 4 and Appendix A
The Responsible NLP Checklist used at ACL 2023 is adopted from NAACL 2022, with the addition of a question on AI writing assistance.
3 C2. Did you discuss the experimental setup, including hyperparameter search and best-found hyperparameter values? Section 4 and Appendix A
3 C3. Did you report descriptive statistics about your results (e.g., error bars around results, summary statistics from sets of experiments), and is it transparent whether you are reporting the max, mean, etc. or just a single run? 5
7 C4. If you used existing packages (e.g., for preprocessing, for normalization, or for evaluation), did you report the implementation, model, and parameter settings used (e.g., NLTK, Spacy, ROUGE, etc.)? No, we used already preprocessed datasets
D 7 Did you use human annotators (e.g., crowdworkers) or research with human participants? Left blank.
D1. Did you report the full text of instructions given to participants, including e.g., screenshots, disclaimers of any risks to participants or annotators, etc.? No response.
D2. Did you report information about how you recruited (e.g., crowdsourcing platform, students) and paid participants, and discuss if such payment is adequate given the participants’ demographic (e.g., country of residence)? No response.
D3. Did you discuss whether and how consent was obtained from people whose data you’re using/curating? For example, if you collected data via crowdsourcing, did your instructions to crowdworkers explain how the data would be used? No response.
D4. Was the data collection protocol approved (or determined exempt) by an ethics review board? No response.
D5. Did you report the basic demographic and geographic characteristics of the annotator population that is the source of the data? No response.

heading: Future Work
text: In future work, we are planning to analyze other factors that affect the performance of UE methods in selective classification tasks. Our goal is to achieve more consistent and stable improvements over baselines across diverse datasets