B its A nd B ites at S em E val-2025 Task 9: Improving Food Hazard Detection with Sequential Multitask Learning and Large Language Models (2025)

Abstract: Automatic and early detection of foodborne hazards is crucial for preventing outbreaks. Existing AI-based solutions often struggle with the complexity and noise of food recall reports and overcome the dependency between product and hazard labels. We introduce a methodology to classify reports on food-related incidents to address these challenges. Our approach leverages LLM-based information extraction to minimize report variability, alongside a two-stage classification pipeline. The first model assigns coarse-grained labels, narrowing the space of eligible fine-grained labels for the second model. This sequential process allows us to capture hierarchical label dependencies between products and hazards and their respective categories. Additionally, we design each model with two classification heads relying on the inherent relations between food products and associated hazards. We validate our approach on two multi-label classification sub-tasks. Experimental results demonstrate the effectiveness of our approach, achieving an improvement of +30% and +40% in classification performance compared to the baseline.

## introduction food hazard detection -identifying potential risks associated with food products -is pivotal for public health. in this context, researchers have started exploring solutions based on traditional machine learning (ml) and deep learning (dl) techniques to automate food hazard detection tasks. this can help mitigate foodborne outbreaks and improve food safety measures @xcite . albeit promising, such approaches leverage structured data extracted from incomplete or misleading information collected from social media @xcite . more interestingly, natural language processing (nlp) techniques powered by large language models (llms) have unlocked new possibilities-especially in scenarios with limited labeled data (such as low-resource languages @xcite or specific context @xcite ). they enable the extraction of more robust and context-enhanced information from unstructured data when it relies on authoritative sources such as public reports from government agencies @xcite . this allows for more reliable and comprehensive analysis of food hazard trends and their potential impact. among others, @xcite have introduced a dataset of publicly available food recall announcements, annotated at two hierarchical levels -i.e., high-level categories and fine-grained labels for both food products and associated hazards. the authors use this dataset to benchmark a food hazard detection methodology for addressing a multi-label report classification task. while the reports included in the dataset provide authoritative insights, they inherently present noise and span thousands of classes, which poses significant analytical challenges. relying on the work of @xcite , we hypothesize that information about hierarchical structure can enhance a model's classification performance. specifically, classifying broader product categories first can facilitate subsequent identification of specific food items, and the same applies to hazard classification. moreover, while the relationship between food products and associated hazards is highly correlated, existing approaches fail to explicitly model these dependencies @xcite . in this paper, we address the report classification task in a multitask fashion. we propose a novel approach based on sequential multi-head classification. we present three key advances in multi-label food hazard detection: 1. multi-head architecture: we decouple product and hazard prediction by leveraging two classification heads, which enables specialized feature learning for each label type. ## background in the last decade, researchers have focused their efforts on exploring ai-based solutions for food hazard detection @xcite . most of the existing research rely on traditional ml @xcite and dl techniques @xcite , from the detection of zoonotic disease sources @xcite to microbial risk assessment @xcite , to name but a few. nevertheless, the recent development of llms and the advancement of nlp techniques @xcite have pushed the boundaries towards more sophisticated approaches @xcite @xcite . although recent studies have started leveraging insights from the scientific literature @xcite , the majority of food risk detection approaches rely on corpora consisting of news or social media posts @xcite . such sources often provide incomplete information and lack precision from both a taxonomical and scientific perspective, making it challenging to extract structured and reliable data for ai-driven food risk assessment @xcite . the majority of existing approaches frame the problem as a binary classification task where the goal is to detect the presence of an incident from tabular or image data @xcite . such approaches are promising but are often too simplistic for real-world scenarios @xcite where food risk assessment requires complete interpretation of textual data, consideration of context, and distinguishing between different levels of risk severity @xcite . to overcome these issues, randl et al. (2024) created a new dataset @xmath0. they formulated the food hazard detection problem as two supervised multi-label classification tasks and organized the collected reports accordingly: (i) the aim of subtask st 1 is the classification of each report into macro categories of food products (22 labels) and related hazards (10 labels); (ii) the aim of subtask st 2 is identification of the specific products (1 142 labels) and hazards (128 labels) mentioned in the reports. @xcite relied on that dataset to validate a methodology based on llms and conformal prediction @xcite . they addressed the two classification subtasks separately by training two different classifiers, each designed with a single classification head that simultaneously processed products and their associated hazards. while promising, this design may limit the model's ability to distinguish between the different aspects of each target. in contrast, we propose a modification to this architecture by splitting the classification head into two distinct heads, which allows the model to better capture the relationship between food products and potential hazards. moreover, while @xcite addressed the two subtasks independently, we introduce a sequential classification approach (see section 3), where we constrain the classification probabilities of the detailed labels (i.e., subtask st 2 ) to the probabilities of the category labels (i.e., subtask st 1 ). hazard categories product categories lm 1 input reports lm 2 hazard details product details st 1 st 2 figure 1: overview of the adopted methodology. for each subtask (st 1 and st 2 ), we train one classification model with two classification heads: one for classifying the product labels, and one for classifying the food hazard. then, we constrain the probabilities of the st 2 detailed labels based on the probabilities of the st 1 generic categories. this enables the model to refine its predictions by leveraging the hierarchical dependency between the two tasks, ultimately improving both the accuracy and robustness of food hazard detection. ## methodology in this section, we present our food hazard detection methodology. in section 3.1, we address the overall problem by relying on a multi-head architecture. this results in two models -one for highlevel categories (st 1 ) and one for fine-grained labels (st 2 ). then, in section 3.2, we introduce the sequential classification approach, where finegrained predictions are guided and constrained by the predictions of the broader categories. finally, in section 3.3, we describe how we leverage llms to normalize the noisy, unstructured reports through summarization and information extraction, which also enhances classification performance. ## experimental results in we use as baseline a standard classification model based on roberta-large and a single classification head for each task -i.e., st 1 and st 2 . firstly, using a single classification head limits the baseline performance, with a task f1-score @xmath1. this limitation is even more evident in st 2 , where the task f1-score @xmath2. here, further analysis reveals that merging the product and hazard labels in a unique classification head leads to a strong bias for the predominant classi.e., the products. as a consequence, 89% of the hazards are misclassified as products. the multi-head (mh) classification brings a substantial improvement over the baseline in both st 1 and st 2 , with improvements in the task f1-scores @xmath3. the classification results confirm our assumption that splitting the hazard and product classification heads allows the classifier to achieve high specialization while accounting for label unbalancing. overall, corpus normalization (cn) applied along with mh leads to a performance comparable to simple mh, except for a slight decrease in the test task f1-score of ∼ 2% for st 1 . apart from this specific case, the information extracted by the llm follows a uniform and fixed structure, effectively reducing the reports' variability and facilitating the classifier's handling of heterogeneous data. as a result, with cn the classifiers can correctly assign over 100 more reports to the correct products and hazards compared to using the mh alone. leveraging the hierarchical structure of labels (i.e., categories and details) through sequential classification (sc) applied alongside simple mh pays off, resulting in a slight task f1-score improvement of ∼ 0.5%. on the other hand, sc seems to slightly limit the improvement of the cn approach. despite the classifier performing comparably with a task f1-score of around 48%, combining the three approaches leads to a slight decrease in performance of ∼ 0.1%. ## conclusions in this paper, we proposed a novel sequential multi-head classification approach to classify foodrelated incident reports. we introduced a classification pipeline that integrates (i) multi-head classifiers to split food products and associated hazard labels, (ii) a sequential classification strategy leveraging hierarchical labels, and (iii) llm information extraction for normalizing reports that exhibit high variability. experimental results demonstrate the efficacy of our approach, which yields significant performance improvements over the baseline single-head classifier. the multi-head approach substantially enhances the classifier's performance, mitigating the biases caused by labeling imbalances observed in the baseline model. corpus normalization reduces report variability and provides a common structure to the texts, thereby slightly improving the classification performance. finally, sequential classification marginally boosts performance by constraining predictions based on hierarchical label dependencies. future work could explore alternative approaches to hierarchical classification constraints, further optimizing the balance between interpretability and performance. additionally, integrating external knowledge could enhance model robustness and generalization across different food safety scenarios. we also plan to evaluate the use of the embeddings produced by our multi-head, hierarchy-based approach to index incident reports in a retrieval-augmented generation (rag) framework to enable more efficient retrieval and richer contextualization of historical cases.