欢迎您访问《智慧农业(中英文)》官方网站! English

Smart Agriculture ›› 2023, Vol. 5 ›› Issue (4): 105-116.doi: 10.12133/j.smartag.SA202311005

• 专题--面向智慧农业的人工智能和机器人技术 • 上一篇    下一篇

基于人工智能大模型技术的果蔬农技知识智能问答系统

王婷1,2(), 王娜3, 崔运鹏1,2(), 刘娟1,2   

  1. 1. 中国农业科学院农业信息研究所,北京 100081,中国
    2. 农业农村部农业大数据重点实验室,北京 100081,中国
    3. 96962部队,北京 102206,中国
  • 收稿日期:2023-11-01 出版日期:2023-12-30
  • 作者简介:
    王 婷,研究方向为深度学习方法的理论研究与应用、生信分析。E-mail:

    WANG Ting, E-mail:

  • 通信作者:
    崔运鹏,博士,研究员,研究方向为农业大数据挖掘分析、自然语言处理、生信分析。E-mail:

Agricultural Technology Knowledge Intelligent Question-Answering System Based on Large Language Model

WANG Ting1,2(), WANG Na3, CUI Yunpeng1,2(), LIU Juan1,2   

  1. 1. Agricultural Information Institute, Chinese Academy of Agricultural Sciences, Beijing 100081, China
    2. Key Laboratory of Big Agri-data, Ministry of agriculture and rural areas, Beijing 100081, China
    3. Unit 96962, Beijing 102206, China
  • Received:2023-11-01 Online:2023-12-30
  • corresponding author:
    CUI Yunpeng, E-mail:
  • Supported by:
    Beijing Digital Agriculture Innovation Consortium Project(BAIC10-2023); Fundamental Research Funds of Chinese Academy of Agricultural Sciences(JBYW-AII-2023-31); National Key Research and Development Program of China(2022YFF0711902)

摘要:

[目的/意义] 乡村振兴战略给农业技术推广提出新的要求,使农业推广知识的供给形式有待进一步创新。以果蔬农技知识服务为需求导向,基于前沿大语言模型技术,面向新型农业知识导读和知识问答等农技推广服务,构建果蔬农技知识智能问答系统。 [方法] 基于草莓种植户需求分析,把草莓栽培农技知识划分为不同主题,形成知识对象识别和知识问答两种大模型下游任务,结合机器自动标注和人工标注的方法构建小样本高质量训练语料;通过对比已有的4种大语言模型:Baichuan2-13B-Chat、ChatGLM2-6B、Llama-2-13B-Chat、ChatGPT的性能表现,选择性能最优的模型作为基础模型,按照“优质语料+预训练大模型+微调”的研究思路,训练具有语义分析、上下文关联和生成能力,能够适应多种下游任务的深度神经网络,构建农业知识问答大模型;采用数据优化、检索增强生成技术等多种策略缓解大模型幻觉问题;研发果蔬农技知识智能问答系统,生成高精度、无歧义的农业知识答案,同时支持用户多轮问答。 [结果和讨论] 以精准率和召回率为命名实体识别任务的性能表现指标,参与测评的国内主流模型在微调后不同知识主题下的平均精准率均超过85%,平均召回率表现各异,其中知识实体类型的数量、标注语料数量等因素都会影响大模型性能;以幻觉率和语义相似度为知识问答任务的性能表现指标,数据优化、采用检索增强生成技术等策略以10%~40%的幅度有效降低大模型幻觉率,并有效提高大模型的语义相似度。 [结论] 在农业领域的命名实体识别和知识问答任务中,预训练大模型ChatGLM的表现性能最优。针对预训练大模型下游任务的微调和基于检索增强生成(Retrieval-Augmented Generation,RAG)技术的模型优化可以缓解大模型幻觉问题,显著提升大模型性能。大模型技术具有创新农技知识服务模式、优化农业知识推广的潜力,能够有效降低种植户获取高质量有效知识的时间成本,引导更多的种植户实现农业技术创新和转型。但是由于性能不稳定等诸多问题,大模型的优化方法和具体场景应用仍需进一步深入研究。

关键词: 大模型, 生成式预训练变换器, 农技知识, 智能问答, 命名实体识别

Abstract:

[Objective] The rural revitalization strategy presents novel requisites for the extension of agricultural technology. However, the conventional method encounters the issue of a contradiction between supply and demand. Therefore, there is a need for further innovation in the supply form of agricultural knowledge. Recent advancements in artificial intelligence technologies, such as deep learning and large-scale neural networks, particularly the advent of large language models (LLMs), render anthropomorphic and intelligent agricultural technology extension feasible. With the agricultural technology knowledge service of fruit and vegetable as the demand orientation, the intelligent agricultural technology question answering system was built in this research based on LLM, providing agricultural technology extension services, including guidance on new agricultural knowledge and question-and-answer sessions. This facilitates farmers in accessing high-quality agricultural knowledge at their convenience. [Methods] Through an analysis of the demands of strawberry farmers, the agricultural technology knowledge related to strawberry cultivation was categorized into six themes: basic production knowledge, variety screening, interplanting knowledge, pest diagnosis and control, disease diagnosis and control, and drug damage diagnosis and control. Considering the current situation of agricultural technology, two primary tasks were formulated: named entity recognition and question answering related to agricultural knowledge. A training corpus comprising entity type annotations and question-answer pairs was constructed using a combination of automatic machine annotation and manual annotation, ensuring a small yet high-quality sample. After comparing four existing Large Language Models (Baichuan2-13B-Chat, ChatGLM2-6B, Llama 2-13B-Chat, and ChatGPT), the model exhibiting the best performance was chosen as the base LLM to develop the intelligent question-answering system for agricultural technology knowledge. Utilizing a high-quality corpus, pre-training of a Large Language Model and the fine-tuning method, a deep neural network with semantic analysis, context association, and content generation capabilities was trained. This model served as a Large Language Model for named entity recognition and question answering of agricultural knowledge, adaptable to various downstream tasks. For the task of named entity recognition, the fine-tuning method of Lora was employed, fine-tuning only essential parameters to expedite model training and enhance performance. Regarding the question-answering task, the Prompt-tuning method was used to fine-tune the Large Language Model, where adjustments were made based on the generated content of the model, achieving iterative optimization. Model performance optimization was conducted from two perspectives: data and model design. In terms of data, redundant or unclear data was manually removed from the labeled corpus. In terms of the model, a strategy based on retrieval enhancement generation technology was employed to deepen the understanding of agricultural knowledge in the Large Language Model and maintain real-time synchronization of knowledge, alleviating the problem of LLM hallucination. Drawing upon the constructed Large Language Model, an intelligent question-answering system was developed for agricultural technology knowledge. This system demonstrates the capability to generate high-precision and unambiguous answers, while also supporting the functionalities of multi-round question answering and retrieval of information sources. [Results and Discussions] Accuracy rate and recall rate served as indicators to evaluate the named entity recognition task performance of the Large Language Models. The results indicated that the performance of Large Language Models was closely related to factors such as model structure, the scale of the labeled corpus, and the number of entity types. After fine-tuning, the ChatGLM Large Language Model demonstrated the highest accuracy and recall rate. With the same number of entity types, a higher number of annotated corpora resulted in a higher accuracy rate. Fine-tuning had different effects on different models, and overall, it improved the average accuracy of all models under different knowledge topics, with ChatGLM, Llama, and Baichuan values all surpassing 85%. The average recall rate saw limited increase, and in some cases, it was even lower than the values before fine-tuning. Assessing the question-answering task of Large Language Models using hallucination rate and semantic similarity as indicators, data optimization and retrieval enhancement generation techniques effectively reduced the hallucination rate by 10% to 40% and improved semantic similarity by more than 15%. These optimizations significantly enhanced the generated content of the models in terms of correctness, logic, and comprehensiveness. [Conclusion] The pre-trained Large Language Model of ChatGLM exhibited superior performance in named entity recognition and question answering tasks in the agricultural field. Fine-tuning pre-trained Large Language Models for downstream tasks and optimizing based on retrieval enhancement generation technology mitigated the problem of language hallucination, markedly improving model performance. Large Language Model technology has the potential to innovate agricultural technology knowledge service modes and optimize agricultural knowledge extension. This can effectively reduce the time cost for farmers to obtain high-quality and effective knowledge, guiding more farmers towards agricultural technology innovation and transformation. However, due to challenges such as unstable performance, further research is needed to explore optimization methods for Large Language Models and their application in specific scenarios.

Key words: LLM, generative pre-trained transformer, agricultural technology knowledge, intelligent question answering, name entity identity