Habib University at S em E val-2025 Task 9: Using Ensemble Models for Food Hazard Detection (2025)

Abstract: Food safety incidents cause serious threats to public health, requiring efficient detection systems. Thisstudy contributes to SemEval 2025 Task 9: Food Hazard Detection by leveraging insights from existing literature and using multiple BERT-based models for multi-label classification of food hazards andproduct categories. Using a dataset of food recall notifications, we applied preprocessing techniquesto prepare data and address challenges like class imbalance. Experimental results show strong hazardclassification performance on ensembled models such as DistilBERT, SciBERT, and DeBERTa but highlight product classification variability. Building on Nancy et al. and Madry et al.’s work, we explored strategies like ensemble modeling and data augmentation to improve accuracy and explainability, paving the way for scalable food safety solutions.

## introduction the task at hand which lies in the domain of food hazard detection @xcite , focuses on developing explainable machine learning systems to classify food hazard-related reports. this task is crucial as food safety incidents pose significant threats to public health and the global economy, leading to foodborne illnesses and product recalls. the challenge involves two key sub-tasks: these tasks emphasize both accurate prediction and explainability to enhance trust and usability in real-world applications. the task overview paper provides detailed insights into the structure and objectives of this challenge. our main strategy involves leveraging multiple bert-based models for multi-label classification of food hazards and product categories. we employed an ensemble approach, combining models like distilbert, deberta, and scibert to improve predictive performance and robustness. additionally, we utilized preprocessing techniques to clean and normalize the dataset, and applied data augmentation to address class imbalance, ensuring a more diverse and representative training set. by participating in this task, we discovered that ensemble learning significantly enhances model performance, achieving a macro f1 score of 0.7844 on our internal validation set for subtask 1 (and 0.4482 on the official test set). for subtask 2, the ensembled approach yielded 0.442 in the conception-phase internal validation and 0.0315 in the evaluation test phase. according to the official leaderboard, our system ranked 26th for subtask 1 and 24th for subtask 2. ## background recent advancements in nlp have enabled automated food hazard detection in consumer reviews. transformer-based models like bert classify reviews as "safe," "potentially unsafe," or "unsafe," addressing challenges such as class imbalance and limited data. maharana et al. fine-tuned bert on expert-validated e-commerce data, achieving a precision of 0.77, recall of 0.71, and f1-score of 0.74 @xcite . however, small dataset size and linguistic variability hindered generalization. in foodborne illness detection, encoder-based transformers (roberta, xlm-roberta) and traditional models (svm, logistic regression) were compared for classifying 7,546 food recall announcements. a novel gpt-cicle approach combined conformal prediction with gpt-3.5-turbo for few-shot learning, reducing large language model usage by 60-98% while maintaining accuracy @xcite . tf-idf-svm achieved the highest macro f1 scores (0.58 for hazardcategory, 0.59 for product-category), outperforming roberta in low-resource settings. for automating food safety news impact classification, a stacking ensemble integrated classifiers like naive bayes, svm, xgboost, cnn, lstm, and bert. combining tf-idf and word2vec embeddings enhanced text representation, achieving an f1-score of 0.8052 @xcite ). despite its success, computational complexity and dataset constraints limited real-time applications, prompting future efforts to optimize configurations and explore multilingual datasets. in relation to prior work, our method extends maharana et al.'s fine-tuning of bert on e-commerce data (maharana et al., 2019) by tackling multi-label classification of both hazards and products simultaneously, rather than single-label safety judgments. unlike randl et al.'s gpt-cicle few-shot prompts @xcite , we employ deterministic local augmentation for reproducibility and scale. compared to song et al.'s stacking of heterogeneous classifiers @xcite , we focus exclusively on transformer ensembles to leverage deep contextual embeddings across domain-specific and general models. ## data the dataset used for evaluation consists of food hazard recall notifications collected from various sources, focusing on food safety. it contains a total of 5,966 rows and 10 columns out of which the 6 required columns for our task are shown in ## conclusion and future work in this paper, we presented our participation in se-meval 2025 task 9: food hazard detection, where we applied advanced bert-based models to tackle the multi-label classification problem of food hazards and product categories. although built on established components, our integration of controlled data augmentation with ensemble diversity contributes a reproducible and competitive baseline for food hazard detection under imbalanced conditions. through extensive experimentation with models such as distilbert, scibert, and deberta, we achieved strong performance in hazard classification. our ensemble approach demonstrated promising results, though product classification still exhibited variability, highlighting areas for further improvement. currently, we are ranked 26 and 24 internationally based on our scores in subtasks 1 and 2 in the submitted leader-board. in the future, the emphasis will be placed on optimizing data augmentations toward mitigating class imbalance issues and building model robustness. here, extending augmentations over a longer window will diversify and make training data much more representative when considering minority classes. this could include enhancing the diversity of the data with further techniques like domainspecific paraphrasing or leveraging generative approach models for gpt-based synthetic data. hyperparameters such as learning rate, batch size, and weight decay will also be tuned toward maximizing the model's stability and efficiency. finally, a study will be performed to discover methods for easing resource consumption while maintaining the performance of the previously underlined concepts to allow for a better level of generalization and scalability in handling a more complex food hazard detection task. the future work will further focus on incorporating multilingual datasets to enhance generalizability, integrating explainability modules such as shap or lime for model transparency, and exploring active learning strategies to iteratively refine the model with user feedback in real-world deployment settings.