Learning from Disagreement: Entropy-Guided Few-Shot Selection for Toxic Language Detection (2025)

Abstract: In-context learning (ICL) has shown significant benefits, particularly in scenarios where large amounts of labeled data are unavailable. However, its effectiveness for highly subjective tasks, such as toxic language detection, remains an open question. A key challenge in this setting is to select shots to maximize performance. Although previous work has focused on enhancing variety and representativeness, the role of annotator disagreement in shot selection has received less attention. In this paper, we conduct an in-depth analysis of ICL using two families of open-source LLMs (Llama-3* and Qwen2.5) of varying sizes, evaluating their performance in five prominent English datasets covering multiple toxic language phenomena. We use disaggregated annotations and categorize different types of training examples to assess their impact on model predictions. We specifically investigate whether selecting shots based on annotators’ entropy – focusing on ambiguous or difficult examples – can improve generalization in LLMs. Additionally, we examine the extent to which the order of examples in prompts influences model behavior.Our results show that selecting shots based on entropy from annotator disagreement can enhance ICL performance. Specifically, ambiguous shots with a median entropy value generally lead to the best results for our selected LLMs in the few-shot setting. However, ICL often underperforms when compared to fine-tuned encoders.

## introduction in-context learning (icl) is becoming a dominant paradigm in nlp, mainly due to its numerous advantages over fine-tuning methods. first, it facilitates task-specific learning in a dynamic way from a limited set of examples directly provided in a prompt, without the need to update the model's weights. this allows rapid adaptation to new tasks while significantly reducing storage and computational costs. additionally, icl requires fewer la-beled examples compared to full fine-tuning, reducing the need for extensive training sets and making it an efficient and scalable alternative, especially for low-resource languages and cognitively demanding tasks such as hate speech annotation @xcite @xcite . however, as @xcite highlight, multiple factors affect icl performance, such as the prompt template and wording, the selected examples (henceforth, shots), the order in which the shots are presented to the models, and the model size, among others @xcite . finding optimal shots, that is, instances of a linguistic phenomenon that are representative and that could be used to learn to generalize its identification, is a challenging task whose solution could help boost the llm results in icl @xcite . this paper presents an in-depth study on icl functionalities of two families of open-source llms (llama-3* and qwen2.5) with different sizes on five prominent datasets in english covering multiple toxic language phenomena. in particular, we have used the disaggregated annotations of the datasets to identify different types of training examples to test their impact on llms. we have also analyzed to what extent the order of presentations of the examples in the prompts impacts the models. our contributions can be summarized as follows: our code is publicly available at the following link https://github.com/tommasoc80/ woah_2025_shot_selection . ## datasets a recent trend in the creation of language resources for highly subjective tasks, such as toxic language, is to collect multiple judgments for every message and subsequently release the annotations both in an aggregated and a disaggregated format. releasing data in a disaggregated form allows to analyze disagreements, different perspectives, and develop systems that account for different social and cultural viewpoints @xcite . for this paper, we select five datasets that either have been conceived to be released in a disaggregated format or that have preserved the disaggregated annotations while offering aggregated labels. the datasets contain english texts, and they are all based on social media messages from different platforms. the spectrum of toxic language phenomena includes sexism, hate speech, and offensive language. ## experiments for each dataset, we design seven experiment settings. first, models are tested in zero-shot settings as a baseline. the other six settings are based on few-shot icl and can be grouped into three blocks according to the types of shots. the first block uses examples deemed as "difficult" (diff), the second block employs shots considered as "ambiguous" (amg), and the third randomly selects the shots (random). in each block, the shots are presented either in a fixed order per class label or in a randomized one. in particular, for the fixed order (ordered), all shots belonging to the negative class are presented first, followed by those for the positive class. for the randomized version (shuffled), we shuffle the order of the examples per dataset. this means that there are no two datasets whose order of the shot labels is the same. for all icl settings, we select 20 shots, 10 for the positive class and 10 for the negative class. ## results and discussion we present out findings in three blocks: first, we discuss the results per dataset ( § 4.1); then we discuss the results per model ( § 4.2), and finally we compare the results of the llms against finetuned versions of an encoder-based model, hate-bert @xcite ) ( § 4.3). ## related work since the advent of llms, two main paradigms of icl (zero-shot and few-shot) have enabled model prompting without the need for large amounts of labeled data @xcite . these methods use less training data, making llms efficient and scalable, especially in subjective tasks where the presence of labeled data can be very limited, such as for hate speech detection. several papers have mainly explored zero-shot icl for this task @xcite @xcite . however, few studies have focused on measuring the impact of evaluation choices, like the prompt phrasing or the impact of the selection of the shots in the few-shot setup. for instance, plazadel-arco et al. (2023) provides a benchmark for zero-shot hate speech detection and show that both the prompt and the model have a significant im-pact on achieving more accurate predictions in this task. @xcite evaluate zero-shot and few-shot approaches on english and spanish datasets. for the few-shot approach, they randomly selected five shots of each label. they find that few-shot does not outperform zero-shot in most cases, but they do not provide an exploration of the selection of the shots. hee et al. ( 2024 ) explore the transferability of hate speech detection between modalities (language and vision) using few-shot. they show that vision-language hate speech detection benefits from few-shot learning with text-based hate speech examples. @xcite introduce hatelexicon, a lexicon of slurs and targets of hate speech for brazil, germany, india and kenya. they show that selecting shots based on their lexicon leads to models performing better than models trained on shots sampled randomly. other works have investigated the impact of the order of shot selection @xcite and the quality of the shots devising different solutions to identify the optimal shots and mitigate the sensitivity of models to prompts @xcite @xcite . for few-shot icl, the impact of shot selection across various toxic language phenomena -such as hate speech, sexism, and offensive language -remains an open question, which we have addressed by building on the entropy-based sampling approach proposed by @xcite . ## conclusions this paper presents a comprehensive investigation of the functionalities of two collections of llms, llama-3* and qwen2.5, with different icl settings. in particular, we have tested on six llms -ranging from 3b up to 70/72b -the impact of shot selection and label ordering by benchmarking them on five english datasets targeting different toxic language phenomena such as sexism (edos), hate speech (brexit and gab), and offensive language (md and sbic). unlike previous studies investigating the solutions for identifying optimal shots, we have adopted simple solutions leveraging annotators' disagreement. we have used mace to calculate the entropy scores of each data item and then use it to identify shots with varying levels of complexity, inspired by the data cartography method @xcite . although entropy is not a good proxy to predict models' performance, it could offer strategic insights into model selection based on dataset complexity. our results indicate that shot selection plays a prominent role in boosting llm performance -as indicated by previous work -also for toxic language phenomena. we have identified that ambiguous shots, i.e., those with a median value of entropy, are those that, in general, allows our selected llms to obtain the best results in the few-shot setting. contrary to previous findings @xcite , we have identified that performant shot ordering seems dependent on the llm's size. furthermore, the results highlight that when ample training data is available, fine-tuned models offer a more efficient resource-effective alternative to icl. future work could explore the portability of fewshot icl to out-of-domain distributions, both for the same toxic language phenomenon and for different types of toxicity. this would help assess the reliability of few-shot icl in scenarios where labeled data is scarce or unavailable.