Agricultural intelligent dialogue method and system based on multi-model fusion

By integrating agricultural-specific models and general models in the intelligent dialogue system, and using agricultural professional dictionary and prompt styles for dynamic selection, the problem of insufficient accuracy of dialogue in the agricultural field is solved, and precise adaptation of dialogue in the agricultural field and the consistency and information density of multiple rounds of dialogue are achieved.

CN119513243APending Publication Date: 2025-02-25GUANGXI JIEJIARUN TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411492839.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

There are questions that the existing intelligent dialogue system is not answered accurately in the application of the agricultural field, especially when it involves professional agricultural knowledge, the output accuracy of the general model is insufficient and cannot meet the needs of agricultural professional practitioners.

Method used

Using an agricultural intelligent dialogue method based on multi-model fusion, integrating agricultural-specific models and general models, dynamically selecting appropriate models and prompt styles to generate replies by building agricultural professional dictionaries and defining multiple prompt styles.

Benefits of technology

It can make accurate answers in the agricultural field, whether it contains professional knowledge or not, and output through matching prompt styles, improving the precise adaptation of different agricultural dialogue scenarios and the consistency and information density of multiple rounds of dialogues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513243A_ABST
    Figure CN119513243A_ABST
Patent Text Reader

Abstract

The invention discloses an agricultural intelligent dialogue method and system based on multi-model fusion, relates to the technical field of artificial intelligence, and solves the problem that a large-scale language model is not accurate enough in application in the agricultural professional field and the non-agricultural professional field. According to the method, a plurality of large-scale language models are integrated into a unified framework, then an agricultural professional dictionary is constructed, then a plurality of prompt styles are defined and integrated, keywords of each prompt style are defined, and after user questions are obtained, one prompt style is selected according to task requirements for dialogue output. And finally returning a reply generated by the selected large-scale language model based on the selected prompt style to the user. According to the method, through flexible selection of models and prompt styles, accurate adaptation to different agricultural dialogue scenes is realized, and meanwhile, the continuity and information density of multiple rounds of dialogues are improved through a context optimization technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an agricultural intelligent dialogue method and system based on multi-model fusion. Background Art

[0002] At present, the application of intelligent dialogue systems in various fields is becoming more and more widespread. Intelligent dialogue systems are computer programs built using artificial intelligence technologies such as natural language processing and machine learning. They can understand and generate human language and realize natural communication between humans and machines. These systems convert the user's voice into text through speech recognition, and then analyze the intention and key information in the text through natural language understanding technology. Then the dialogue management system determines the most appropriate response strategy based on the analysis results, and finally generates a response through natural language generation technology and converts the text back to speech by speech synthesis technology. Intelligent dialogue systems have been widely used in many fields such as intelligent customer service, education, medical care and entertainment. They greatly improve efficiency and user experience by providing automated customer support, personalized learning experience, auxiliary diagnosis and treatment, and rich entertainment experience. With the continuous advancement of technology, the application scope and functions of intelligent dialogue systems are also expanding, heralding a more intelligent future.

[0003] However, existing systems usually rely on a single model for dialogue generation, which is difficult to meet the needs of diverse scenarios. In addition, traditional dialogue systems have deficiencies in context understanding and multi-round dialogue coherence, which affects the user experience. Especially in the agricultural field, farmers and agricultural practitioners need accurate and professional knowledge support and decision-making assistance, and existing dialogue systems are difficult to meet their specific needs. Therefore, some of the current general models are not suitable for questions and answers about some professional agricultural knowledge. When it comes to questions and answers about professional agricultural knowledge, the output of general models is often not accurate enough and cannot be well applied to the needs of professional agricultural practitioners. Some large language models specifically for the agricultural field are only professional in the output of agricultural knowledge, and their answers in other fields or general knowledge are slightly lacking. Therefore, these current large-scale language models have certain deficiencies in application.

[0004] In view of this, an agricultural intelligent dialogue method and system based on multi-model fusion is needed. Summary of the invention

[0005] In view of the problem that the large-scale language model in the prior art has insufficient answers in the application of agricultural professional fields and non-agricultural professional fields, the present invention provides an agricultural intelligent dialogue method and system based on multi-model fusion, which can integrate agricultural-specific models and general models that are adapted to the accuracy of the agricultural field, so that accurate answers can be given regardless of whether the dialogue contains professional knowledge in the agricultural field. The specific technical solution is as follows:

[0006] An agricultural intelligent dialogue method based on multi-model fusion includes the following steps:

[0007] S1: Integrate several large-scale language models into a unified framework, design standardized model interfaces, and integrate different models;

[0008] S2: Construct an agricultural professional dictionary, which includes professional keywords or themes in the agricultural field, and match the keywords or themes in the agricultural professional dictionary with the corresponding models;

[0009] S3: define and integrate several prompt styles, define keywords for each prompt style, and after obtaining the user's question, select a prompt style for dialogue output according to task requirements, where the task requirements are obtained by identifying the keywords of the user's question;

[0010] S4: Return the response generated by the selected large-scale language model based on the selected prompt style to the user.

[0011] Preferably, the large-scale language model includes a large agriculture-specific model and a general model.

[0012] Preferably, step S2 is specifically as follows:

[0013] Construct an agricultural professional dictionary, which includes professional keywords or topics in the agricultural field;

[0014] Detect whether the input contains keywords from the agricultural professional dictionary;

[0015] Detect whether the input contains topics from the agricultural professional dictionary;

[0016] If a keyword or topic included in the agricultural professional dictionary is detected, the agricultural-specific model is used, otherwise the general model is used.

[0017] Preferably, the keywords in the agricultural professional dictionary include rice planting, wheat rotation, bacterial leaf blight, stem borer control, soil pH adjustment, organic fertilizer application, drought and flood disaster response, climate change impact, agricultural subsidy policy, and market analysis; the topics in the agricultural professional dictionary include: crop planting, pest and disease control, soil management, agricultural meteorology, and agricultural policy.

[0018] Preferably, step S2 is specifically as follows:

[0019] Construct an agricultural professional dictionary, which includes professional keywords or topics in the agricultural field;

[0020] Detect whether the input contains keywords in the agricultural professional dictionary, and use the part-of-speech tagging in natural language processing technology to tag the keywords in the agricultural professional dictionary;

[0021] Assign weights to each part of speech;

[0022] If a keyword included in the agricultural professional dictionary is detected and the part of speech of the keyword is greater than the set weight threshold, the agricultural-specific model is selected, otherwise the general model is selected.

[0023] Preferably, the prompting styles include Chain of Thought (CoT), Chain of Commands (CoC) and small sample learning styles.

[0024] Preferably, the method further comprises the following steps:

[0025] A semantic compression algorithm is used to compress the conversation context.

[0026] An agricultural intelligent dialogue system based on multi-model fusion, applied to the above method, comprises:

[0027] Interaction layer: responsible for direct interaction with users, receiving user input and displaying system responses;

[0028] Logical layer: The core is the `DialogueManager` class, which is responsible for coordinating the work of each module and managing the entire dialogue process;

[0029] Model layer: Integrate multiple large-scale language models and support multi-model fusion and dynamic calling;

[0030] Data layer: stores and provides data required by the system, including agricultural professional dictionaries and user data.

[0031] A computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the agricultural intelligent dialogue method based on multi-model fusion as described above.

[0032] A processor is used to run a program, wherein when the program is run, the agricultural intelligent dialogue method based on multi-model fusion as described above is executed.

[0033] Compared with the prior art, the present invention has the following beneficial effects:

[0034] The present invention integrates several large-scale language models into a unified framework, designs standardized model interfaces, and integrates different models; then constructs an agricultural professional dictionary, which includes professional keywords or themes in the agricultural field, and matches the corresponding models through the keywords or themes in the agricultural professional dictionary; then defines and integrates several prompt styles, defines keywords for each prompt style, obtains user questions, and selects a prompt style for dialogue output according to task requirements, and the task requirements are obtained by identifying the keywords of the user's questions; finally, the response generated by the selected large-scale language model based on the selected prompt style is returned to the user. Based on this, the present invention can make accurate answers to the dialogue regardless of whether it contains professional knowledge in the agricultural field, and the accurate answers will be output through the matching prompt style. By flexibly selecting models and prompt styles, accurate adaptation to different agricultural dialogue scenarios is achieved, and the coherence and information density of multi-round dialogues are improved through context optimization technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.

[0036] Figure 1 is a flow chart of the method of the present invention;

[0037] Figure 2 It is a specific flow chart of step S2 of the present invention. DETAILED DESCRIPTION

[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0040] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0041] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0042] In one embodiment of the present invention, an agricultural intelligent dialogue method based on multi-model fusion is provided. Figure 1 As shown, the following steps are included:

[0043] S1: Integrate several large-scale language models into a unified framework, design standardized model interfaces, and integrate different models; the large-scale language models include agricultural big models and general models, such as OpenAI's GPT series.

[0044] In addition, after this step, you can also set up a flexible `models_config` configuration system to support dynamic addition and adjustment of models.

[0045] S2: Construct an agricultural professional dictionary, professional keywords or topics in the agricultural field, and match the keywords or topics in the dictionary with the corresponding models;

[0046] Keywords or subject categories include but are not limited to:

[0047] Crop planting: such as "rice planting", "wheat rotation"

[0048] Pest and disease control: such as "bacterial leaf blight" and "stem borer control"

[0049] Soil management: such as "soil pH adjustment", "organic fertilizer application"

[0050] Agricultural meteorology: such as "response to drought and flood disasters" and "impact of climate change"

[0051] Agricultural policies: such as "agricultural subsidy policy", "market analysis"

[0052] like Figure 2 As shown, a large-scale language model is selected by matching the agricultural-specific large model after identifying the keywords or topics in the agricultural professional dictionary. If no keywords or topics are identified, a general model is directly matched.

[0053] Alternatively, you can select models by matching examples in the dictionary to the models, as in the following example:

[0054] Keywords / Topics Matching Model Wheat rotation Model B Bacterial blight Model C Stem borer control Model C Soil pH Adjustment Model D Organic fertilizer application Model D Drought and flood response Model A …… ……

[0055] These keywords or topics are organized into a structured dictionary. During the conversation, the system quickly hits the corresponding model by matching the keywords or topics in the user input, thereby selecting a model with the corresponding agricultural knowledge base for conversation generation.

[0056] By matching keywords or topics in the agricultural professional dictionary, the most appropriate model is selected for dialogue generation. For example, for questions involving "bacterial leaf blight", the system will select Model C; while for questions about "rice planting", the system may select Model A. This dynamic selection mechanism not only improves the flexibility of the system, but also optimizes resource utilization.

[0057] The specific implementation process of step S2 is described below with reference to a specific example:

[0058] a) Keyword matching: Detect whether the input contains keywords in a specific field (such as agriculture).

[0059] b) Simple semantic analysis: using basic natural language processing techniques such as word segmentation and part-of-speech tagging.

[0060] Based on the input analysis results, the following strategy is used to select the model:

[0061] a) If agriculture-related keywords are detected, the agri-special-model is preferred.

[0062] b) For other cases, select the appropriate general model according to the preset rules.

[0063] S3: Define and integrate several prompt styles, and select a prompt style for dialogue output based on the dialogue scenario and task requirements;

[0064] The prompting styles include Chain of Thought (CoT), Chain of Commands (CoC) and small sample learning styles. The following is an introduction to each prompting style:

[0065] Chain of Thought (CoT) is a technique used in the field of natural language processing (NLP) to improve the performance of large language models (LLMs) on complex reasoning tasks. CoT guides the model to solve the problem step by step by including intermediate reasoning steps in the model's input, thereby improving the accuracy and interpretability of the model. This approach mimics the human thinking process, that is, a series of thinking and analysis are carried out before the final answer is reached. CoT technology can be divided into two forms: Few-shot CoT and Zero-shot CoT. The former requires some labeled examples to guide the model, while the latter does not require additional annotations and only requires specific instructions to be added to the prompt.

[0066] Chain of Commands (CoC) is a design pattern used in Microsoft Dynamics 365 to extend and customize the base code. With CoC, developers can create extension classes to wrap existing public or protected methods to add functionality without directly modifying the original code. In CoC, developers can access the public and protected methods and variables of the base class and create a command chain by using the `next` keyword. This chain can contain multiple extension methods that will be executed in a certain order. The use of CoC can improve the maintainability and extensibility of the code while reducing the difficulty of future upgrades and version enhancements.

[0067] Few-shot learning style is a method in machine learning that aims to build accurate machine learning models with only a small number of training samples. This method is particularly suitable for scenarios where data is scarce, such as diagnosis of rare diseases or prediction of rare events. Few-shot learning can improve the performance of the model by using techniques such as prior knowledge, transfer learning, and meta-learning. The importance of few-shot learning lies in its ability to simulate the way humans learn, that is, humans can usually recognize and learn new concepts or skills after seeing a small number of examples. In addition, few-shot learning can also reduce data collection and computing costs because it only requires a small amount of data to train the model.

[0068] The specific implementation process of step S3 is further explained below with reference to an example:

[0069] The present invention implements a prompt_styles dictionary, which contains multiple prompt styles (for example, Chain of Thought (CoT), Chain of Commands (CoC), and small sample learning styles, etc.). Through the choose_prompt_style method, the system can intelligently select the most appropriate prompt style according to the dialogue scenario and task requirements. The specific implementation of this method is as follows:

[0070] 1. Extract key information

[0071] The system uses natural language processing (NLP) technology to extract key information from user input:

[0072] a) Use word segmentation techniques (such as jieba) to break user input into words.

[0073] b) Use POS tagging to identify important parts of speech such as nouns, verbs, and adjectives.

[0074] c) Use named entity recognition (NER) techniques to identify specific types of entities, such as places, organizations, or professional terms.

[0075] For example, for the input "How can I prevent and control rice pests and diseases?", the system will extract the following key information:

[0076] Keywords: ["control", "rice", "diseases and insect pests"]

[0077] Entity: ["rice"] (identified as a crop entity)

[0078] 2. Identify User Intent

[0079] Based on the extracted key information and conversation context, the system uses a rule-based approach to identify user intent:

[0080] a) Define a set of intent categories, such as "query", "command", "calculation", "example", and "agricultural question".

[0081] b) Define feature words and rules for each intent. For example, words such as "how" and "why" usually represent the "ask" intent.

[0082] c) Analyze the conversation context and consider the impact of previous interactions on current intent.

[0083] d) Calculate the score of each intent and select the one with the highest score as the recognition result.

[0084] In this example, the system might identify the user intent as "agricultural issues" because the input contains agriculture-related terms such as "rice" and "pests and diseases."

[0085] 3. Matching task requirements

[0086] The system matches the identified user intent with predefined task requirements:

[0087] a) Define keywords and applicable scenarios for each prompt style.

[0088] b) Calculate the matching degree between the keywords in the user input and each prompt style keyword.

[0089] c) Combined with user intent, a comprehensive score is calculated for each prompt style.

[0090] d) Select the prompt style with the highest score as the final result.

[0091] In this example, since the "agricultural issues" intent was recognized and the input contains agriculture-related terms such as "rice" and "pests and diseases", the system is likely to select the "agri_specific" prompt style.

[0092] Sample code:

[0093] User input:

[0094] "How can we prevent and control rice pests and diseases?"

[0095] Conversation context:

[0096] ["Last time we discussed how to grow rice."]

[0097] Processing steps:

[0098] Extract key information:

[0099] Keywords: ["control", "rice", "diseases and insect pests"]

[0100] Entity: ["Rice"] (crop)

[0101] Identifying user intent:

[0102] Calculate the score for each intent:

[0103] inquiry:1 (because it contains "how")

[0104] instruction:0

[0105] calculation:0

[0106] example:0

[0107] agri_question:2 (because it contains "rice" and "pests and diseases" and is contextually relevant)

[0108] Recognized intent: agri_question

[0109] Matching task requirements:

[0110] Calculate the style score for each prompt:

[0111] cot:1 (matches the "how" keyword)

[0112] coc:0

[0113] small_sample:0

[0114] calculation:0

[0115] agri_specific:4 (matches the keywords "rice" and "pests and diseases", and the intent is agricultural issues)

[0116] Select a prompt style:

[0117] Select the "agri_specific" style with the highest score

[0118] 5. Generate the final prompt:

[0119] "Please provide professional advice on this agricultural issue based on the latest agricultural technology and practices."

[0120] Through this detailed process, the system is able to intelligently select the most appropriate prompt style based on the specific content and context of the user's input, thereby guiding the model to generate more professional and targeted responses, especially when dealing with agriculture-related issues.

[0121] S4: Return the response generated by the selected model based on the selected prompt style to the user.

[0122] The following is a specific example to illustrate the implementation process of the whole process of this method:

[0123] When a farmer asks, “My rice leaves are turning yellow, what should I do?” the system processes the question as follows:

[0124] a) The system identifies the keywords "rice" and "yellowing leaves" and, through matching with agricultural professional dictionaries, determines that this is a question about rice diseases.

[0125] b) The system selects Model C to generate answers, which has a rich knowledge base on pest control.

[0126] c) Use the CoT (Chain of Thought) prompt style to guide the model to analyze the problem step by step:

[0127] First, list the possible reasons why rice leaves turn yellow;

[0128] Secondly, eliminate some possibilities based on the information provided by the user (if any);

[0129] Finally, the most likely causes and corresponding solutions are given.

[0130] d) The system generates a response similar to the following:

[0131] "There are several possible reasons for yellowing rice leaves: 1) iron deficiency; 2) nitrogen deficiency; 3) virus infection. Considering that it is the middle of rice growth, the most likely cause is iron deficiency. It is recommended that you:

[0132] 1. Check the soil pH first. If it is high, apply ferrous sulfate appropriately.

[0133] 2. Spray 0.2%-0.5% ferrous sulfate solution on the leaves once every 7-10 days.

[0134] 3. Improve soil drainage conditions to avoid long-term waterlogging in the soil.

[0135] If the situation does not improve after taking these measures, it is recommended that you contact a local agricultural technician for an on-site inspection.”

[0136] In one embodiment of the present invention, on the basis of the previous embodiment, an advanced semantic compression algorithm is also used to compress the conversation context, ensuring that unnecessary content is reduced while retaining key information, thereby improving the processing efficiency of the system. In addition, the system uses a vector database to build an efficient retrieval system and supports dynamic knowledge injection, thereby enhancing the system's responsiveness and information richness. In order to handle long-term dependencies, the present invention also introduces a hierarchical attention mechanism, which enables the system to better focus on key information in the conversation and improve the coherence and accuracy of the conversation.

[0137] The conversation history is streamlined using context compression technology, and external knowledge is dynamically injected through retrieval enhancement. This process ensures the coherence and information content of the conversation, especially in multi-round conversations, which can effectively maintain the consistency of the topic. Through the optimized retrieval system, the system can refer to more external information when generating responses, thereby providing more comprehensive and accurate answers.

[0138] In one embodiment of the present invention, an agricultural intelligent dialogue system based on multi-model fusion is provided, comprising:

[0139] Interaction layer: responsible for direct interaction with users, receiving user input and displaying system responses.

[0140] Logical layer: The core is the `DialogueManager` class, which is responsible for coordinating the work of various modules and managing the entire dialogue process.

[0141] Model layer: Integrates multiple large-scale language models and supports multi-model fusion and dynamic calling.

[0142] Data layer: stores and provides data required by the system, including agricultural professional dictionaries, user data, etc.

[0143] The specific technical implementation is as follows:

[0144] 1. Multi-model fusion framework:

[0145] Achieve compatibility between different language models through standardized model interfaces;

[0146] The `models_config` configuration system supports dynamic addition, adjustment and management of models, ensuring the flexibility and scalability of the system.

[0147] The detailed steps of models_config configuration system:

[0148] Model definition:

[0149] Create a configuration item for each supported model, including the model name and related parameters.

[0150] Defines the characteristics of the model, such as maximum number of tokens, temperature, top_p value, etc.

[0151] Keyword mapping:

[0152] Define a set of keywords and their weights for each model.

[0153] These keywords reflect the model's expertise and applicable scenarios.

[0154] Dynamic management mechanism:

[0155] Implement methods for adding new models, allowing the model library to be extended at runtime.

[0156] Provides an interface for updating existing model configurations to accommodate model upgrades and adjustments.

[0157] Model selection algorithm:

[0158] Based on the user input and the current conversation context, a suitability score is calculated for each model.

[0159] Consider keyword match, model performance metrics, and historical usage.

[0160] Load Balancing:

[0161] Implement a tracking mechanism for how often a model is used.

[0162] Consider load balancing when choosing a model to avoid over-reliance on a single model.

[0163] Example:

[0164]

[0165]

[0166] 2. Dynamic prompt mechanism:

[0167] The `prompt_styles` dictionary stores multiple prompt styles;

[0168] The `choose_prompt_style` method intelligently selects the optimal prompt style based on the conversation context and task requirements to improve the conversation quality.

[0169] The detailed steps of choose_prompt_style method are as follows:

[0170] Input preprocessing:

[0171] Use tools such as jieba to segment user input.

[0172] Extract key words and phrases.

[0173] Style definition:

[0174] Define feature keywords and weights for each prompt style.

[0175] Establish a mapping relationship between style and task type.

[0176] Contextual Analysis:

[0177] Check recent conversation history and extract relevant information.

[0178] Identify the topic and direction of the conversation.

[0179] Multi-dimensional rating:

[0180] An initial score for each style is calculated based on keyword matching.

[0181] Adjust the score to account for contextual relevance.

[0182] The length and complexity of the user input is analyzed to further adjust the score.

[0183] Dynamic Threshold Adjustment:

[0184] Sets the dynamic threshold for selecting a style.

[0185] The threshold is adjusted dynamically based on historical selection results and user feedback.

[0186] Style options:

[0187] The style with the highest score exceeding the threshold is selected.

[0188] If no style score exceeds the threshold, the default style is selected.

[0189] Optimized results:

[0190] Implement a smooth mechanism for style switching to avoid discontinuity caused by frequent switching.

[0191] Keep your style consistent throughout the conversation unless there is an obvious need to switch styles.

[0192] Feedback Learning:

[0193] Record the results and effects of each style choice.

[0194] Optimize the style selection algorithm based on user feedback and conversation quality.

[0195] Pseudocode example:

[0196] #Define keywords and weights for each style

[0197] style_keywords={

[0198] "cot":{"why":2,"how":2,"how":1.5,"explanation":2,"principle":2},

[0199] "coc":{"background":1.5,"situation":1.5,"condition":1.5,"context":2,"scene":2},

[0200] "small_sample":{"Example":2,"Example":2,"Give an example":1.5,"For example":1.5},

[0201] "calculation":{"calculation":2,"data":1.5,"analysis":2,"statistics":2},

[0202] "code_explanation":{"code":2,"program":2,"function":1.5,"class":1.5,"algorithm":2},

[0203] "creative_writing":{"write":2,"creation":2,"story":1.5,"article":1.5,"poem":2},

[0204] "role_play":{"Play":2,"Role":2,"Assumption":1.5,"If I were":2},

[0205] "visualization":{"Chart":2,"Visualization":2,"Display":1.5,"Graphics":1.5}

[0206] }

[0207] # Calculate the score for each style

[0208] style_scores = {}

[0209] for style,keywords in style_keywords.items():

[0210] score=sum(keywords.get(word,0)for word in words)

[0211] #Consider the conversation context

[0212] if dialogue_context:

[0213] last_message=dialogue_context[-1]['content']

[0214] score+=sum(keywords.get(word,0)for word in jieba.cut(last_message))*0.5

[0215] style_scores[style] = score

[0216] #If there is no obvious style preference, choose the default style based on input length and complexity if max(style_scores.values()) == 0:

[0217] input_length=len(user_input)

[0218] if input_length<20:

[0219] return "small_sample"

[0220] elif input_length<50:

[0221] return "coc"

[0222] else:

[0223] return "cot"

[0224] #Select the style with the highest score

[0225] chosen_style=max(style_scores,key=style_scores.get)

[0226] 3. Agricultural professional dictionary:

[0227] Construct agricultural professional dictionaries for matching keywords or topics, including crop planting, pest control, soil management, weather forecast, etc.;

[0228] Utilize the keywords or topics in the dictionary to map to the corresponding models, supporting efficient model matching and switching.

[0229] 4. Context compression and retrieval enhancement:

[0230] Use semantic compression algorithm to simplify the conversation context and retain important information;

[0231] Vector database and hierarchical attention mechanism are used to achieve efficient information retrieval and dynamic knowledge injection to improve response quality.

[0232] 5. Adaptive computing resource allocation:

[0233] Evaluate the complexity and needs of user input, dynamically select the right-sized model for processing, and optimize system resource utilization.

[0234] 6. Agricultural scenario application examples:

[0235] The application process of the system in actual agricultural problems is demonstrated in detail, verifying the practicality and effectiveness of the system.

[0236] 7. Efficient resource utilization and end-to-end deployment:

[0237] Through multi-model fusion and dynamic selection mechanism, multiple small parameter models are combined to achieve a parameter effect of hundreds of billions, significantly reducing computing power investment;

[0238] Supports end-to-end deployment, especially suitable for scenarios without Internet access, such as farms, to improve system flexibility and application scope

[0239] In summary, the present invention integrates several large-scale language models into a unified framework, designs standardized model interfaces, and integrates different models; then constructs an agricultural professional dictionary, which includes professional keywords or themes in the agricultural field, and matches the corresponding models through the keywords or themes in the agricultural professional dictionary; then defines and integrates several prompt styles, defines keywords for each prompt style, and after obtaining user questions, selects a prompt style for dialogue output according to task requirements, and the task requirements are obtained by identifying the keywords of the user's questions; finally, the response generated by the selected large-scale language model based on the selected prompt style is returned to the user. Based on this, the present invention can make accurate answers to the dialogue regardless of whether it contains professional knowledge in the agricultural field, and the accurate answers will be output through the matching prompt style. By flexibly selecting models and prompt styles, accurate adaptation to different agricultural dialogue scenarios is achieved, and the coherence and information density of multi-round dialogues are improved through context optimization technology.

[0240] Those of ordinary skill in the art will appreciate that the units of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition of each example has been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0241] In the embodiments provided by the present invention, it should be understood that the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units can be combined into one unit, one unit can be split into multiple units, or some features can be ignored, etc.

[0242] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0243] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-0nlyMemory), random access memory (RAM, RandomAccessMemory), mobile hard disk, magnetic disk or optical disk, etc., which can store program code.

[0244] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

Claims

1. An agricultural intelligent dialogue method based on multi-model fusion, characterized in that: The following steps are involved: S1: Integrate several large-scale language models into a unified framework, design standardized model interfaces, and integrate different models; S2: Construct an agricultural professional dictionary, which includes professional keywords or themes in the agricultural field, and match the keywords or themes in the agricultural professional dictionary with the corresponding models; S3: define and integrate several prompt styles, define keywords for each prompt style, and after obtaining the user's question, select a prompt style for dialogue output according to task requirements, where the task requirements are obtained by identifying the keywords of the user's question; S4: Return the response generated by the selected large-scale language model based on the selected prompt style to the user.

2. The agricultural intelligent dialogue method based on multi-model fusion according to claim 1 is characterized in that: The large-scale language model includes a large agricultural-specific model and a general model.

3. The agricultural intelligent dialogue method based on multi-model fusion according to claim 2 is characterized in that: Step S2 is specifically as follows: Construct an agricultural professional dictionary, which includes professional keywords or topics in the agricultural field; Detect whether the input contains keywords from the agricultural professional dictionary; Detect whether the input contains topics from the agricultural professional dictionary; If a keyword or topic included in the agricultural professional dictionary is detected, the agricultural-specific model is used, otherwise the general model is used.

4. The agricultural intelligent dialogue method based on multi-model fusion according to claim 3 is characterized in that: The key words in the agricultural professional dictionary include rice planting, wheat rotation, bacterial leaf blight, stem borer control, soil pH adjustment, organic fertilizer application, drought and flood disaster response, climate change impact, agricultural subsidy policy, and market analysis; the topics in the agricultural professional dictionary include: crop planting, pest and disease control, soil management, agricultural meteorology, and agricultural policy.

5. The agricultural intelligent dialogue method based on multi-model fusion according to claim 2 is characterized in that: Step S2 is specifically as follows: Construct an agricultural professional dictionary, which includes professional keywords or topics in the agricultural field; Detect whether the input contains keywords in the agricultural professional dictionary, and use the part-of-speech tagging in natural language processing technology to tag the keywords in the agricultural professional dictionary; Assign weights to each part of speech; If a keyword included in the agricultural professional dictionary is detected and the part of speech of the keyword is greater than the set weight threshold, the agricultural-specific model is selected, otherwise the general model is selected.

6. The agricultural intelligent dialogue method based on multi-model fusion according to claim 1 is characterized in that: The prompting styles include Chain of Thought, Chain of Commands, and small sample learning styles.

7. The agricultural intelligent dialogue method based on multi-model fusion according to claim 1 is characterized in that: The following steps are also included: A semantic compression algorithm is used to compress the conversation context.

8. An agricultural intelligent dialogue system based on multi-model fusion, characterized in that: The method applied to any one of claims 1 to 6 comprises: Interaction layer: responsible for direct interaction with users, receiving user input and displaying system responses; Logical layer: The core is the `DialogueManager` class, which is responsible for coordinating the work of each module and managing the entire dialogue process; Model layer: Integrate multiple large-scale language models and support multi-model fusion and dynamic calling; Data layer: stores and provides data required by the system, including agricultural professional dictionaries and user data.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the agricultural intelligent dialogue method based on multi-model fusion as described in any one of claims 1 to 7.

10. A processor, characterized in that: The processor is used to run a program, wherein when the program is run, the agricultural intelligent dialogue method based on multi-model fusion described in any one of claims 1 to 7 is executed.

Citation Information

Cited By

  • Meteorological intelligent service system based on language large model and construction method

    CN121052987A

  • Meteorological intelligent service system based on language large model and construction method

    CN121052987B