数据与计算发展前沿 ›› 2026, Vol. 8 ›› Issue (3): 217-232.

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

• 技术与应用 • 上一篇    

基于大语言模型的饮食评论知识抽取与推荐生成方法

张梓涵(),杨婉霞*(),赵翔,周蓓蓓,王培龙   

  1. 甘肃农业大学机电工程学院甘肃 兰州 730070
  • 收稿日期:2025-07-22 出版日期:2026-06-20 发布日期:2026-06-18
  • 通讯作者: 杨婉霞
  • 作者简介:张梓涵,硕士,甘肃农业大学机电工程学院,主要从事网络数据的获取和文本知识的抽取。
    本文主要负责数据集的制作,知识的抽取与论文内容格式的整理。
    ZHANG Zihan, is a Master’s student at the Department of Mechanical and Electrical Engineering, Gansu Agricultural University. Her research interests include network data acquisition and textual knowledge extraction.
    In this paper, she is mainly responsible for datasets construction, knowledge extraction, and formatting the manuscript content.
    E-mail: 963813351@qq.com|杨婉霞,博士,教授,博士生导师,甘肃农业大学机电工程学院。从事信息安全与自然语言处理,在网络流媒体的深层负荷信息的实时分析,文本知识的智能抽取等方面有较深入的研究。
    本文负责文章方案的制定,结构的设计,论文的修正。
    YANG Wanxia, Ph.D., is a Professor and Doctoral Supervisor at the Department of Mechanical and Electrical Engineering, Gansu Agricultural University.
    Her research interests include information security and natural language processing, with in-depth studies on real-time analysis of deep payload information in network streaming media and intelligent extraction of textual knowledge.
    In this paper, she is mainly responsible for the formulation of the research plan, the design of the manuscript structure, and manuscript revision.
    E-mail: yangwanxia@163.com
  • 基金资助:
    国家自然科学基金项目(62262002)

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

摘要:

【目的】为解决现有方法无法抽取饮食评论中的多元关系和多元属性的问题,并构建以知识图谱为主的知识库,用以协同采用及时饮食评论微调的大模型生成多样性和客观性的饮食推荐。 【方法】本文提出大模型结合半自动方式的知识抽取方法,即基于模式层的定义优化大模型Prompt,限定抽取的边界和类型,实现知识抽取的完整性和多元性。结合LoRA和Prompt两种方式,利用饮食评论数据集微调Qwen2-7B大模型,并基于Dify进一步构建了知识库协同大模型的饮食推荐生成工作流,该工作流集知识库、检索增强与微调大模型于一体,可生成专业性和时效性的饮食推荐。 【结论】实验结果表明,与经典知识抽取方法相比,文本方法抽取知识的完整性提升了4.4%,实现了评论中多元及隐含关系和属性的抽取。微调后的大模型的评论生成评价指标ROUGE-L、ROUGE-1、ROUGE-2和BLEU-4分别提升至82.7%、84.7%、81.5%和82.4%。而知识协同大模型的评论生成指标ROUGE-1、ROUGE-2、ROUGE-L、BLEU-4则分别提升至84.1%、85.6%、83.7%和82.9%。本文为利用大模型完成知识的高效抽取以及知识库构建提供了重要参考,为知识协同大模型生成领域文本提供了思路。

关键词: 饮食评论, 知识抽取, 推荐生成, 微调, 大语言模型

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