CSECU -Learners at S em E val-2025 Task 9: Enhancing Transformer Model for Explainable Food Hazard Detection in Text (2025)

Abstract: Food contamination and associated illnesses represent significant global health challenges, leading to thousands of deaths worldwide. As the volume of food-related incident reports on web platforms continues to grow, there is a pressing demand for systems capable of detecting food hazards effectively. Furthermore, explainability in food risk detection is crucial for building trust in automated systems, allowing humans to validate predictions. SemEval-2025 Task 9 proposes a food hazard detection challenge to address this issue, utilizing content extracted from websites. This task is divided into two sub-tasks. Sub-task 1 involves classifying the type of hazard and product, while sub-task 2 focuses on identifying precise hazard and product “vectors” to offer detailed explanations for the predictions. This paper presents our participation in this task, where we introduce a transformer-based method. We fine-tune an enhanced version of the BERT transformer to process lengthy food incident reports. Additionally, we combine the transformer’s contextual embeddings to enhance its contextual representation for hazard and product “vectors” prediction. The experimental results reveal the competitive performance of our proposed method in this task. We have released our code at https://github.com/AhmadMonirCSECU/SemEval-2025_Task9.

## introduction ensuring food safety is a growing concern; identifying and explaining food risks from online textbased sources could help mitigate this issue. however, the explainability of decision mechanisms related to food risk classification remains underexplored. enhancing this understanding could help humans quickly assess the validity of predictions and utilize meta-learning approaches, such as clustering or pre-sorting examples. to address these challenges, semeval-2025 task 9 @xcite proposed two sub-tasks: i) text classification for predicting food hazards, which predicts the type of hazard and product, and ii) detection of food hazards and product "vectors", which aims to identify the specific hazard and product. to demonstrate a clear view of the task definition, we articulate an example in prior research @xcite showed that developing early detection methods through compiling epidemiological data and evaluating cases may help us prevent foodborne illness outbreaks. to automate food safety detection, @xcite investigated several machine learning (ml) models, including linear support vector machines, multinomial naive bayes, and weighted logistic regression along with over-sampling and under-sampling techniques on amazon.com food reviews and fda food recalls linked data. however, ml-based approaches are being limited to learning complex global contextual information resulting in poor performance. to address this limitation, several studies have explored probabilistic models @xcite and transformer-based approaches @xcite . nevertheless, transformerbased models exhibit superior performance compared to other methods. in this work, we have proposed a method based on an enhanced bidirectional encoder representations from transformers (bert). we utilize the contextual embedding from the transformer for downstream purposes. to predict hazard and product "vectors", we duplicate and concatenate the embedding, then pass the combined representation into a classifier for final predictions. we organize the rest of the paper as follows: section 2 describes our proposed system for the semeval-2025 food hazard detection task. in section 3, we detail the system design, including parameter configurations, and present the experimental results along with a performance analysis. finally, we conclude with potential future directions and the limitations of our system in section 4. ## food hazard detection framework in this section, we introduce our proposed framework for the food hazard detection task. the task consists of two distinct sub-tasks. sub-task 1 involves predicting the categories of food hazards and products. the sub-task 2 focuses on predicting the exact hazards and products. both of these are structured as multi-class classification problems. figure 1 illustrates the overview diagram of our proposed framework. tok 1 [cls] tok n tok 1 tok m [sep] [del] … … title text e 1 e [cls] e n e 1 ' e m ' e [sep] e [del] … … t 1 c t n t 1 ' t m ' t [sep] t [del] our approach incorporates the "title" and "text" fields from the dataset. we represent the sequence as: "title" + [del] + "text" as the input to the transformer where [del] indicates a delimiter. we embed a '#' token between "title" and "text" as @xcite to mark the boundary between them. following @xcite , we leverage the enhanced bert transformer to capture contextual embedding of the sequence. for sub-task 1, the [cls] token representation is directly fed into the classification layer. for sub-task 2, we replicate the [cls] representation, concatenate the copies, and then pass the aggregated embedding to the classifier. finally, the model predicts based on the unnormalized scores (logits) computed by the linear layer @xcite . ## conclusion and future direction in this work, we addressed the challenge of food hazard detection by participating in semeval-2025 task 9. we proposed a transformer-based approach, leveraging an enhanced version of the bert model to handle the complexities of lengthy food incident reports. by combining the transformer's embeddings, our method enhances contextual representations for accurate hazard and product vector prediction. our approach demonstrated competitive performance in this task, highlighting its effectiveness in classifying hazards and providing precise explanations for predictions. in the future, we intend to explore other state-ofthe-art transformer models pre-trained on biomedical datasets, as they may offer enhanced performance for this task. due to the imbalanced nature of the dataset, we also aim to apply augmentation techniques that could improve learning across all classes.