FOOD SCIENCE ›› 2025, Vol. 46 ›› Issue (22): 13-22.doi: 10.7506/spkx1002-6630-20250408-059

• Food Inspection Technology Based on Computer Vision and Deep Learning • Previous Articles     Next Articles

An Intelligent Question Answering System for Food Safety Regulation Based on Retrieval-Augmented Generation Framework

MAO Dianhui, WANG Kehao, CHEN Junhua, XU Jingting   

  1. (1. School of Computer and Artificial Intelligence, Beijing Technology and Business University, Beijing 100048, China; 2. China National Institute of Standardization, Beijing 100191, China;3. Center of Tsinghua Think Tanks, Tsinghua University, Beijing 100084, China)
  • Published:2025-11-21

Abstract: The food safety regulation question answering (QA) task imposes high requirements on model accuracy, compliance, and interpretability. However, existing large language models (LLMs) face challenges in this domain, including imprecise knowledge retrieval, insufficient regulatory interpretation capabilities, and high computational costs. To address these issues, we proposed an intelligent question answering system based on the retrieval augmented generation (RAG) framework, with its core being the food safety regulation large language model (FSR-LLM). By optimizing database storage structures, retrieval strategies and the generator, FSR-LLM enhanced the quality and efficiency of food safety regulation QA. First, we constructed a food safety knowledge graph (KG) database to store regulatory provisions, food safety standards, and related data in a structured manner, improving the model’s capability to organize and utilize domain-specific knowledge. Additionally, we introduced an LLM-guided retrieval strategy, which enables intelligent query parsing and accurately extracts highly relevant information from the food safety regulation KG, reducing the retrieval of irrelevant or misleading contents. For the generator module, we fine-tuned Qwen-7B-Chat using low-rank adaptation (LoRA), ensuring better alignment with food safety QA tasks, while significantly reducing computational costs, allowing training on a single RTX 4090 GPU. Experimental results on the proposed dataset demonstrated that FSR-LLM outperformed baseline models in BLEU-4, Rouge-L, and accuracy, exhibiting higher precision and semantic coherence. This work provides a low-cost, high-performance, and scalable solution for intelligent food safety regulation.

Key words: food safety regulation; retrieval-augmented generation; knowledge graph; low-rank adaptation; fine-tuning

CLC Number: