GeoHard: Towards Measuring Class-wise Hardness through
Modelling Class Semantics
Abstract
Recent advances in measuring hardness-wise properties of data guide language models in sample selection within low-resource scenarios. However, class-specific properties are overlooked for task setup and learning. How will these properties influence model learning and is it generalizable across datasets? To answer this question, this work formally initiates the concept of class-wise hardness. Experiments across eight natural language understanding (NLU) datasets demonstrate a consistent hardness distribution across learning paradigms, models, and human judgment. Subsequent experiments unveil a notable challenge in measuring such class-wise hardness with instance-level metrics in previous works. To address this, we propose GeoHard for class-wise hardness measurement by modeling class geometry in the semantic embedding space. GeoHard surpasses instance-level metrics by over 59 percent on Pearson’s correlation on measuring class-wise hardness. Our analysis theoretically and empirically underscores the generality of GeoHard as a fresh perspective on data diagnosis. Additionally, we showcase how understanding class-wise hardness can practically aid in improving task learning. The code for GeoHard is available 111https://github.com/TRUMANCFY/geohard.
1 Introduction
Data acts as a crucial intermediary proxy for AI systems to understand and tackle real-world tasks Torralba and Efros (2011); Vodrahalli et al. (2018). Therefore, evaluating the hardness of individual instances, or instance-level hardness Kong et al. (2020); Hahn et al. (2021); Ethayarajh et al. (2022); Zhao et al. (2022), relative to the dataset is key for learning and analyzing NLP tasks. This evaluation is increasingly important with the rise of large language models (LLMs; Touvron et al. 2023; Chung et al. 2024). Measuring hardness aids in selecting examples for in-context learning (ICL; Ye et al. 2024) or training samples for fine-tuning models Zhou et al. (2023); Xie et al. (2023).
![Refer to caption](x1.png)
However, another critical yet underexplored component of the dataset is the classes themselves, whose properties, such as ambiguity in their definitions, can also contribute to difficulties. While considerable efforts have been made to address class imbalance in specific datasets Subramanian et al. (2021); Henning et al. (2023), there remains a lack of comprehensive analysis on class-wise properties that are consistent across different tasks. Conventionally, classes are treated equally, e.g., the demonstrations in In-Context Learning (ICL) typically being evenly sampled among classes Min et al. (2022). This raises an important question: How do class-specific properties influence model performance?
We formally initiate the concept of class-wise hardness as the relative difficulty of a class, in analogy to instance-level hardness Ethayarajh et al. (2022). To make this notion quantifiable, we present the concept of the empirical class-wise hardness which assesses the class-specific performance given an LM and learning paradigm. Subsequently, the intrinsic class-wise hardness can be approximated by pooling the empirical performances across models and learning paradigms. Our analysis across eight Natural Language Inference (NLI) or Sentiment Classification (SC) tasks reveals the consistent challenge of Neutral across a spectrum of tasks, learning paradigms, and models together with human annotation disagreement Nie et al. (2020). These findings verify the concept and establish the estimation of inherent class hardness.
Then, we study how to measure these class-specific properties leading to consistent class-wise hardness. We first show that naively aggregating Sensitivity Analysis (SA, Hahn et al. 2021) and two similarity-based methods Zhao et al. (2022, 2023a) fails in measuring class-wise hardness across datasets. This stimulates us to propose a specific metric for class-wise hardness measurement beyond the instance-level measurement. We propose an effective, lightweight, and training-free metric, GeoHard, which analyzes data distribution from the geometrical space of semantic embeddings. GeoHard utilizes both inter- and intra-class properties, e.g., Neutral’s MiddleMost and Diverse semantics shown in Figure 1, respectively. Our experiments show that GeoHard demonstrates its exceptional capacity in measuring class-wise hardness, outperforming the instance-level aggregation by over 59 percent on Pearson’s correlation between measurement and reference. Our theoretical and experimental analysis validates its generalization to other tasks without further adaptation.
As for the practical perspective, we show how to use GeoHard to improve task learning with class reorganization Nighojkar et al. (2023). Class reorganization targets a balanced class performance, e.g., by splitting one hard class into two sub-classes Potts et al. (2021). GeoHard is shown to be able to well interpret the heuristic-based reorganization proposed in the previous work Potts et al. (2021). We demonstrate that class-aware demonstration selection guided by GeoHard also benefits ICL.
Our contribution is three-fold:
- 1.
- 2.
-
3.
We demonstrate the potential application of class-wise hardness measured by GeoHard to interpret class reorganization and improve task learning (Section 6).
2 Formulation of Class-wise Hardness
Here, we define class-wise hardness as the difficulty of the class across all the classes, akin to instance-level hardness Ethayarajh et al. (2022). Formally, given the classes for a classification task where is a class, ’s class-wise hardness can be denoted as . We denote .
As is intractable, we can empirically obtain class-wise hardness by assessing the performance of given the LM , e.g., Flan-T5-Large Raffel et al. (2020) or LLaMA-2-13B Touvron et al. (2023), and learning paradigms , e.g., fine-tuning or ICL. We denote this empirical class-wise hardness conditioned on LMs and learning paradigms as . Therefore, class-wise hardness can be approximated by marginalizing on the pairs of models and learning paradigms :
(1) | ||||
(2) |
In the rest of this section, we calculate empirical class-wise hardness on eight NLI/SC datasets. We observe the consistency of among LMs, learning paradigms, and human annotation, which stimulates us to simplify the approximation of .
2.1 Datasets
We initiate class-wise hardness with 8 NLU datasets, comprising 3 NLI datasets and 5 SC datasets, as shown in Table 6 and Table 7 in Appendix A.1. We chose these datasets based on their popularity and their similar format for comparison. We normalize the label format of the SC datasets to Positive, Neutral, and Negative, as described in Appendix A.2. Lastly, we balance the number of instances within each class222We eliminate the potential influence of class imbalance by randomly sampling the same number of instances belonging to each class in training, validation, and test sets, respectively.. Class imbalance is shown to negatively affect the performance of minority classes Henning et al. (2023).
2.2 Calculation of Empirical Hardness
To achieve a precise and complete approximation on , we encompass various pairs of LMs and learning paradigms for the calculation of , as outlined in Equation 2.
Inter-annotator disagreement
can reflect the difficulty of the instance, namely that the higher human disagreement implies more hardness on data Nie et al. (2020); Basile et al. (2021). Hence, we calculate class-wise human disagreement as the average entropy of the annotation distribution of the instances labeled on MNLI and SNLI 333Only the inter-annotator agreement of MNLI and SNLI is evaluated due to data accessibility.. Referring to Table 11 in the Appendix A.3.1, Neutral’s class-wise human disagreement is the highest, indicating its exceptional hardness w.r.t. human.
% | Roberta-Large | OPT-350M | Flan-T5-Large |
---|---|---|---|
Amazon | 87.671.080.6 | 87.068.779.3 | 88.671.681.3 |
APP | 74.260.173.4 | 73.656.172.6 | 74.359.073.9 |
MNLI | 91.087.292.9 | 86.180.585.8 | 91.387.592.9 |
SICK-E | 92.986.892.4 | 85.879.189.1 | 92.985.792.4 |
SNLI | 92.689.295.3 | 91.086.592.3 | 92.889.795.5 |
SST-5 | 83.153.175.8 | 82.355.671.5 | 83.451.776.1 |
TFNS | 93.086.192.2 | 88.081.188.7 | 87.377.388.0 |
Yelp | 87.975.486.6 | 86.473.585.0 | 88.376.487.0 |
Fine-tuning
To generalize empirical class-wise hardness, models from diverse architectures are chosen: we use Roberta-Large Liu et al. (2019), OPT-350M Zhang et al. (2022), and Flan-T5-Large Chung et al. (2024). These models belong to encoder-only, decoder-only, and encoder-decoder structures, respectively. We train these three models separately on eight datasets following the training setups presented in Appendix A.3. We select the checkpoint with the best F1 score on the validation dataset to evaluate the test set. Table 1 shows that Neutral performs poorest among classes with all three models on all the datasets, verifying Neutral’s consistent hardness w.r.t. fine-tuned LMs.
In-context Learning
Beyond model fine-tuning, we also explore another paradigm using large language models (LLMs), where the answer is elicited from LLMs by injecting a cue or instruction Ye et al. (2023). Specifically, we conduct experiments on MNLI and SNLI using Flan-T5-XXL and LLaMA-2-13B. The templates employed are shown in Appendix A.3.2, and Neutral’s relative hardness stands referring to Table 12.
Figure 2 demonstrates Neutral’s consistent hardness, e.g., in SNLI, across various LMs , learning paradigms , and human annotation, revealing that its class-wise hardness is intrinsic. Given this observation, we further relax the approximation of in Equation 2 that if the correlation among with (, ) pairs is higher than a specific threshold, we can approximate with with arbitrary and :
(3) |
![Refer to caption](x2.png)
3 GeoHard for class-wise hardness measurement
Regarding the intrinsic class-wise hardness shown in Section 2, we quantitatively measure the corresponding empirical hardness motivated by its semantic properties, e.g., Diverse and Middlemost semantics of Neutral. Specifically, as the name suggests, GeoHard measures class-wise hardness by computing the geometrical metrics in the semantic embedding space.
3.1 Notations
The set of classes is denoted as . The dataset with instances is denoted as , where is the input and is the corresponding label. And signifies model parameters. presents L1(2)-norm. The input instances of the label is denoted by , i.e., .
3.2 GeoHard
![Refer to caption](x3.png)
Semantic representation
As GeoHard aims to measure class-wise hardness through modeling semantics, a sentence encoder is therefore required, which maps a sentence to a vector with a dimension . We denote this mapping function as .
Semantics-guided metrics
GeoHard consists of intra- and inter-class metrics modeling two semantics properties, as illustrated in Figure 3. The intra-class metric, corresponding to Diverse semantics, quantifies the distributional variance within one class, formulated as:
(4) |
where denotes the element-wise variance across the instances, i.e., .
Middlemost semantics indicate one class is located closer to other classes in the representation space. Hence, the inter-class metric calculates the average distance from one class center to the other classes. The opposition aims to unite with the regarding the overall hardness tendency:
where presents the element-wise mean operation across the input set, that is .
To this end, GeoHard of one specific class is the amalgamation of the class-wise intra- and inter-class metrics, i.e., . And the higher GeoHard indicates more class-wise hardness, i.e., a poorer performance.
3.3 Implementation
According to the open reference 444E5-large-v2 led Massive Text Embeddings Benchmark leaderboard Muennighoff et al. (2023) at the time of the work., we apply E5-large-v2 Wang et al. (2022) to project sentences to a high dimensional space. Jha and Mihata (2021) point out that the nonlinear dimension reduction on contextualized representation benefits downstream tasks. Therefore, we apply Uniform Manifold Approximation and Projection (UMAP; McInnes et al. 2018) to compress sentence representation to 555We set for visualization in the experiment.. The complete encoder consists of E5-large-v2 and UMAP 666As E5-large-v2 is trained to capture uni-sentence semantics, we concatenate premise and hypothesis in NLI tasks with six conjunctive words or phrases shown in Appendix C.1.1 referring to the templates applied in Gao et al. 2021..
SC | NLI | Macro Avg. (Absolute) | |||||||
---|---|---|---|---|---|---|---|---|---|
Amazon | APP | SST-5 | TFNS | Yelp | MNLI | SNLI | SICK-E | ||
SA | .4730 | -.9620 | -.2244 | -.9047 | .8980 | -.7219 | .3930 | -.9962 | .2556.4961 |
Thrust | -.9780 | .9012 | .0833 | .5157 | .9952 | .0000 | .8311 | .0000 | .2936.3792 |
Spread | -.6350 | .4550 | .8369 | .9944 | -.2148 | .4292 | -.3934 | .8471 | .2899.3412 |
GeoHard-Intra | .5857 | .9539 | .9892 | -.1574 | .9947 | .9784 | .8805 | .6647 | .7362.1354 |
GeoHard-Inter | .9997 | .9964 | .9908 | .9722 | .9978 | .1500 | .9042 | .3663 | .7972.1006 |
GeoHard | .9998 | .9958 | .9909 | .8852 | .9977 | .8384 | .8882 | .4871 | .8854.0262 |
4 Experiments
4.1 Baseline: Instance Hardness Aggregation
Sensitivity Analysis Hahn et al. (2021)
measures data hardness by assessing how perturbations in the input affect a model’s prediction. It calculates the model’s prediction confidence for an instance and its perturbed neighbor on the golden label. A larger derivative between these confidences, i.e., higher sensitivity, signifies greater hardness.
As for the class-wise hardness, we average the sensitivity values of the samples in each class. The higher class-wise sensitivity suggests more difficulty in the class, in consistency with Hahn et al. (2021). We take the finetuned Roberta-Large in Section 2.2 as the reference model. More implementation details can be found in Appendix B.2.
Spread Zhao et al. (2022) & Thrust Zhao et al. (2023b)
measure the instance-level hardness by estimating the similarity between test instances and training samples. Concretely, Spread calculates the semantic similarity between test instances and a few-shot closest training samples, using the sentence encoders. E5-large-v2 Wang et al. (2022) is also applied by Spread in line with GeoHard, and the number of training selections is 8. Thrust calculates the distance of the decoded instance representation by LLMs between training and test sets. We apply the identical LLM as the original work, i.e., Flan-T5-Large fine-tuned on UnifiedQA dataset 777https://huggingface.co/allenai/unifiedqa-t5-large Khashabi et al. (2020).
As both methods are similarity-based, the smaller similarity indicates more hardness. To this end, we average Spread scores in each class as the class-wise metrics. For Thrust, we select the bottom 25 percentile of Thrust scores in each class as the aggregation 888The reason we do not average Thrust for class-wise hardness here is that this metric is inversely proportional to the distance. Therefore, Thrust values will come to infinity when the test sample is extremely close to the training set.. Appendix B.3 and B.4 present their detailed implementation.
4.2 Quantification of class-wise hardness
We benchmark the instance-aggregating methods (SA, Spread, and Thrust) as well as GeoHard, including its intra- and inter-class metrics, on the eight NLI/SC datasets in Section 2.
Section 2 illustrates the consistency between LMs and humans regarding class-wise hardness, and this allows us to select an arbitrary empirical class-wise hardness as a close approximation of . Consequently, we apply the class-wise F1 scores from fine-tuned Roberta-Large as the hardness reference. Following the previous work Zhao et al. (2022), we determine the effectiveness of various metrics by calculating Pearson’s correlation coefficient between metrics and the hardness reference (Table 2). Considering negative correlation, we take the absolute value of average correlations as shown in the right-most column, namely that higher values indicate better measurement.
4.3 Analysis on Experimental Results
Table 2 presents the correlation between class-wise hardness measurement and the reference hardness on these eight NLI/SC datasets. The class-wise SA, Spread, and Thrust are shown to be poorly correlated to the reference, with average correlations of 0.2556, 0.2936, and 0.2899, respectively. Their large variance in correlation across tasks indicates their incompetence in class-wise hardness measurement. Meanwhile, GeoHard significantly outperforms these instance-level methods, exhibiting the lowest variance across the tasks. In addition to these metrics, GeoHard surpasses its components, namely the intra- and inter-class metrics, highlighting their complementarity and underscoring GeoHard’s comprehension of class-specific properties.
5 Generalization of GeoHard
The previous section showcased the exceptional performance of GeoHard in measuring hardness in NLI and SC tasks by leveraging class-wise semantic properties. In this section, we explore GeoHard’s robustness and generalization both theoretically and empirically. We conduct the experiments to demonstrate GeoHard’s generalization capabilities across various sentence encoders and other types of tasks, further substantiating the connection between class-wise hardness and semantics. Furthermore, we highlight GeoHard’s robustness in low resource scenarios, showcasing its advantage as a training-free metric.
5.1 Theoretical proof on generalization
GeoHard’s robustness is evident in its ability to effectively elucidate factors contributing to class-wise hardness, such as overfitting depicted in Figure 4. The intra-class metric within GeoHard serves to gauge the extent of overfitting, namely, the divergence between training and test data, as elaborated in the following Theorem 1.
Theorem 1
Assuming a Gaussian distribution for instances within , , the means of the training and test data can be represented as and , where and are the sizes of the training and test sets within , respectively. Note that, conditioned on the class , the data is i.i.d. as mentioned above. By applying Chebyshev’s inequality Mitrinovic et al. (2013), the following inequality holds for any arbitrary (see mathematical derivation in Appendix D.1):
(5) |
Hence, for any arbitrary , the data variance reflected by , as depicted in Equation 4, serves as an estimation for the distributional gap , indicating the overfitting degree of .
![Refer to caption](x4.png)
5.2 Cross-embeddings generalization
We incorporate two other architectures of sentence embeddings, i.e., GTE-large Li et al. (2023) and BGE-large-en-v1.5 Xiao et al. (2023) into GeoHard, substituting E5-large-v2. Observing Figure 5, we find a consistent trend of GeoHard’s measurement across different sentence embeddings. The significant gap between GeoHard and the instance-level aggregation underscores the robustness of GeoHard as a semantic-guided metric.
![Refer to caption](x5.png)
5.3 Cross-task generalization
Complementary to the theoretical generalization, we further validate GeoHard on other tasks beyond SC and NLI, i.e., topic classification and emotion detection. We include AG News Zhang et al. (2015), Yahoo Answer Topic (Yahoo; Zhang et al. 2015) for the former and Emo2019 (Emo; Chatterjee et al. 2019), Contextualized Affect Affect Representations for Emotion Recognition (CARAR; Saravia et al. 2018) for the latter.
We fine-tune Roberta-Large on these four datasets to obtain the reference empirical hardness, i.e., class-wise F1 scores, and also conduct GeoHard, referring to Table 16-19 in Appendix D.3. According to Table 3, the consistency between the measurement and reference on the tasks other than NLI and SC empirically exhibits the generalization of GeoHard for class-wise hardness measurement.
AG News | Yahoo | Emo | CARAR | |
---|---|---|---|---|
GeoHard | -.980.0 | -.838.0 | -.798.1 | -.817.1 |
5.4 Robustness in low-resource scenarios
In this section, we will demonstrate the robustness of our method in low-resource scenarios. We have randomly selected 1%, 10%, and 100% of the instances from the training corpus across five SC datasets included in Section 4. As illustrated in Figure 6, GeoHard exhibits notably less performance degradation in low-resource settings compared to PVI Ethayarajh et al. (2022), underscoring its robustness as a training-free method.
![Refer to caption](x6.png)
6 Why class-wise hardness measurement?
In the previous sections, we establish the concept of class-wise hardness, which can be well and robustly measured by GeoHard. One of the most relevant literature for the application of GeoHard is class reorganization.
Class reorganization has received relatively limited attention compared to research focusing on addressing class imbalance Subramanian et al. (2021); Henning et al. (2023), primarily due to extra annotation. However, initial task formulations are rarely perfect, and as research progresses, class reorganization becomes necessary for a more comprehensive understanding and effective modeling of the task. For example, in NLI, the task evolved from a 2-way classification Dagan et al. (2005) to a 3-way classification by separating Non-Entailment into Neutral and Contradiction. Recently, Nighojkar et al. (2023) further subdivided Neutral into two distinct classes based on human disagreement.
As for the practical perspective, class reorganization can balance the model performance among the classes Potts et al. (2021). To resolve the severe imbalance between Neutral and other classes in SC dataset, as shown in Table 1, Dynasent Potts et al. (2021) opted to split Neutral to Mixed (a mixture of positive and negative sentiment) and Neutral (conveying nothing regarding sentiment). This approach aims to achieve a coherent categorization, which narrows the performance gap among classes.
In this section, we use Dynasant Potts et al. (2021) as an example to demonstrate how measuring class-wise hardness can aid in interpreting class reorganization and facilitate the learning process.
6.1 GeoHard interprets class reorganization
GeoHard can provide insights into two crucial questions regarding class reorganization: what and how to reorganize classes. Firstly, even without training a model, GeoHard can directly provide hardness estimates across the original classes to locate the operating target. Secondly, GeoHard can assess the effectiveness of the formulation strategy and hence guide the class reorganization.
We conduct GeoHard on classes before and after Dynasent’s class reorganization, which splits Neutral to Mixed and Neutral. For comparison, we randomly split Neutral into two classes, labeled Rand1 and Rand2. As illustrated in Figure 7, the Neutral and Mixed are shown to be highly separable, indicating their distinction in semantics.
As shown in Table 4, the new classes Mixed and Neutral exhibit lower class-wise hardness compared to the original Neutral. The standard derivation among class-wise hardness on the newly organized Dynasent drops by 40.9% (from 1.15 to 0.68). This clearly explains the coherent class formation by reorganizing Neutral into two sub-classes. However, not all class reorganizations yield beneficial outcomes: a random split may result in high overall class-wise hardness and a severe imbalance of class-wise hardness.
![Refer to caption](x7.png)
![Refer to caption](x8.png)
Positive | Neutral | Negative | Std | |
---|---|---|---|---|
-5.58 | -3.08 | -5.48 | 1.15 | |
Positive | Rand1 | Rand2 | Negative | Std |
-3.89 | -0.71 | -0.71 | -3.62 | 1.53 |
Positive | Mixed | Neutral | Negative | Std |
-5.24 | -4.26 | -3.41 | -4.78 | 0.68 |
6.2 GeoHard propels task learning
We have demonstrated that GeoHard can interpret and validate the reorganization of labels. Next, we further investigate how to leverage the class-wise hardness knowledge and its induced class reorganization to enhance task learning, with methods such as ICL. Typically, ICL samples the demonstrations uniformly across classes Min et al. (2022). Here, we demonstrate the benefits of splitting the hardest class into two easier ones in ICL, elucidating the significance of class-wise hardness.
We divide each class into two sub-classes and select instances from these newly formed classes. For classes Positive and Negative, which lack prepared sub-classes, we employ KMeans on the embeddings to separate instances within each class into two sub-classes Zhang et al. (2023); Yang et al. (2023). Then, we select the center of each cluster as a demonstration. For example, if Positive is selected for reorganization, the demonstrations consist of 2 Positive instances, 1 Neutral instance, and 1 Negative instance. For convenience, we abbreviate the selection as 2P+1Neu+1N.
We randomly sample 1,000 instances from each class from 3-way Dynasent Potts et al. (2021), wherein Neutral class contains 500 Mixed instances and 500 new-formed Neutral instances. We conduct ICL on two popular LLMs, i.e., OPT-6.7B Zhang et al. (2022) and Llama-2-7B-32K-Instruct Touvron et al. (2023) with different setups of demonstrations: (1) even sampling: 1P+1Neu+1N; (2) sampling based on class reorganization: 2P+1Neu+1N, 1P+2Neu+1N, and 1P+1Neu+2N. For both setups, we select the centroid instance from each cluster. The examples of demonstrations can be found in Appendix D.5.
As shown in Table 5, both models utilizing the setup 1P+2Neu+1N attain the best performance, which is the advocated action from GeoHard since Neutral is measured as the hardest class and the new classes Mixed and Neutral are relatively easier. However, reconstructing other classes may not lead to such benefits in learning and can even lead to significant degradation (e.g., 2P with LLama-7B).
Demonstration % | OPT-6.7B | LLama-7B |
---|---|---|
1P+1Neu+1N | 61.73.54 | 61.41.82 |
2P+1Neu+1N | 61.10.02 | 39.610.71 |
1P+2Neu+1N | 64.31.24 | 69.91.74 |
1P+1Neu+2N | 60.41.69 | 34.93.36 |
7 Related works
Hardness in NLP datasets
Instance-level hardness indicates the difficulty of an instance given a distribution Ethayarajh et al. (2022), and the taxonomy is summarized in Figure 9 in Appendix B.1. Without training, the reference model or embedding is usually needed. With a model as the reference, Sensitivity Analysis Hahn et al. (2021); Chen et al. (2023) assesses hardness by perturbing input features and observing the resulting changes in model predictions. Additionally, Thrust Zhao et al. (2023a) approximates instance hardness based on the external knowledge required by an LLM. In parallel with the model reference, Spread Zhao et al. (2022) leverages the similarity between test and training samples in the space of semantic embeddings for hardness measurement. Alternatively, information theory-based methods, such as point-wise V-usable information (PVI; Ethayarajh et al. 2022) and Rissanen Data Analysis (RDA; Perez et al. 2021), offer insights into data hardness using training outcomes. Moreover, other methods measure data hardness from training dynamics, including dataset cartography Swayamdipta et al. (2020), forgetting scores Toneva et al. (2019), and Error L2-Norm Paul et al. (2021), etc 999We include the class-wise hardness measurement with some training-based methods and training-dynamics methods in Appendix D.4. This work primarily focuses on the training-free methods, which are more practical and scalable for gauging hardness with LLMs.
Although instance-level hardness is well studied, class-wise hardness is under-explored. Therefore, our work explores the class-wise measurement by aggregating the existing instance-level methods first and then specifically designs GeoHard, which requires no additional data or training.
Geometrical view of classification complexity
In the context of general machine learning, prior research Ho and Basu (2002); Lorena et al. (2019) assesses the difficulty of a classification problem through the analysis of data geometry and inter- and intra-class distribution. Various metrics of quantification, such as Fisher’s discriminant ratio Cummins (2013), overlapping regions Seijo-Pardo et al. (2019) and network measures Garcia et al. (2015), have been proposed to qualify class-wise complexity based on geometric features.
Sentences encoders Reimers and Gurevych (2019) excel at generating high-dimension sentence embeddings based on semantics. We explore class-wise hardness by leveraging geometrical features within and among the classes, inspired by Neutral’s specific semantics.
Neutral in NLU
Neutral depicts undetermined or middlemost semantics while ruling out other classes, and widely exists in NLU tasks such as NLI Williams et al. (2018); Bowman et al. (2015) and SC Sun et al. (2019). Generally, the class with the prefix Non- also delivers similar semantics with Neutral, i.e., excluding other classes. For instance, the Microsoft Research Paraphrase (MRPC; Dolan and Brockett 2005) dataset aims to determine whether a pair of questions are semantically equivalent, i.e., to classify sentence pairs to Equivalent and Non-equivalent. In GLUE Wang et al. (2019)), six of nine tasks contain a Neutral or Non- class, indicating the wide existence of classes with undetermined semantics in NLU.
Due to Neutral’s semantic prevalence, we initiate class-wise hardness from exploring the tasks containing Neutral and then extend to general classes.
8 Conclusion
In this work, to study how class-specific properties influence model learning, we initiate the notion of class-wise hardness analogous to instance-level hardness. The consistent pattern observed across various LMs, learning paradigms, and human annotations on eight NLU datasets affirms the presence of class-wise hardness as an inherent property. In addressing the challenge of estimating class-wise hardness, conventional instance-level metrics fall short, necessitating a tailored approach to measure hardness specifically at the class level. Thus, we introduce GeoHard, which models both inter- and intra-class semantics, surpassing instance-level aggregation by 59%. Moreover, GeoHard, formulated with a foundation in semantics, demonstrates robust generalization properties, as validated both theoretically and empirically. Lastly, we showcase the potential of GeoHard in reorganizing classes and enhancing task-learning methodologies. We recommend more attention to class-wise hardness and exploring its potential across a broader range of scenarios.
Limitations
Our work, introducing the concept of class-wise hardness and proposing a practical metric, does come with specific limitations that justify further exploration. Firstly, as an initiative work, we only cover limited types of classification tasks in NLU due to the space constraint. Some classification problems such as sequence labeling He et al. (2020) are not covered in our scope. Class-wise hardness for other formats of classification tasks is still obscure and needs further exploration. Secondly, as our proposed method GeoHard is built upon the pre-trained sentence encoders, they inherit their corresponding limitations. For example, it will be intricate to measure class-wise hardness in the complex semantics or long inputs. These cases can not be well modeled by a single-sentence encoder yet. Combining the two problems above leads to a new issue. Hypothetically, given the assumption that the class-wise hardness for other formats of NLP problems still exists, how to model them will be the potential concern, as it is beyond the capacity of sentence encoders. Regarding the application of GeoHard and the class-wise hardness that it measures, we have not gone deeper into this problem. A larger-scale study is expected to further explore this topic. In conclusion, further efforts are expected to overcome the limitations of this work.
Ethical Statements
We foresee no major ethical concerns in our work. The datasets we used in this work are all publicly available. As far as we see, there is no sensitive information included. For the language models we applied, the outputs, i.e., the class labels, are not sensitive either.
Acknowledgement
We thank Sheng Lu, Kexin Wang, Indraneil Paul, Hendrik Schuff, and Sherry Tongshuang Wu for their feedback on an early draft of this work. Fengyu Cai is funded by the German Federal Ministry of Education and Research and the Hessian Ministry of Higher Education, Research, Science, and the Arts within their joint support of the National Research Center for Applied Cybersecurity ATHENE. Xinran Zhao is funded by the ONR Award N000142312840.
References
- Basile et al. (2021) Valerio Basile, Michael Fell, Tommaso Fornaciari, Dirk Hovy, Silviu Paun, Barbara Plank, Massimo Poesio, and Alexandra Uma. 2021. We need to consider disagreement in evaluation. In Proceedings of the 1st Workshop on Benchmarking: Past, Present and Future, pages 15–21, Online. Association for Computational Linguistics.
- Bowman et al. (2015) Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 632–642, Lisbon, Portugal. Association for Computational Linguistics.
- Chatterjee et al. (2019) Ankush Chatterjee, Kedhar Nath Narahari, Meghana Joshi, and Puneet Agrawal. 2019. SemEval-2019 task 3: EmoContext contextual emotion detection in text. In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 39–48, Minneapolis, Minnesota, USA. Association for Computational Linguistics.
- Chen et al. (2020) Tongfei Chen, Zhengping Jiang, Adam Poliak, Keisuke Sakaguchi, and Benjamin Van Durme. 2020. Uncertain natural language inference. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8772–8779, Online. Association for Computational Linguistics.
- Chen et al. (2023) Yanda Chen, Chen Zhao, Zhou Yu, Kathleen McKeown, and He He. 2023. On the relation between sensitivity and accuracy in in-context learning. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 155–167, Singapore. Association for Computational Linguistics.
- Chung et al. (2024) Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Yunxuan Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. 2024. Scaling instruction-finetuned language models. Journal of Machine Learning Research, 25(70):1–53.
- Cummins (2013) Lisa Cummins. 2013. Combining and choosing case base maintenance algorithms. Ph.D. thesis, University College Cork, Republic of Ireland.
- Dagan et al. (2005) Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The PASCAL recognising textual entailment challenge. In MLCW, volume 3944 of Lecture Notes in Computer Science, pages 177–190. Springer.
- Dolan and Brockett (2005) William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005).
- Ethayarajh et al. (2022) Kawin Ethayarajh, Yejin Choi, and Swabha Swayamdipta. 2022. Understanding dataset difficulty with V-usable information. In International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pages 5988–6008. PMLR.
- Gao et al. (2021) Tianyu Gao, Adam Fisch, and Danqi Chen. 2021. Making pre-trained language models better few-shot learners. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 3816–3830, Online. Association for Computational Linguistics.
- Garcia et al. (2015) Luís Paulo F. Garcia, André C. P. L. F. de Carvalho, and Ana Carolina Lorena. 2015. Effect of label noise in the complexity of classification problems. Neurocomputing, 160:108–119.
- Grano et al. (2017) Giovanni Grano, Andrea Di Sorbo, Francesco Mercaldo, Corrado Aaron Visaggio, Gerardo Canfora, and Sebastiano Panichella. 2017. Android apps and user feedback: a dataset for software evolution and quality improvement. In WAMA@ESEC/SIGSOFT FSE, pages 8–11. ACM.
- Hahn et al. (2021) Michael Hahn, Dan Jurafsky, and Richard Futrell. 2021. Sensitivity as a complexity measure for sequence classification tasks. Transactions of the Association for Computational Linguistics, 9:891–908.
- Harris et al. (2020) Charles R. Harris, K. Jarrod Millman, Stéfan J. van der Walt, Ralf Gommers, Pauli Virtanen, David Cournapeau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J. Smith, Robert Kern, Matti Picus, Stephan Hoyer, Marten H. van Kerkwijk, Matthew Brett, Allan Haldane, Jaime Fernández del Río, Mark Wiebe, Pearu Peterson, Pierre Gérard-Marchant, Kevin Sheppard, Tyler Reddy, Warren Weckesser, Hameer Abbasi, Christoph Gohlke, and Travis E. Oliphant. 2020. Array programming with NumPy. Nature, 585(7825):357–362.
- He et al. (2020) Zhiyong He, Zanbo Wang, Wei Wei, Shanshan Feng, Xianling Mao, and Sheng Jiang. 2020. A survey on recent advances in sequence labeling from deep learning models. ArXiv preprint, abs/2011.06727.
- Henning et al. (2023) Sophie Henning, William Beluch, Alexander Fraser, and Annemarie Friedrich. 2023. A survey of methods for addressing class imbalance in deep-learning based natural language processing. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, pages 523–540, Dubrovnik, Croatia. Association for Computational Linguistics.
- Ho and Basu (2002) Tin Kam Ho and Mitra Basu. 2002. Complexity measures of supervised classification problems. IEEE transactions on pattern analysis and machine intelligence, 24(3):289–300.
- Hunter (2007) John D Hunter. 2007. Matplotlib: A 2d graphics environment. Computing in science & engineering, 9(03):90–95.
- Jha and Mihata (2021) Rishi Jha and Kai Mihata. 2021. On geodesic distances and contextual embedding compression for text classification. In Proceedings of the Fifteenth Workshop on Graph-Based Methods for Natural Language Processing (TextGraphs-15), pages 144–149, Mexico City, Mexico. Association for Computational Linguistics.
- Keung et al. (2020) Phillip Keung, Yichao Lu, György Szarvas, and Noah A. Smith. 2020. The multilingual Amazon reviews corpus. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4563–4568, Online. Association for Computational Linguistics.
- Khashabi et al. (2020) Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. 2020. UNIFIEDQA: Crossing format boundaries with a single QA system. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1896–1907, Online. Association for Computational Linguistics.
- Kong et al. (2020) Lingkai Kong, Haoming Jiang, Yuchen Zhuang, Jie Lyu, Tuo Zhao, and Chao Zhang. 2020. Calibrated language model fine-tuning for in- and out-of-distribution data. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1326–1340, Online. Association for Computational Linguistics.
- Li et al. (2023) Zehan Li, Xin Zhang, Yanzhao Zhang, Dingkun Long, Pengjun Xie, and Meishan Zhang. 2023. Towards general text embeddings with multi-stage contrastive learning. ArXiv preprint, abs/2308.03281.
- Liu et al. (2019) Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized BERT pretraining approach. ArXiv preprint, abs/1907.11692.
- Lorena et al. (2019) Ana C Lorena, Luís PF Garcia, Jens Lehmann, Marcilio CP Souto, and Tin Kam Ho. 2019. How complex is your classification problem? a survey on measuring classification complexity. ACM Computing Surveys (CSUR), 52(5):1–34.
- Marelli et al. (2014) Marco Marelli, Stefano Menini, Marco Baroni, Luisa Bentivogli, Raffaella Bernardi, and Roberto Zamparelli. 2014. A SICK cure for the evaluation of compositional distributional semantic models. In Proceedings of the Ninth International Conference on Language Resources and Evaluation (LREC’14), pages 216–223, Reykjavik, Iceland. European Language Resources Association (ELRA).
- McInnes et al. (2018) Leland McInnes, John Healy, Nathaniel Saul, and Lukas Großberger. 2018. Umap: Uniform manifold approximation and projection. Journal of Open Source Software, 3(29):861.
- McKinney (2010) Wes McKinney. 2010. Data structures for statistical computing in python. In Proceedings of the 9th Python in Science Conference 2010 (SciPy 2010), Austin, Texas, June 28 - July 3, 2010, pages 56–61. scipy.org.
- Min et al. (2022) Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2022. Rethinking the role of demonstrations: What makes in-context learning work? In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 11048–11064, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
- Mitrinovic et al. (2013) Dragoslav S Mitrinovic, Josip Pecaric, and Arlington M Fink. 2013. Classical and new inequalities in analysis, volume 61. Springer Science & Business Media.
- Muennighoff et al. (2023) Niklas Muennighoff, Nouamane Tazi, Loic Magne, and Nils Reimers. 2023. MTEB: Massive text embedding benchmark. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, pages 2014–2037, Dubrovnik, Croatia. Association for Computational Linguistics.
- Nie et al. (2020) Yixin Nie, Xiang Zhou, and Mohit Bansal. 2020. What can we learn from collective human opinions on natural language inference data? In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9131–9143, Online. Association for Computational Linguistics.
- Nighojkar et al. (2023) Animesh Nighojkar, Antonio Laverghetta Jr., and John Licato. 2023. No strong feelings one way or another: Re-operationalizing neutrality in natural language inference. In Proceedings of the 17th Linguistic Annotation Workshop (LAW-XVII), pages 199–210, Toronto, Canada. Association for Computational Linguistics.
- Paszke et al. (2019) Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. 2019. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 8024–8035.
- Paul et al. (2021) Mansheej Paul, Surya Ganguli, and Gintare Karolina Dziugaite. 2021. Deep learning on a data diet: Finding important examples early in training. In Advances in Neural Information Processing Systems.
- Perez et al. (2021) Ethan Perez, Douwe Kiela, and Kyunghyun Cho. 2021. Rissanen data analysis: Examining dataset characteristics via description length. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pages 8500–8513. PMLR.
- Potts et al. (2021) Christopher Potts, Zhengxuan Wu, Atticus Geiger, and Douwe Kiela. 2021. DynaSent: A dynamic benchmark for sentiment analysis. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2388–2404, Online. Association for Computational Linguistics.
- Raffel et al. (2020) Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1–140:67.
- Reimers and Gurevych (2019) Nils Reimers and Iryna Gurevych. 2019. Sentence-BERT: Sentence embeddings using Siamese BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982–3992, Hong Kong, China. Association for Computational Linguistics.
- Saravia et al. (2018) Elvis Saravia, Hsien-Chi Toby Liu, Yen-Hao Huang, Junlin Wu, and Yi-Shin Chen. 2018. CARER: Contextualized affect representations for emotion recognition. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3687–3697, Brussels, Belgium. Association for Computational Linguistics.
- Seijo-Pardo et al. (2019) Borja Seijo-Pardo, Verónica Bolón-Canedo, and Amparo Alonso-Betanzos. 2019. On developing an automatic threshold applied to feature selection ensembles. Information Fusion, 45:227–245.
- Shrestha and Nasoz (2019) Nishit Shrestha and Fatma Nasoz. 2019. Deep learning sentiment analysis of amazon.com reviews and ratings. ArXiv preprint, abs/1904.04096.
- Socher et al. (2013) Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631–1642, Seattle, Washington, USA. Association for Computational Linguistics.
- Subramanian et al. (2021) Shivashankar Subramanian, Afshin Rahimi, Timothy Baldwin, Trevor Cohn, and Lea Frermann. 2021. Fairness-aware class imbalanced learning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 2045–2051, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
- Sun et al. (2019) Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. 2019. Rotate: Knowledge graph embedding by relational rotation in complex space. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net.
- Swayamdipta et al. (2020) Swabha Swayamdipta, Roy Schwartz, Nicholas Lourie, Yizhong Wang, Hannaneh Hajishirzi, Noah A. Smith, and Yejin Choi. 2020. Dataset cartography: Mapping and diagnosing datasets with training dynamics. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9275–9293, Online. Association for Computational Linguistics.
- Toneva et al. (2019) Mariya Toneva, Alessandro Sordoni, Remi Tachet des Combes, Adam Trischler, Yoshua Bengio, and Geoffrey J. Gordon. 2019. An empirical study of example forgetting during deep neural network learning. In International Conference on Learning Representations.
- Torralba and Efros (2011) Antonio Torralba and Alexei A. Efros. 2011. Unbiased look at dataset bias. In The 24th IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2011, Colorado Springs, CO, USA, 20-25 June 2011, pages 1521–1528. IEEE Computer Society.
- Touvron et al. (2023) Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton-Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurélien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. 2023. Llama 2: Open foundation and fine-tuned chat models. ArXiv preprint, abs/2307.09288.
- Vodrahalli et al. (2018) Kailas Vodrahalli, Ke Li, and Jitendra Malik. 2018. Are all training examples created equal? an empirical study. ArXiv preprint, abs/1811.12569.
- Wang et al. (2019) Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net.
- Wang et al. (2022) Liang Wang, Nan Yang, Xiaolong Huang, Binxing Jiao, Linjun Yang, Daxin Jiang, Rangan Majumder, and Furu Wei. 2022. Text embeddings by weakly-supervised contrastive pre-training. ArXiv preprint, abs/2212.03533.
- Williams et al. (2018) Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1112–1122, New Orleans, Louisiana. Association for Computational Linguistics.
- Wolf et al. (2019) Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. 2019. Huggingface’s transformers: State-of-the-art natural language processing. ArXiv preprint, abs/1910.03771.
- Xiao et al. (2023) Shitao Xiao, Zheng Liu, Peitian Zhang, and Niklas Muennighof. 2023. C-pack: Packaged resources to advance general chinese embedding. ArXiv preprint, abs/2309.07597.
- Xie et al. (2023) Sang Michael Xie, Shibani Santurkar, Tengyu Ma, and Percy Liang. 2023. Data selection for language models via importance resampling. In Thirty-seventh Conference on Neural Information Processing Systems.
- Yang et al. (2023) Zhao Yang, Yuanzhe Zhang, Dianbo Sui, Cao Liu, Jun Zhao, and Kang Liu. 2023. Representative demonstration selection for in-context learning with two-stage determinantal point process. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 5443–5456, Singapore. Association for Computational Linguistics.
- Ye et al. (2023) Seonghyeon Ye, Hyeonbin Hwang, Sohee Yang, Hyeongu Yun, Yireun Kim, and Minjoon Seo. 2023. In-context instruction learning. ArXiv preprint, abs/2302.14691.
- Ye et al. (2024) Seonghyeon Ye, Hyeonbin Hwang, Sohee Yang, Hyeongu Yun, Yireun Kim, and Minjoon Seo. 2024. Investigating the effectiveness of task-agnostic prefix prompt for instruction following. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pages 19386–19394.
- Zhang et al. (2022) Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona T. Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. 2022. OPT: open pre-trained transformer language models. ArXiv preprint, abs/2205.01068.
- Zhang et al. (2015) Xiang Zhang, Junbo Jake Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 649–657.
- Zhang et al. (2023) Zhuosheng Zhang, Aston Zhang, Mu Li, and Alex Smola. 2023. Automatic chain of thought prompting in large language models. In The Eleventh International Conference on Learning Representations.
- Zhao et al. (2022) Xinran Zhao, Shikhar Murty, and Christopher Manning. 2022. On measuring the intrinsic few-shot hardness of datasets. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 3955–3963, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
- Zhao et al. (2023a) Xinran Zhao, Hongming Zhang, Xiaoman Pan, Wenlin Yao, Dong Yu, and Jianshu Chen. 2023a. Thrust: Adaptively propels large language models with external knowledge. ArXiv preprint, abs/2307.10442.
- Zhao et al. (2023b) Xinran Zhao, Hongming Zhang, Xiaoman Pan, Wenlin Yao, Dong Yu, and Jianshu Chen. 2023b. Thrust: Adaptively propels large language models with external knowledge. In Thirty-seventh Conference on Neural Information Processing Systems.
- Zhou et al. (2023) Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, Susan Zhang, Gargi Ghosh, Mike Lewis, Luke Zettlemoyer, and Omer Levy. 2023. LIMA: less is more for alignment. ArXiv preprint, abs/2305.11206.
Appendix
Appendix A Validation of class-wise hardness
A.1 Dataset
Dataset | Description | Statistics (train/dev/test) |
---|---|---|
Amazon Review Multi en † (Amazon; Keung et al. 2020) | an Amazon product reviews dataset for multilingual text classification (we only use English part) | 120,000 / 3,000 / 3,000 |
App Reviews † (APP; Grano et al. 2017) | Android app reviews categorized classifying types of user feedback from a software maintenance and evolution perspective | 56,151 / 6,804 / 6,633 |
MultiNLI ‡ (MNLI; Williams et al. 2018) | Multi-Genre Natural Language Inference annotated with textual entailment information | 353,408 / 39,270 / 9,369 |
SICK-E ‡ Marelli et al. (2014) | A dataset targeting Natural Language Inference | 1,920 / 213 / 2,136 |
SNLI ‡ Bowman et al. (2015) | Stanford Natural Language Inference Corpus | 548,292 / 9,705 / 9,657 |
SST-5 † Socher et al. (2013) | Stanford Sentiment Treebank with 5 labels | 4,872 / 1,332 / 1,332 |
Twitter Financial News Sentiment † 101010https://huggingface.co/datasets/zeroshot/twitter-financial-news-sentiment (TFNS) | A dataset is used to classify finance-related tweets for their sentiment | 3,891 / 435 / 1,041 |
Yelp review † (Yelp; Zhang et al. 2015) | A dataset containing custom reviews from Yelp | 351,000 / 39,000 / 30,000 |
Dataset | Example | Original labels | Original statistics |
---|---|---|---|
Amazon Review Multi en (Amazon; Keung et al. 2020) |
Title: bubble
Body: went through 3 in one day doesn’t fit correct and couldn’t get bubbles out (better without) |
1, 2, 3, 4, 5 | 200,000 / 5,000 / 5,000 |
App Reviews (APP; Grano et al. 2017) | simple and perfect About this software rtl sdr is very useful … installed done. Thanks. | 1, 2, 3, 4, 5 | 230,452 / 28,806 / 28,807 |
MultiNLI (MNLI; Williams et al. 2018) |
Premise: I burst through a set of cabin doors, and fell to the ground.
Hypothesis: I burst through the doors and fell down. |
Entailment/Neutral/ Contradiction | 353,431 / 39,271 / 9,815 |
SICK-E Marelli et al. (2014) |
Sentence A: A group of kids is playing in a yard and an old man is standing in the background
Sentence B: A group of boys in a yard is playing and a man is standing in the background |
Entailment/Neutral / Contradiction | 4,439 / 495 / 4,906 |
SNLI Bowman et al. (2015) |
Text: A soccer game with multiple males playing.
Hypothesis: Some men are playing a sport. |
Entailment/Neutral/ Contradiction | 549,367 / 9,842 / 9,824 |
SST-5 Socher et al. (2013) | a metaphor for a modern-day urban china searching for its identity . | very positive/positive/ neutral / negative / very negative | 8,544 / 1,101 / 2,210 |
Twitter Financial News Sentiment 111https://huggingface.co/datasets/zeroshot/twitter-financial-news-sentiment | "$BYND - JPMorgan reels in expectations on Beyond Meat https://t.co/bd0xbFGjkT" | Bearish/ Bullish / Neutral | 8,587 / 956 / 2,388 |
Yelp review (Yelp; Zhang et al. 2015) | Tonya is super sweet and the front desk people are very helpful | 1, 2, 3, 4, 5 | 585,000 / 65,000 / 50,000 |
A.2 Dataset Normalization
We follow the setup of the previous work Shrestha and Nasoz (2019) to convert 5 degrees of sentiment to 3 classes: for Amazon, APP, and Yelp, we map 1 and 2 to Negative, 3 to Neutral, and 4 and 5 to Positive; for SST-5, we map very positive and positive to Positive, and negative and very negative to Negative. for TFNS, the original class labels Bearish and Bullish are mapped to Negative and Positive.
A.3 Experimental Setup
The seeds of training are {1, 10, 100}, and the learning rate is 1e-5. The detailed configuration of Roberta-Large, OPT-350M and Flan-T5-Large, including training are shown at Table 8, 9, and 10. All the experiments are conducted on a single NVIDIA A100.
Datasets | Batch size | Epochs | Seq. length |
---|---|---|---|
Amazon | 16 | 10 | 512 |
APP | 16 | 10 | 256 |
MNLI | 64 | 10 | 128 |
SICK-E | 16 | 10 | 256 |
SST-5 | 16 | 10 | 128 |
SNLI | 20 | 5 | 128 |
TFNS | 16 | 10 | 128 |
Yelp | 24 | 5 | 256 |
Datasets | Batch size | Epochs | Seq. length |
---|---|---|---|
Amazon | 6 | 3 | 256 |
APP | 16 | 10 | 256 |
MNLI | 64 | 5 | 128 |
SICK-E | 16 | 10 | 256 |
SNLI | 64 | 5 | 128 |
SST-5 | 64 | 10 | 128 |
TFNS | 64 | 10 | 128 |
Yelp | 16 | 5 | 256 |
Datasets | Batch size | Epochs | Seq. length |
---|---|---|---|
Amazon | 6 | 3 | 256 |
APP | 6 | 5 | 256 |
MNLI | 12 | 5 | 128 |
SICK-E | 6 | 10 | 256 |
SNLI | 12 | 5 | 128 |
SST-5 | 12 | 10 | 128 |
TFNS | 12 | 10 | 128 |
Yelp | 6 | 5 | 256 |
A.3.1 Neutral’s hardness in human disagreement
We present the human variation on the classification as a hardness measurement from human beings. Table 11 presents the distribution of human disagreement of MNLI Williams et al. (2018) and SNLI Bowman et al. (2015). The high entropy of Neutral reveals its class-wise hardness for humans. For the convenient comparison with other metrics, we take the negative of the entropy to obtain the positive correlation between the knowledge, as shown in Figure 2 and 8.
Entailment | Neutral | Contradiction | |
---|---|---|---|
MNLI | 0.3202 | 0.4717 | 0.2664 |
SNLI | 0.3515 | 0.5175 | 0.2781 |
A.3.2 Neutral’s hardness in LLMs
Regarding the hardness of Neutral w.r.t. LLMs, we conduct two families of LLMs, Flan-T5-XXL Raffel et al. (2020) and LLaMA-2-13B Touvron et al. (2023). The prompting templates for MNLI and SNLI present as follows:
MNLI | SNLI | |||||
---|---|---|---|---|---|---|
Entailment | Neutral | Contradiction | Entailment | Neutral | Contradiction | |
Flan-T5-XXL | 0.90 | 0.87 | 0.94 | 0.90 | 0.88 | 0.93 |
LLaMA-2-13B | 0.51 | 0.28 | 0.50 | 0.41 | 0.39 | 0.55 |
![Refer to caption](x9.png)
Appendix B Hardness measurement
B.1 Taxonomy of hardness measurement
![Refer to caption](x10.png)
B.2 SA
The technical steps of SA are as follows:
-
1)
Train a Roberta-Large model with and evaluate the model with ;
-
2)
By randomly masking several consecutive words on and reconstructing samples with LMs, generate perturbed test dataset , where ;
-
3)
Calculate the confidence for each disturbed input on the golden label with ;
-
4)
The sensitivity for each input is then defined as the maximum value of the deviation between the confidence values for the original and the corresponding perturbed samples .
For each dataset, sensitivity values are averaged on the three Roberta-Large models trained in Table 1.
B.3 Thrust
Thrust Zhao et al. (2023a) measures how likely the query to LLMs can be solved by the internal knowledge of the target model, in other words, how necessary the knowledge is needed to propel the model’s inference. There are two essential assumptions of Thrust: (1) LLMs are expected to well study the given tasks. (2) Meanwhile, the particular samples deviate from the output embeddings of LLMs, mainly due to insufficient knowledge of LLMs.
We denote the representation function, namely the decoder of UnifiedQA-Flan-T5-Large, as . We sample a certain number of instances from the datasets, i.e., . Concretely, for the task of sentiment classification, , and for the task of natural language inference, . Based on the representation obtained, the samples belonging to the identical classes are grouped together as , where are the sampled instances, and is the class index. Then, each is clustered to clusters by the k-means algorithm, and each cluster and its corresponding centroid are denoted as and , respectively. Regarding the selection of cluster numbers , we refer to the original setup Zhao et al. (2023a), i.e., . The seeds for sample selection and clustering initialization are both , and hence the results are averaged on 25 initial setups.
where denotes the query, namely, the test instance, and is a vector pointing from towards the centroid .
The prompts for NLI and SC tasks used on the model are shown as follows:
B.4 Spread
Spread aims to measure the instance-level hardness in the few-shot scenario Zhao et al. (2022). The idea of Spread is to examine the similarity between training and test instances. Concretely, if one test sample is close to train samples semantically, it is taken as an easy instance. We denote the semantic encoder for Spread as . The distance of one test instance to the training set is defined as the average distance between the test instance to the k-closest training instances. Let and denote the training and test sets, respectively. denotes the -th closest training instances to the test instance . is the number of shots to the training sets, and is the measurement between two data points.
B.5 PVI
Algorithm 1 presents the procedure of PVI Ethayarajh et al. (2022). is fine-tuned on the original training dataset , i.e., . Meanwhile, is fine-tuned on the null-target pairs , where is an empty string.
Appendix C Experimental results
As a supplement of Table 2, the following Table 13 presents the fine-grained numerical values of the golden hardness and different metrics.
Datasets | Class | F1() | Sensitivity() | Thrust() | Spread() | Intra-class () | Inter-class () | GeoHard |
---|---|---|---|---|---|---|---|---|
Amazon | Positive | 87.60.41 | 0.17080.0121 | 0.4550.004 | 0.839 | 2.8370.003 | -11.1520.096 | -8.3160.096 |
Neutral | 71.00.96 | 0.25110.0222 | 0.5750.008 | 0.842 | 2.9680.007 | -6.7860.056 | -3.8180.061 | |
Negative | 80.50.69 | 0.31530.0158 | 0.5130.027 | 0.844 | 2.7120.007 | -9.2050.071 | -6.4930.076 | |
APP | Positive | 74.20.16 | 0.2450.033 | 0.540.024 | 0.876 | 5.3590.012 | -7.280.72 | -1.9210.709 |
Neutral | 60.10.14 | 0.13680.0062 | 0.4470.014 | 0.864 | 6.2510.012 | -4.9450.342 | 1.3060.353 | |
Negative | 73.40.8 | 0.27240.0252 | 0.5130.027 | 0.862 | 5.6680.05 | -7.240.72 | -1.5710.77 | |
MNLI | Entailment | 91.10.12 | 0.82330.01 | 1.5030.021 | 0.837 | 4.0130.008 | -0.0490.005 | 3.9640.012 |
Neutral | 87.20.12 | 0.4960.0085 | 1.5030.021 | 0.832 | 4.0370.009 | -0.0620.007 | 3.9750.015 | |
Contradiction | 92.80.05 | 0.68280.0142 | 1.5030.021 | 0.833 | 3.9890.01 | -0.070.002 | 3.920.012 | |
SICK-E | Entailment | 92.90.22 | 0.89680.0231 | 1.5890.07 | 0.859 | 3.1120.026 | -2.2050.172 | 0.9060.187 |
Neutral | 86.82.11 | 0.30360.0431 | 1.5890.07 | 0.854 | 3.4710.013 | -2.3630.163 | 1.1080.171 | |
Contradiction | 92.40.46 | 0.90490.0106 | 1.5890.07 | 0.863 | 2.1970.002 | -4.1350.312 | -1.9370.312 | |
SNLI | Entailment | 92.60.08 | 0.87120.0155 | 1.5820.011 | 0.877 | 5.640.018 | -0.0690.013 | 5.5710.03 |
Neutral | 89.20.17 | 0.69380.0205 | 1.5820.011 | 0.87 | 5.6450.02 | -0.0640.015 | 5.5810.035 | |
Contradiction | 95.30.08 | 0.54470.0188 | 1.880.179 | 0.864 | 5.5960.021 | -0.1040.035 | 5.4910.056 | |
SST-5 | Positive | 83.10.73 | 0.22420.0389 | 0.8210.014 | 0.828 | 1.6480.022 | -7.6650.366 | -6.0170.346 |
Neutral | 53.11.55 | 0.23470.0667 | 0.8010.013 | 0.824 | 1.9040.01 | -5.0140.261 | -3.110.27 | |
Negative | 75.81.7 | 0.3640.0451 | 0.7640.022 | 0.83 | 1.680.023 | -7.3760.416 | -5.6960.418 | |
TFNS | Positive | 93.00.08 | 0.36270.0585 | 0.5530.035 | 0.818 | 2.250.025 | -7.8360.176 | -5.5870.191 |
Neutral | 86.10.29 | 0.12920.0133 | 0.5230.03 | 0.806 | 2.3910.02 | -6.2040.301 | -3.8130.287 | |
Negative | 92.20.54 | 0.46890.0169 | 0.7520.033 | 0.819 | 2.7690.083 | -7.4810.163 | -4.7120.144 | |
Yelp | Positive | 87.90.14 | 0.04510.0021 | 0.4550.006 | 0.822 | 4.0430.011 | -9.7930.012 | -5.750.016 |
Neutral | 75.40.25 | 0.08320.0033 | 0.3950.006 | 0.819 | 4.3960.003 | -6.3280.009 | -1.9310.006 | |
Negative | 86.60.12 | 0.06390.0036 | 0.4550.006 | 0.811 | 4.1080.015 | -9.190.018 | -5.0820.033 |
C.1 GeoHard
C.1.1 NLI’s fine-grained results with different connecting words or phrases
Table 14 and 15 present the measurement of Distributional complexity and Biased gravity. Different from the SC datasets, a pair of sentences is in the NLI task. Therefore, a conjunction word is needed to convert a pair of sentences to a natural sentence. As shown in Table 14 and 15, six conjunctive words or phrases are selected, including And, It is true that, etc. As mentioned above, we average the metrics on different conjunctions to measure the NLI sentence pair.
Datasets | Class | Maybe | And | Therefore | But | On the other hand | It is true that | Average |
---|---|---|---|---|---|---|---|---|
MNLI | Positive | 4.0780.003 | 4.040.008 | 3.9560.024 | 4.0170.029 | 4.0160.001 | 3.9720.05 | 4.013 |
Neutral | 4.0990.011 | 4.0610.008 | 3.9760.026 | 4.0370.035 | 4.0560.001 | 3.9930.052 | 4.037 | |
Negative | 4.0630.001 | 4.0170.009 | 3.9060.018 | 3.990.03 | 4.0130.001 | 3.9460.061 | 3.989 | |
SNLI | Positive | 6.2560.058 | 5.7380.064 | 5.3140.034 | 5.440.069 | 5.5130.028 | 5.5790.062 | 5.640 |
Neutral | 6.2610.057 | 5.750.061 | 5.310.043 | 5.4450.067 | 5.5230.029 | 5.5810.065 | 5.645 | |
Negative | 6.260.059 | 5.7220.06 | 5.1880.019 | 5.3820.072 | 5.4670.046 | 5.5560.055 | 5.596 | |
SICK-E | Entailment | 3.5210.003 | 3.0660.3 | 2.5370.086 | 2.7050.029 | 3.4450.035 | 3.3970.289 | 3.112 |
Neutral | 3.7490.048 | 3.3980.184 | 3.1920.038 | 3.2870.013 | 3.6390.024 | 3.5610.209 | 3.471 | |
Contradiction | 2.1810.027 | 2.2120.061 | 2.1550.029 | 2.2520.017 | 2.2120.016 | 2.1720.038 | 2.197 |
Datasets | Class | Maybe | And | Therefore | But | On the other hand | It is true that | Average |
---|---|---|---|---|---|---|---|---|
MNLI | Positive | -0.0330.019 | -0.0390.003 | -0.1030.004 | -0.0420.019 | -0.0270.002 | -0.050.01 | -0.049 |
Neutral | -0.050.027 | -0.0520.003 | -0.1010.007 | -0.0670.031 | -0.0380.004 | -0.0650.027 | -0.062 | |
Negative | -0.0360.01 | -0.0630.006 | -0.1680.005 | -0.0480.013 | -0.0440.002 | -0.0580.003 | -0.07 | |
SNLI | Positive | -0.0110.004 | -0.0350.005 | -0.1110.018 | -0.0680.016 | -0.1230.09 | -0.0640.009 | -0.069 |
Neutral | -0.0120.004 | -0.0340.008 | -0.0920.015 | -0.0640.008 | -0.1220.084 | -0.0580.008 | -0.064 | |
Negative | -0.0130.005 | -0.0480.013 | -0.1640.034 | -0.110.028 | -0.2030.188 | -0.0870.029 | -0.104 | |
SICK-E | Entailment | -1.3720.199 | -2.8220.9 | -2.9920.316 | -2.8770.317 | -1.3350.161 | -1.8340.363 | -2.205 |
Neutral | -1.6140.219 | -2.8110.897 | -3.2740.368 | -3.0270.277 | -1.3640.152 | -2.0890.385 | -2.363 | |
Contradiction | -2.5010.382 | -5.2591.564 | -5.6310.615 | -5.3970.498 | -2.6090.308 | -3.4110.711 | -4.135 |
Appendix D Generalization and Application of GeoHard
D.1 Theoretical generalization
Taking the data distribution as one Gaussian distribution , the mean of instances sampled from follows . Therefore, the means of the training data and the test data, and , follow and , where and are the size of training and test sets, respectively. According to Chebyshev’s inequality Mitrinovic et al. (2013), the following inequalities stand with arbitrary :
Assuming without loss of generality, we combine the two inequalities above and derive:
D.2 Neutral’s overfitting
![Refer to caption](x11.png)
![Refer to caption](x12.png)
D.3 Empirical Validation on GeoHard’s Generalization
As mentioned in the main part of the paper, we also include four datasets, i.e., AG News, Yahoo, Emo, and CARAR, from the tasks of emotion detection and topic classification. Similarly, we formulate the datasets to balance the number of instances inside each class to achieve class-wise balance. Specifically, we re-sample 10,000 instances from each class in Yahoo to handle the trade-off between computational efficiency and representativeness.
Trained on Roberta-Large with three seeds , the performance of four datasets present the class-wise F1 scores in Table 16 - 19.
AG News | World | Sports | Business | Sci/Tech |
---|---|---|---|---|
F1 score (%) | 96.40.08 | 99.10.07 | 92.70.16 | 93.20.14 |
Intra-class | 4.464.016 | 3.835.034 | 3.775.042 | 3.978.070 |
Inter-class | -15.49.133 | -17.62.100 | -13.11.221 | -13.35.075 |
GeoHard | -11.02.119 | -13.79.084 | -9.340.253 | -9.377.018 |
Emo | Others | Happy | Sad | Angry |
---|---|---|---|---|
F1 score (%) | 82.41.09 | 89.80.44 | 90.11.37 | 91.50.94 |
Intra-class | 2.331.025 | 2.286.024 | 2.120.015 | 2.117.006 |
Inter-class | -6.841.081 | -9.781.147 | -9.521.186 | -8.278.428 |
GeoHard | -4.509.063 | -7.495.170 | -7.400.177 | -6.160.425 |
CARAR | Sadness | Joy | Liebe | Anger | Fear | Superise |
---|---|---|---|---|---|---|
F1 score (%) | 90.90.49 | 89.10.61 | 90.40.68 | 93.21.25 | 90.10.09 | 95.10.83 |
Intra-class | 1.817.129 | 2.285.068 | 1.656.013 | 1.641.075 | 1.505.040 | 1.675.007 |
Inter-class | -6.538.144 | -6.232.216 | -5.806.079 | -7.159.122 | -6.043.123 | -6.822.116 |
GeoHard | -4.720.263 | -3.947.199 | -4.150.066 | -5.517.196 | -4.537.107 | -5.147.111 |
Yahoo | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|---|
F1 score (%) | 64.80.72 | 77.70.28 | 82.00.19 | 59.70.50 | 87.80.64 | 91.90.12 | 59.60.17 | 76.80.30 | 78.80.04 | 81.50.23 |
Intra-class | 3.08.014 | 2.920.009 | 2.726.013 | 3.416.014 | 2.550.021 | 3.156.004 | 4.257.042 | 4.481.066 | 3.195.020 | 2.814.027 |
Inter-class | -7.836.033 | -8.894.012 | -11.63.092 | -6.872.006 | -12.38.137 | -13.97.053 | -7.303.053 | -8.428.042 | -10.11.062 | -7.294.066 |
GeoHard | -4.747.019 | -5.974.003 | -8.910.080 | -3.455.015 | -9.838.117 | -10.81.056 | -3.045.012 | -3.946.025 | -6.922.043 | -4.480.042 |
D.4 Other metrics beyond training-free methods
Here, we include two training-based methods to further validate the existence of class-wise hardness. One is PVI Ethayarajh et al. (2022) and the other is data cartography Swayamdipta et al. (2020). PVI has been introduced in Appendix B.5. Data cartography focuses on the behavior of the model on data instances during training, referred to as training dynamics. This includes two metrics for each instance: the model’s confidence in the correct class and the variability of this confidence across epochs. Data points characterized by high confidence and low variability are considered easy. In Table 20, we observe that PVI can well model the hardness of the classes. Moreover, we also notice the correlation between class-wise hardness and the metrics from training dynamics. These results further validates the existence of class-wise hardness through a training-based way.
SC | NLI | Macro Avg. | |||||||
---|---|---|---|---|---|---|---|---|---|
Amazon | APP | SST-5 | TFNS | Yelp | MNLI | SNLI | SICK-E | ||
PVI | 0.985 | 0.9825 | 0.9808 | 1.0000 | 1.0000 | 0.9805 | 0.9628 | 0.9973 | 0.9861 |
Confidence | 0.6966 | 0.9947 | 0.9959 | 0.997 | 0.7183 | 0.9721 | 0.9897 | 0.7478 | 0.8890 |
Variablity | -0.8755 | -0.5244 | -0.1256 | 0.8683 | -0.7595 | -0.9991 | -0.9949 | -0.0117 | -0.4278 |
D.5 GeoHard’s Application
The following demonstrates two examples of the demonstration applied in the ICL on Dynasent Potts et al. (2021). Precisely, the upper and the lower demonstrations are 2P+1Neu+1N and 1P+2Neu+1N, respectively.
Appendix E Artifacts and Packages
The details of the datasets, major packages, and existing models are listed in Table 21.