Frontiers of Data and Computing ›› 2026, Vol. 8 ›› Issue (3): 217-232.

doi: 10.11871/jfdc.issn.2096-742X.2026.03.018

• Technology and Application • Previous Articles    

A Knowledge Extraction Method for Dietary Reviews and Recommendations Generation Based on LLM

ZHANG Zihan(),YANG Wanxia*(),ZHAO Xiang,ZHOU Beibei,WANG Peilong   

  1. Department of Mechanical and Electrical Engineering, Gansu Agricultural University,Lanzhou, Gansu 730070, China
  • Received:2025-07-22 Online:2026-06-20 Published:2026-06-18
  • Contact: YANG Wanxia E-mail:963813351@qq.com;yangwanxia@163.com

Abstract:

[Objective] A knowledge base is constructed by extracting entities, multiple relationships and attributes from dietary reviews, which is then integrated with a fine-tuned Large Language Model (LLM) to generate diverse and objective dietary recommendations. [Methods] A hybrid knowledge extraction method combining LLM with a semi-automatic approach is proposed. By optimizing LLM prompts based on schema layer definitions, we constrain extraction boundaries and entity types to ensure knowledge integrity and diversity. The Qwen2-7B model is fine-tuned using both LoRA and prompt engineering on dietary review data. Additionally, we develop a dietary recommendation generation workflow on Dify platform, integrating knowledge base retrieval, LLM fine-tuning, and retrieval-augmented generation (RAG) to produce professional and context-aware recommendations. [Conclusions] Experiments demonstrate that our extraction method improves knowledge completeness by 4.4% over conventional knowledge extraction approaches, effectively capturing implicit relations and attributes. The fine-tuned LLM achieves ROUGE-L (82.7%), ROUGE-1 (84.7%), ROUGE-2 (81.5%), and BLEU-4 (82.4%), while the knowledge-augmented version further enhances performance (ROUGE-1: 84.1%, ROUGE-2: 85.6%, ROUGE-L: 83.7%, BLEU-4: 82.9%). This work advances efficient knowledge extraction and domain-specific text generation via LLM-knowledge base collaboration.

Key words: diet review, knowledge extraction, recommendation generation, fine-tuning, large language models