MINDS at S em E val-2025 Task 9: Multi-Task Transformers for Food Hazard Coarse-Fine Classification (2025)

Abstract: Food safety is a critical concern: hazardous incident reports need to be classified to be able to take appropriate measures in a timely manner. The SemEval-2025 Task 9 on Food Hazard Detection aims to classify food-related incident reports by identifying both the type of hazard and the product involved, at both coarse and fine levels of granularity. In this paper, we present our solution that approaches the problem by leveraging two independent encoder-only transformer models, each fine-tuned separately to classify hazards and food products, at the two levels of granularity of interest. Experimental results show that our approach effectively addresses the classification task, achieving high-quality performance on both subtasks. We additionally include a discussion on potential improvements for future iterations, and a brief description of failed attempts. We make the code available at https://github.com/fgiobergia/SemEval2025-Task9.

## introduction the success of language models has made it possible to annotate datasets with very limited human intervention. this is the case for a wide variety of tasks, including some with peculiar domains that make it difficult to obtain high-quality labels manually (e.g., classification of legal documents @xcite , or dialect detection @xcite ). this trend has enabled a thorough analysis of documents that could not be reasonably processed in acceptable times. among these documents, there are life-critical ones such as the analysis of food-related incident reports @xcite . the food hazard detection task @xcite from semeval 2025 focuses specifically on this challenge, with the goal of helping classify food incident reports collected from the web. the proper classification of these incidents is a vital task, as it provides potentially life-saving insights. these insights are typically in the form of structured labels that indicate the type and severity of the hazard, such as contamination, mislabeling, or adulteration; as well as the specific, or category of food involved. accurate classification enables regulatory bodies, food safety organizations, and the public to respond effectively by issuing warnings, recalling products, or implementing stricter safety measures. the large quantities of incidents available online makes manual processing generally infeasible. as such, automated crawlers can be used to find food issues from web sources; whereas natural language processing techniques can be adopted to correctly classify these documents based on (1) the type of food involved, and (2) the type of hazard described. the task is focused on classifying incidents based on these two targets, at two different levels of granularity (coarse and fine). as a part of this paper, we note that there is limited correlation between the hazard and the type of food -as such, we address the task by proposing a solution based on the fine-tuning of two pretrained, encoder-only transformer-based models, that focus on different aspects of the problem. we show that the proposed solution achieves competitive performance, with a final ranking of 9 th place for subtask 1, 5 th place for subtask 2. the rest of the paper is organized as follows. section 2 describes the dataset and the task under study. we present the proposed approach, and the rationale for it, as a part of section 3. the main results obtained are shown in section 4, with some additional considerations on the choices made. we cover some of the failed attempted in section 5 and the main limitations of the proposed approach in section 6. finally, section 7 wraps up the paper with considerations on the task and solution. ## problem description the goal of the task is to correctly classify incidents available on the web. the dataset is provided in three splits: training data (5,082 samples), validation data (565 samples) and test data (997 samples). each sample corresponds to the description of an incident. these incidents are taken from official food agency websites (e.g., fda). for each incident, a set of attributes is known: some are structured (date and country); whereas others are textual (title and text). for training and validation data, the correct classification is also available. this classification consists of two attributes: the hazard category (10 classes) and the product category (22 classes). each of these categories is further refined into a specific hazard (128 classes) and product (1,142 classes). each text is labeled by two food science or food technology experts. the first subtask (st1) of the challenge consists in predicting the hazard and product categories, whereas the second one (st2) aims to predict the specific hazard and product. for convenience, we report in ## proposed methodology the proposed solution consists of two separate encoder-only, pretrained transformers fine-tuned on the fine-coarse dual prediction problem. we first discuss the rationale behind using two models, each working on a dual granularity. next, we present the main details of the adopted solution. ## experimental results we report, as a part of this section, the main results obtained. first, we present an initial overview of the metrics reported. then, we study the performance of the proposed pipeline, using different backbone models. we further study the results that would be obtained by framing the problem in different ways. finally, we mention the main hyperparameters adopted for the solution. ## failed attempts in this section, we present some of the attempts that have been considered, but that did not yield promising results. ## limitations we acknowledge several limitations in the proposed approach, as indicated by the average results obtained in the public leaderboard (9 th place for subtask 1, 5 th place for subtask 2). among them, there is the usage of only the textual information, without considering temporal and spatial information available. in addition, we make a rather strong assumption of independence between products and hazards. while initial results pointed in that direction, we may assume that further explorations could potentially reveal that a single multi-task solution, if properly defined, may yield even better performance. finally, we note that the problem is characterized by a heavy class imbalance: simple attempts to mitigate this problem (e.g., introducing different weighting schemes for different classes) did not produce promising results. however, more sophisticated approaches (e.g., with data augmentation to increase dataset size and variety @xcite , or contrastive learning to reduce model biases @xcite ) may still be explored to provide additional benefits. ## discussion and conclusions in this paper we discussed a solution to the food hazard detection task of semeval 2025. the task, framed as a multi-task learning problem, highlighted how hierarchical labels can benefit from being predicted together. we show that we observed no clear benefit in simultaneously predicting results across the two targets (product, hazard). this can be explained given the low mutual information observed between the two labels, at all levels of granularity. we presented experimental results that corroborate the claims made and that allow to identify a candidate solution. we finally covered some of the attempts that appeared to be promising, but that did not yield any meaningful improvement. nente 2, investimento 1.3 -d.d. 1555 11/10/2022, pe00000013). this manuscript reflects only the authors' views and opinions, neither the european union nor the european commission can be considered responsible for them.