A Large Language Model–Guided Q‐Learning Method for Food Safety Sampling Decision‐Making
Jiabin Yu, Ruipeng Cheng, Shuaixiang Chen, Xin Zhang, Xiaoyu Cui, Zhiyao ZhaoABSTRACT
Food safety sampling is a critical measure for safeguarding public health; however, current regulatory practices are challenged by fragmented risk signals, constrained inspection resources, and suboptimal inspection efficiency. To address these issues, this paper proposes a food safety sampling decision‐making method based on large language models (LLM)–guided Q‐learning. First, we leverage LLMs to extract and analyze key elements from unstructured online food safety public opinion data. This is integrated with clustering analysis and the entropy weight method to achieve quantitative risk assessment and grading. Subsequently, a food category–region risk score matrix is constructed, and the allocation of sampling frequency is formalized as a sequential decision‐making problem under resource constraints. Q‐learning is then introduced to learn optimal sampling strategies, using LLM‐generated structured heuristic values as prior guidance, thereby reducing ineffective exploration and enhancing training efficiency. Experimental results, based on data from 30 provincial administrative regions, 457 municipalities/counties, and 25 food categories, generated 4690 risk evaluation records as effective inputs for decision‐making. The results demonstrate that the derived sampling strategies align with risk priors, allocating higher sampling intensity to high‐risk food category–region combinations while maintaining coverage balance across food categories and regions. Compared to the baseline without heuristic guidance, LLM guidance significantly reduces convergence iterations while maintaining steady‐state rewards. This indicates that the proposed method accelerates policy learning without compromising long‐term returns. In conclusion, this study validates that the proposed method achieves a closed‐loop integration of risk assessment and decision optimization, providing a data‐driven methodology for intelligent food safety regulation.