Data Augmentation to Improve Large Language Models in Food Hazard and Product Detection

Areeg Fahad Rasheed, M. Zarkoosh, Shimam Amer Chasib, Safa F. Abbas · 2025

Read Data Augmentation to Improve Large Language Models in Food Hazard and Product Detection by Areeg Fahad Rasheed, M. Zarkoosh, Shimam Amer Chasib, Safa F. Abbas (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2502-08687.txt.

Introduction

Areeg Fahad Rasheed and co-authors test whether synthetic training data can sharpen language models that flag food hazards. Such models read product text to spot dangers and name the product involved, a task where labeled examples are limited. Their 2025 study uses a small chat model to expand the training set, then trains two standard models on the richer mix.

One model is RoBERTa-base and the other Flan-T5-base, both fine-tuned with and without the added data. On held-out test sets, the augmented training improved every headline metric the team reports: recall, precision, accuracy, and the F1 score. The authors release their code, training setup, and the augmented data set in a public repository. They present the result as a cheap route to better food safety screening when real labeled data runs short.

Catalog record

CREATORAreeg Fahad Rasheed, M. Zarkoosh, Shimam Amer Chasib, Safa F. Abbas
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE14 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2502-08687

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Data Augmentation to Improve Large Language Models in Food Hazard and Product Detection Areeg Fahad Rasheed, M. Zarkoosh, Shimam Amer Chasib, Safa F. Abbas Abstract The primary objective of this study is to demonstrate the impact of data augmentation using ChatGPT-4o-mini on food hazard and product analysis. The augmented data is generated using ChatGPT-4o-mini and subsequently used to train two large language models: RoBERTa-base and Flan-T5-base. The models are evaluated on test sets. The results indicate that using augmented data helped improve model performance across key metrics, including recall, F1 score, precision, and accuracy, compared to using only the provided dataset. The full code, including model training and the augmented dataset, can be found in this repository https://github.com/AREEG94FAHAD/food-hazard-prdouct-cls I Introduction Food safety is a critical global concern, with millions of people affected by foodborne illnesses each year [ 1 , 2 , 3 ] . Rapid and accurate detection of food hazards is essential to prevent health risks and ensure consumer protection. However, the vast amount of textual data available in scientific literature, reports, and regulatory documents makes it challenging to efficiently classify and assess food-related risks [ 4 , 5 ] . With the rapid advancement of Artificial Intelligence (AI) [ 6 , 7 ] , particularly in the field of Natural Language Processing (NLP) a specialized subfield of AI dedicated to understanding, interpreting, and processing human language, we are now able to extract valuable insights from textual data with unprecedented efficiency [ 8 , 9 ] . NLP has revolutionized automation across a wide range of applications, including text translation, grammar correction, information classification, text summarization, and question-answering [ 10 , 11 , 12 , 13 , 14 ] . In this paper, we will employ a machine learning technique called data augmentation [ 15 , 16 ] to enhance the performance of large language models (LLMs) for classifying hazard and product categories. By increasing the sample number of imbalanced classes within each category, we aim to address class imbalance. The augmented data will be generated using ChatGPT-4o-mini and subsequently used to fine-tune two LLMs: RoBERTa [ 17 ] and Flan-T5 [ 18 ] . The reset of the paper are organized as follows: In Section 2, we provide a brief overview of the models used in this study. Section 3 describes the dataset, including its characteristics before and after implementing data augmentation, as well as the proposed augmentation methodology. Section 4 details the fine-tuning process of the models and presents the main results obtained from training on both the original and augmented datasets. In Section 5, we will present a discussion of the findings. Finally, in the last section, we present the conclusions of the work. Fig. 1: Distribution of Hazard Categories Before and After Data Augmentation Fig. 2: Distribution of Product Categories Before and After Data Augmentation II Large language models used In this work, we have used three large language models. The first one is ChatGPT-4o-mini for data augmentation. The second and third are RoBERTa and FLAN-T5 which are used for fine-tuning the dataset. The following section provides a brief description of each model. • ChatGPT-4o-mini: ChatGPT-4o-mini is a version of ChatGPT released on May 14, 2024. It is a more efficient and resource-optimized model compared to previous versions. ChatGPT-40-mini is a multimodal model capable of processing text, images, and audio, making it suitable for a variety of tasks, including text generation, summarization, translation, and code assistance. It supports up to 128k tokens in a single context window. However, it is not publicly available as an API and can only be accessed through the ChatGPT-4o-mini interface [ 19 , 20 , 21 ] . • RoBERTa [ 17 ] : For fine-tuning the dataset for hazard and product category detection, we have used two models. The first one is RoBERTa, an LLM developed by Facebook AI Research that was released in 2019. It is an enhanced version of the BERT model. Like most LLMs, RoBERTa is used for many tasks such as topic categorization, summarization, etc. RoBERTa’s architecture is based on an encoder-only structure, meaning it does not have a separate decoder [ 22 ] . The maximum number of tokens supported by RoBERTa is 512 per input. There are many versions of RoBERTa; in this paper, we used the base version, which has 125 million parameters. • Flan-T5 [ 18 ] : The second model used is Flan-T5, a modified version of T5 that, like RoBERTa, is employed in various LLM applications. Since Flan-T5 is fine-tuned on a wide range of tasks, it is capable of zero-shot and few-shot learning. Instead of training the model extensively on a specific dataset, you can provide it with examples and instructions for tasks such as classification. Flan-T5 supports a full transformer architecture, meaning it has both encoder and decoder components [ 23 ] . Additionally, Flan-T5 supports a wider range of tokens, with the default being 512 tokens per input. Fig. 3: Prompt Used for Data Augmentation via ChatGPT-4o-mni III Dataset Pre- and Post-Augmentation The dataset for this paper consists of three files: the first is a training CSV file containing a total of 5,082 samples; the second is a development file with 565 samples; and the third is a test file with 997 samples. The following sections provide an in-depth analysis of the dataset’s structure before and after augmentation was implemented [ 24 ] . III-A Pre-Augmentation In Subtask 1, the goal is to classify the product and hazard category of each sample. Each sample contains multiple rows with attributes such as ’year’, ’month’, ’day’, ’country’, ’title’, ’text’, ’hazard-category’, ’product-category’, ’hazard’, and ’product’. Since we are focusing only on Subtask 1, we will use the following attributes: ’title’, ’text’, ’hazard-category’, and ’product-category’. The hazard category consists of ten classes, while the product-category includes 22 classes. The class names and the number of samples for each category are displayed in Figure 1 and Figure 2 respectively. III-B Post-Augmentation For the augmentation process, we used the ChatGPT-4-omni version. We focused on increasing the number of samples for classes with a small sample number, such as the migration class. We utilized the ChatGPT API and sent a request with a prompt, as shown in Figure 3 . After applying data augmentation, most hazard categories experienced an increase, particularly those with a smaller number of samples, as shown in Figure 1 . The number of migration samples increased from only 3 to 129, food additives and flavourings from 24 to 144, organoleptic aspects from 53 to 229, packaging defects from 54 to 216, and other hazards from 134 to 194. Additionally, chemical hazards increased from 287 to 523, fraud from 371 to 447, foreign bodies from 561 to 680, and biological hazards from 1,741 to 1,910. Meanwhile, the largest category, allergens, increased from 1,854 to 2,042. 1 show the statistic of hazard-category before and after augmentation. Regarding the product category, which consists of 22 classes, we focused on increasing the number of samples in categories with smaller sample sizes. After applying data augmentation, the number of samples in the sugars and syrups category increased from 5 to 105, feed materials from 6 to 108, and food contact materials from 7

Read the complete text