Agricultural planting scheme generation method and system, electronic equipment and storage medium

Through semantic slot enhancement and vector matching technology, combined with large language models with adaptive position coding and fine-tuning of sparse attention mechanisms, a highly adaptable and highly personalized agricultural planting solution is generated, solving the lack of flexibility in planting solution generation in the existing technology. and adaptability issues.

CN119415650APending Publication Date: 2025-02-11HENAN IFLYTEK ARTIFICIAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411429993.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The existing agricultural planting program generation methods lack flexibility and adaptability, it is difficult to deal with complex agricultural scenarios and conduct in-depth logical reasoning, and cannot meet the specific needs of specific farmers.

Method used

By receiving user's question information, semantic slot enhancement is performed to obtain target information, determine the target vector and match it with the vector knowledge base. If the match fails, an agricultural planting scheme is generated using the target large language model. The model is fine-tuned based on adaptive position coding strategies and sparse attention mechanism.

Benefits of technology

The generated agricultural planting scheme can adapt to rapidly changing environmental conditions and market demands, meet the specific needs of users, have a high degree of timeliness and personalization, and can handle complex agricultural scenarios for in-depth logical reasoning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415650A_ABST
    Figure CN119415650A_ABST
Patent Text Reader

Abstract

The invention provides an agricultural planting scheme generation method and system, electronic equipment and a storage medium, and relates to the technical field of agricultural intellectualization, in the method, a vector knowledge base is applied to perform vector matching, and a scene for performing agricultural planting scheme generation by applying a target large-scale language model can be given; the agricultural planting scheme obtained in the scene not only can adapt to rapidly changing environmental conditions and market requirements, but also can meet specific requirements of users, and is relatively high in timeliness and individuation degree. Moreover, the method does not depend on a preset rule, has relatively high flexibility and adaptability, and can be used for processing a complex agricultural scene and carrying out deep logical reasoning. The semantic slot enhancement is performed on the question information, so that richer and more accurate user demand information can be obtained, and an accurate and personalized agricultural planting scheme can be generated. Based on an adaptive position coding strategy and a fine tuning technology of a sparse attention mechanism, the capability and efficiency of processing a long text can be enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of agricultural intelligent technology, and in particular to a method, system, electronic device and storage medium for generating an agricultural planting plan. Background Art

[0002] In current smart agriculture scenarios, planting plans are usually customized by users and then sent to automatic planting units.

[0003] In the prior art, agricultural planting plan generation methods mainly include experience-based generation methods, agricultural extension recommendations, and technology-driven agricultural planting plan generation methods. Among them, the experience-based method can apply farmers' personal experience or adopt regional traditional practices. For example, many farmers decide the sowing time, crop selection, and irrigation amount based on their many years of planting experience; some regions determine the planting plan based on historical agricultural practices, such as crop rotation and mixed crop systems.

[0004] Agricultural extension advice can include government or private sector agricultural extension services, regular seminars and training, and online resource inquiries. Agricultural extension services can provide general advice based on regional climate and soil conditions, regular seminars and training can enable farmers to understand best agricultural practices and the latest agricultural technologies, and online resource inquiries can enable farmers to search for answers to relevant questions directly through search engines.

[0005] The technology-driven agricultural planting plan generation method uses historical sensor data, field data and other information, and utilizes the Internet of Things system to generate plans based on preset rules.

[0006] Although experience-based generation methods are close to reality, they often lack scientificity and systematicity, and are difficult to adapt to rapidly changing environmental conditions and market demands. Although agricultural expansion recommendations can provide a certain degree of guidance, these recommendations are often general and cannot meet the specific needs of specific farmers, and are less timely and personalized. In addition, although technology-driven agricultural planting plan generation methods utilize IoT systems and historical data, existing technologies mostly rely on preset rules, lack flexibility and adaptability, and are difficult to handle complex agricultural scenarios and conduct deep logical reasoning. Summary of the invention

[0007] The present invention provides an agricultural planting plan generation method, system, electronic equipment and storage medium to solve the defects existing in the related technology.

[0008] The present invention provides a method for generating an agricultural planting plan, comprising: Receive the user's question information, and if the question information belongs to the agricultural planting decision intention, perform semantic slot enhancement on the question information to obtain target information; Determine a target vector corresponding to the target information, and match the target vector with a vectorized representation in a vector knowledge base; If there is no vectorized representation matching the target vector in the vector knowledge base, generating an agricultural planting plan corresponding to the question information based on the target large language model; Among them, the vector knowledge base is constructed based on the vectorized representation of questions in agricultural planting question-answer pairs, or based on the agricultural planting question-answer pairs, the vectorized representation of questions in a multi-round dialogue dataset constructed using a first large language model, and the target large language model is fine-tuned based on an adaptive position encoding strategy and a sparse attention mechanism using the multi-round dialogue dataset.

[0009] According to an agricultural planting plan generation method provided by the present invention, the multi-round dialogue data set includes multiple dialogue records in each multi-round dialogue process; The target large language model is fine-tuned based on the following steps: Determine an embedding vector for each conversation record, and determine a position encoding for each conversation record based on the adaptive position encoding strategy; Based on the embedding vector and the position code, the sparse attention mechanism is applied to calculate the sparse attention weight, and based on the sparse attention weight, the embedding vector and the position code, the Lora fine-tuning algorithm is applied to fine-tune the second large language model to obtain the target large language model.

[0010] According to an agricultural planting plan generation method provided by the present invention, for any multi-round dialogue process, each dialogue record in any multi-round dialogue process includes instructions, inputs and outputs; The instruction is used to indicate the background of any multi-round dialogue process and the role of the first large language model; The input includes historical dialogue data and current question of any multi-round dialogue process; The output includes an answer to the current question.

[0011] According to a method for generating an agricultural planting plan provided by the present invention, the semantic slot enhancement of the question information to obtain target information includes: Performing named entity recognition on the question information, and filling preset key semantic slots based on the recognition results; If the key semantic slot is not filled, based on an interactive questioning mechanism, preset follow-up questioning words and / or ambiguous clarification words are applied to guide the user to answer, and based on the answer result, the key semantic slot is filled to obtain the target information.

[0012] According to a method for generating an agricultural planting plan provided by the present invention, the agricultural planting question-answer pair is obtained based on the following steps: Generate multiple question instances based on the question template; For any problem instance, based on multiple third large language models, the preset prompt information of each key link of agricultural planting is applied to generate a complete planting decision plan for each key link, and based on the fourth large language model, the comprehensive preset prompt information of agricultural planting is applied to summarize the complete planting decision plans for each key link to obtain a comprehensive planting decision plan; Based on the fifth large language model, the multiple question instances are expanded with similar questioning to obtain extended instances, and the agricultural planting question and answer pairs are determined based on the multiple question instances, the extended instances and the comprehensive planting decision plans corresponding to the multiple question instances.

[0013] According to a method for generating an agricultural planting plan provided by the present invention, the semantic slot enhancement of the question information is performed to obtain target information, which includes: Based on the question classification model, the question information is subjected to intent recognition to determine whether the question information belongs to agricultural planting decision-making intention.

[0014] According to a method for generating an agricultural planting plan provided by the present invention, the target vector is matched with a problem vector in a vector knowledge base, and then the method includes: If there is a vectorized representation matching the target vector in the vector knowledge base, an answer corresponding to the matching vectorized representation in the multi-round dialogue dataset is determined, and the answer is used as the agricultural planting plan.

[0015] The present invention also provides an agricultural planting plan generation system, comprising: A semantic slot enhancement module is used to receive user's question information, and if the question information belongs to agricultural planting decision-making intention, the semantic slot enhancement is performed on the question information to obtain target information; A vector matching module, used to determine a target vector corresponding to the target information, and match the target vector with a vectorized representation in a vector knowledge base; A planting plan generation module, configured to generate an agricultural planting plan corresponding to the question information based on a target large language model if there is no vectorized representation matching the target vector in the vector knowledge base; Among them, the vector knowledge base is constructed based on the vectorized representation of questions in agricultural planting question-answer pairs, or based on the agricultural planting question-answer pairs, the vectorized representation of questions in a multi-round dialogue dataset constructed using a first large language model, and the target large language model is fine-tuned based on an adaptive position encoding strategy and a sparse attention mechanism using the multi-round dialogue dataset.

[0016] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, an agricultural planting plan generating method as described in any one of the above is implemented.

[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the agricultural planting plan generating method as described in any one of the above.

[0018] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-described methods for generating an agricultural planting plan.

[0019] The agricultural planting plan generation method, system, electronic device and storage medium provided by the present invention use a vector knowledge base for vector matching in the method, and can provide a scenario for applying a target large language model to generate an agricultural planting plan. The agricultural planting plan obtained in this scenario can not only adapt to rapidly changing environmental conditions and market demands, but also meet the specific needs of users, with high timeliness and personalization. Moreover, the method does not rely on preset rules, has strong flexibility and adaptability, and uses the powerful generation ability and high efficiency and low cost advantages of the target large language model to handle complex agricultural scenes and perform deep logical reasoning. In addition, by enhancing the semantic slots of the question information, richer and more accurate user demand information can be obtained, which helps to generate accurate and personalized agricultural planting plans. The target large language model is obtained based on the fine-tuning technology of the adaptive position encoding strategy and the sparse attention mechanism, which can enhance the ability and efficiency of the target large language model to process long texts. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1It is a flow chart of the agricultural planting plan generation method provided by the present invention.

[0022] Figure 2 It is a schematic diagram of the LongText-LoRA fine-tuning algorithm in the agricultural planting plan generation method provided by the present invention.

[0023] Figure 3 It is a structural schematic diagram of the agricultural planting plan generation system provided by the present invention.

[0024] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings 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.

[0026] There are still many problems in the existing agricultural planting plan generation, such as narrow coverage, inaccuracy, low customization, poor multi-round interaction capabilities, and inability to answer complex logical questions in a personalized manner. The agricultural planting plan generation service is aimed at the shortage of expert resources encountered during on-site and online consultations with agricultural experts, and it is difficult to meet the consulting needs of a large number of farmers; and network resources are uneven and have poor timeliness. Based on this, an agricultural planting method generation method is provided in an embodiment of the present invention to solve the above technical problems.

[0027] Figure 1 FIG. 1 is a flow chart of a method for generating an agricultural planting plan provided in an embodiment of the present invention. Figure 1 As shown, the method includes: S1, receiving the user's question information, if the question information belongs to the agricultural planting decision intention, performing semantic slot enhancement on the question information to obtain target information; S2, determining a target vector corresponding to the target information, and matching the target vector with a vectorized representation in a vector knowledge base; S3, if there is no vectorized representation matching the target vector in the vector knowledge base, generating an agricultural planting plan corresponding to the question information based on the target large language model; Among them, the vector knowledge base is constructed based on the vectorized representation of questions in agricultural planting question-answer pairs, or based on the agricultural planting question-answer pairs, the vectorized representation of questions in a multi-round dialogue dataset constructed using a first large language model, and the target large language model is fine-tuned based on an adaptive position encoding strategy and a sparse attention mechanism using the multi-round dialogue dataset.

[0028] Specifically, the agricultural planting plan generation method provided in the embodiment of the present invention is executed by an agricultural planting plan generation system, which can be configured in a computer, which can be a local computer or a cloud computer. The local computer can be a computer, a tablet, etc., which is not specifically limited here.

[0029] First, step S1 is executed to receive the user's question information, and the question information can be identified to determine whether the user's question information belongs to the intention of agricultural planting decision-making. If it belongs to the intention of agricultural planting decision-making, the subsequent steps can be continued. If it does not belong to the intention of agricultural planting decision-making, the user's question information will not be answered.

[0030] When the user's question information belongs to the intention of agricultural planting decision-making, the question information can be further enhanced with semantic slots to obtain the target information. First, by performing demand analysis on the question information, the question type of the user's question information and the preset key semantic slots are determined. Each key semantic slot corresponds to a key information point of the user's needs. The preset key semantic slots can include crop name, planting location, planting scale, etc.

[0031] After that, the preset key semantic slots are filled according to the question information to obtain the target information. In particular, when the information in the key semantic slots is unclear, the interactive questioning mechanism can be activated to guide the user to provide specific information, thereby obtaining the target information. By enhancing the semantic slots of the question information, structured data support can be provided for the generation of agricultural planting plans to ensure that users can obtain accurate and personalized agricultural planting decision plans.

[0032] Then, step S2 is executed to vectorize the target information to obtain a target vector corresponding to the target information. Here, the target information can be vectorized by a vectorization model. The vectorization model can use RetroMAE as an initial vectorization model, use a large-scale public data set to pre-train the initial vectorization model to obtain a pre-trained model, and use an industry database in the field of agricultural planting to fine-tune and optimize the pre-trained model.

[0033] After that, the target vector can be matched with the vectorized representation in the vector knowledge base. The target vector and the vectorized representation in the vector knowledge base can have the same dimension. Through vectorization, texts with the same semantics but different expressions can be mapped to the same position, and texts with different semantics should maintain corresponding distances in the vector space, which makes it possible to achieve efficient text retrieval and similarity matching.

[0034] The vector knowledge base may include vectorized representations of questions in agricultural planting question-answer pairs, or vectorized representations of questions in a multi-round dialogue data set constructed by using agricultural planting question-answer pairs and applying the first large language model. Here, agricultural planting question-answer pairs may include various types of questions in the field of agricultural planting and their corresponding answers, and the multi-round dialogue data set may include multiple dialogue records in each multi-round dialogue process, and each dialogue record may include one or more questions and the answers corresponding to each question.

[0035] The vectorized representation of questions in agricultural planting question-answer pairs can be obtained by vectorizing the questions in agricultural planting question-answer pairs through a vectorization model, and the vectorized representation of questions in a multi-round dialogue dataset can be obtained by vectorizing the questions in a multi-round dialogue dataset through a vectorization model.

[0036] Here, the first large language model (LLM) can be a deep learning model such as iFlytek Spark Large Model and Wenxin Yiyan that is pre-trained through a large amount of text data, and is not specifically limited here.

[0037] By utilizing agricultural planting question-answer pairs and the extensive knowledge acquired through pre-training of the first large-scale language model, by designing appropriate prompts and guidance, and applying the first large-scale language model's advanced context understanding and language generation technology, we simulated the interaction with real users and created a series of multi-round dialogue scenarios, thereby constructing a multi-round dialogue dataset.

[0038] In this step, the correlation between the target vector and the vectorized representation in the vector knowledge base can be calculated. If there is a vectorized representation in the vector knowledge base whose correlation with the target vector is greater than a preset threshold, it is considered that there is a vectorized representation matching the target vector in the vector knowledge base. Otherwise, if the correlation between the vectorized representation in the vector knowledge base and the target vector is less than or equal to the vectorized representation of the preset threshold, it is considered that there is no vectorized representation matching the target vector in the vector knowledge base. The preset threshold can be determined according to actual needs and the characterization index of the correlation. The characterization index can be cosine similarity or other indicators, which are not specifically limited here.

[0039] Thereafter, step S3 is executed. If there is no vectorized representation matching the target vector in the vector knowledge base, it means that it is impossible to directly obtain an agricultural planting plan that can answer the user's question information from the agricultural planting question-answer pair or the multi-round dialogue dataset. At this time, the target large language model can be used to generate an agricultural planting plan corresponding to the question information.

[0040] The target large language model can be obtained by fine-tuning the pre-trained second large language model using a multi-round dialogue dataset using the Adaptive Positional Encoding strategy and the Sparse Attention Mechanism. The adaptive positional encoding strategy and the sparse attention mechanism can improve the second large language model's ability to understand and generate long texts, while reducing the computational cost, so that the target large language model can more accurately adapt to the specific needs and complexity of the agricultural planting field.

[0041] It can be understood that the adaptive position encoding strategy allows the second large language model to dynamically adjust its context window according to the actual length of the input data, thereby capturing the sequential information in the input data and flexibly adapting to texts of different lengths.

[0042] The sparse attention mechanism enables the second largest language model to focus only on the most important parts of the input data. This mechanism improves efficiency without sacrificing performance by reducing the scope of attention calculation while maintaining sensitivity to key information.

[0043] The Lora (Low-Rank Adaptation) fine-tuning algorithm can be used to fine-tune the second large language model. Therefore, Lora, which combines the adaptive position encoding strategy and the sparse attention mechanism, is a new fine-tuning method, which can be named LongText-LoRA. It can enable the target large language model to process long text data related to agricultural planting with lower cost and higher efficiency, which not only contains rich contextual information but also involves complex decision-making logic.

[0044] The agricultural planting plan generation method provided in the embodiment of the present invention first receives the user's question information, and when the question information belongs to the agricultural planting decision intention, the question information is semantically enhanced to obtain the target information; then the target vector corresponding to the target information is determined, and the target vector is matched with the vectorized representation in the vector knowledge base; thereafter, when there is no vectorized representation matching the target vector in the vector knowledge base, the target large language model is used to generate the agricultural planting plan corresponding to the question information. In this method, the vector knowledge base is applied for vector matching, and a scenario for applying the target large language model to generate an agricultural planting plan can be given. The agricultural planting plan obtained in this scenario can not only adapt to the rapidly changing environmental conditions and market demand, but also meet the specific needs of users, and has a high degree of timeliness and personalization. Moreover, the method does not rely on preset rules, has strong flexibility and adaptability, and uses the powerful generation ability of the target large language model and the advantages of high efficiency and low cost to handle complex agricultural scenes and perform deep logical reasoning. In addition, by enhancing the semantic slots of the question information, richer and more accurate user demand information can be obtained, which helps to generate accurate and personalized agricultural planting plans. The target large language model is obtained based on the fine-tuning technology of adaptive position encoding strategy and sparse attention mechanism, which can enhance the ability and efficiency of the target large language model in processing long texts.

[0045] Based on the above embodiment, the multi-round dialogue data set includes multiple dialogue records in each multi-round dialogue process; The target large language model is fine-tuned based on the following steps: Determine an embedding vector for each conversation record, and determine a position encoding for each conversation record based on the adaptive position encoding strategy; Based on the embedding vector and the position code, the sparse attention mechanism is applied to calculate the sparse attention weight, and based on the sparse attention weight, the embedding vector and the position code, the Lora fine-tuning algorithm is applied to fine-tune the second large language model to obtain the target large language model.

[0046] Specifically, the multi-round dialogue dataset includes multiple dialogue records in each multi-round dialogue process. On this basis, in the process of fine-tuning the second large language model to obtain the target large language model, the vectorization model can be used to determine the embedding vector (embedding) of each dialogue record, and the adaptive position encoding strategy can be used to determine the position encoding of each dialogue record. That is, ; ; Among them, pos is the sequential position index of each element in each conversation record, i is the dimension index of the position encoding of each conversation record, and the value of i starts from 0. d is the total number of dimensions of the position encoding of each conversation record, and p is a learnable parameter used to control the periodicity of the position encoding of each conversation record. Encode the position of the 2ith dimension at the sequential position pos of each conversation record, Encode the position of the 2i+1th dimension at the sequential position pos of each conversation record.

[0047] After that, the sparse attention mechanism is applied using the embedding vector and position encoding of each conversation record to calculate the sparse attention weights. Figure 2 As shown in the figure, it is the principle diagram of the LongText-LoRA fine-tuning algorithm. The embedding vector and position encoding of each conversation record can be concatenated to obtain the first concatenation result, and the first concatenation result is normalized to obtain the first normalized result. Then, the sparse attention mechanism is applied to calculate the sparse attention weight for the first normalized result. That is: ; in, are the query vector, key vector and value vector in the sparse attention mechanism, respectively. For sparse attention weights, sparse_mask is an array of the same length as the input data, where each element is a Boolean value, such as True, which is used to specify the positions to be considered when calculating the attention weights. is the softmax-normalized weight corresponding to the ordinal position j in the first normalized result, is the value vector corresponding to the ordinal position j in the first normalized result.

[0048] Thereafter, the Lora fine-tuning algorithm can be applied to fine-tune the second large language model using the sparse attention weights, the embedding vectors, and the positional encoding to obtain the target large language model. The coefficient attention weights can be concatenated with the first concatenation result of the embedding vector and the positional encoding to obtain a second concatenation result, and then the second concatenation result is normalized to obtain a second normalized result. The second normalized result is used in combination with the Lora fine-tuning algorithm to perform feed forward fine-tuning on the second large language model.

[0049] Based on the above embodiment, for any multi-round dialogue process, each dialogue record in any multi-round dialogue process includes instructions, inputs and outputs; The instruction is used to indicate the background of any multi-round dialogue process and the role of the first large language model; The input includes historical dialogue data and current question of any multi-round dialogue process; The output includes an answer to the current question.

[0050] Specifically, for each multi-round dialogue process, each dialogue record includes instructions, inputs, and outputs. The instructions can be used to indicate the background of the multi-round dialogue process and the role of the first large language model, that is, the system identity introduction. The input can include the historical dialogue data of the multi-round dialogue process and the current question to ensure the contextual continuity of the dialogue. The output can include the answer to the current question.

[0051] For example, taking a three-round dialogue as an example, the three-round dialogue data Q1, A1, Q2, A2, Q3, A3 are the questions and answers of the first round of dialogue, the questions and answers of the second round of dialogue, and the questions and answers of the third round of dialogue respectively.

[0052] After formatting, the three-round dialogue data is represented in the multi-round dialogue data set as multiple consecutive dialogue records as follows: {"instruction":"System Identity Introduction","input":"Q1","output":"A1"}; {"instruction":"System Identity Introduction","input":"Q1 A1 Q2","output":"A2"}

[0053] {"instruction":"System Identity Introduction","input":"Q1 A1 Q2 A2 Q3","output":"A3"}

[0054] Since the input includes not only the current question but also historical dialogue data, it not only preserves the coherence of the dialogue but also provides rich contextual information for the fine-tuning of the second large language model, enabling it to better learn and simulate real multi-round dialogue scenarios.

[0055] Based on the above embodiment, the step of performing semantic slot enhancement on the question information to obtain target information includes: Performing named entity recognition on the question information, and filling preset key semantic slots based on the recognition results; If the key semantic slot is not filled, based on an interactive questioning mechanism, preset follow-up questioning words and / or ambiguous clarification words are applied to guide the user to answer, and based on the answer result, the key semantic slot is filled to obtain the target information.

[0056] Specifically, in the process of obtaining target information by semantic slot enhancement of the question information, named entity recognition can be performed on the question information first, and the named entities can be identified to obtain recognition results, such as crop names, planting locations, planting scales, etc. Thereafter, the recognition results are used to fill preset key semantic slots. The key semantic slots can be determined by the question type of the question information, and can include multiple key semantic slots.

[0057] When the key semantic slots are not filled, that is, the question information provided by the user is not clear, it is necessary to use the interactive questioning mechanism, apply preset questioning words and / or ambiguity clarification words, and guide the user to answer. For example, when facing the question "How to grow tomatoes?", after automatically identifying the named entity of the crop name, you can use the preset questioning words to ask about the planting location and scale, such as "Where is your planting location?" When encountering possible ambiguity, you can use ambiguity clarification words, such as "Do you want to grow large tomatoes or cherry tomatoes (small tomatoes)?"

[0058] In the embodiment of the present invention, the semantic slot enhancement process is exemplified as follows: "Planting**":{

[0059] "Crop Name": ,

[0060] {"slot value": ,

[0061] "Follow-up question": "What kind of crops would you like to grow?"

[0062] "Ambiguity clarification techniques": "Do you want to plant XX or YY?"}

[0063] Planting location: {"slot value": ,

[0064] "Follow-up question": "Which province is your planting in?"

[0065] "Ambiguous clarification techniques": "Are you talking about xx province or yy province?"}

[0066] ……}.

[0067] In the embodiment of the present invention, semantic slot enhancement is adopted to provide structured data support for the dialogue understanding and decision generation of the target large language model, ensuring that users obtain accurate and personalized agricultural planting decision plans.

[0068] Based on the above embodiment, the agricultural planting question-answer pair is obtained based on the following steps: Generate multiple question instances based on the question template; For any problem instance, based on multiple third large language models, the preset prompt information of each key link of agricultural planting is applied to generate a complete planting decision plan for each key link, and based on the fourth large language model, the comprehensive preset prompt information of agricultural planting is applied to summarize the complete planting decision plans for each key link to obtain a comprehensive planting decision plan; Based on the fifth large language model, the multiple question instances are expanded with similar questioning to obtain extended instances, and the agricultural planting question and answer pairs are determined based on the multiple question instances, the extended instances and the comprehensive planting decision plans corresponding to the multiple question instances.

[0069] Specifically, in the process of constructing agricultural planting question-answer pairs, a pre-set question template can be used to generate multiple question instances. The question template can be "How to plant [crop name] in [location] [climatic conditions]?", and the question template can correspond to one or more key variables, such as crop name, location, climate conditions, etc.

[0070] Examples of questions generated using question templates may be "How to grow wheat under spring drought conditions in Shandong?" or "How to grow rice under the humid summer climate in the south of the Yangtze River?".

[0071] On this basis, for each problem instance, multiple specialized third-large language models and a fourth-large language model can be deployed to work together to generate a complete planting decision plan that includes key links such as soil preparation, variety selection, sowing, field management, irrigation management, fertilization plan, pest and disease management, and harvesting and storage. Among them, multiple third-large language models can include iFlytek Spark Large Model and / or Wenxin Yiyan, and the fourth-large language model can be either iFlytek Spark Large Model, Wenxin Yiyan, or other large language models.

[0072] Each third large language model is used to generate a complete planting decision plan for a key link, and the fourth large language model is used to summarize the complete planting decision plans of each key link to generate a comprehensive and coordinated integrated planting decision plan.

[0073] Each third-largest language model and fourth-largest language model uses carefully designed prompts to clarify its professional identity and tasks. For example, the preset prompt information of the third-largest language model corresponding to the key link of soil preparation can be designed as follows: “You are an agricultural planting expert specializing in soil science, providing detailed recommendations on soil improvement and preparation based on the needs of the crops being planted, geographical conditions, etc.

[0074] for example: Enter {How to grow garlic in Shandong?}

[0075] Output {First, test the soil pH and adjust it by applying lime or sulfur if necessary to reach the slightly acidic to neutral range for optimal garlic growth. Next, deep plow the soil to a depth of about 20 to 30 cm to improve soil aeration and drainage. In addition, adding an appropriate amount of organic matter, such as compost, can not only improve soil structure, but also provide rich nutrients and promote the activity of beneficial microorganisms. Finally, make sure there are no weeds and pests in the soil to avoid competing with garlic for nutrients and possible disease transmission, laying a good foundation for the healthy growth of garlic.}".

[0076] The fourth large-scale language model application's comprehensive preset prompt information for agricultural planting can be "You are an expert in comprehensive agricultural planting decision-making, responsible for in-depth analysis and integration of multi-field data, and provide a comprehensive and practical agricultural planting decision-making plan."

[0077] In addition, in order to further enrich the agricultural planting question-answer pairs and enhance their applicability, the fifth large language model can be used to expand each question instance with similar questions to obtain an extended instance, and the extended instance and the question instance are used to generate a many-to-one mapping with the comprehensive planting decision-making plan. At this point, the determination of the agricultural planting question-answer pairs is completed.

[0078] Based on the above embodiment, the semantic slot enhancement of the question information to obtain the target information includes: Based on the question classification model, the question information is subjected to intent recognition to determine whether the question information belongs to agricultural planting decision-making intention.

[0079] Specifically, in the embodiment of the present invention, the question information can be identified by the question classification model to determine whether the question information belongs to the agricultural planting decision intention. The question classification model can be obtained by optimizing the initial classification model through the Focal Loss algorithm. The initial classification model can be an ERINE model or other neural network models, which are not specifically limited here.

[0080] Through the problem classification model, problems inside and outside the agricultural planting field can be effectively distinguished, ensuring that system resources can be focused on providing professional agricultural decision support.

[0081] Based on the above embodiment, the step of matching the target vector with the question vector in the vector knowledge base further includes: If there is a vectorized representation matching the target vector in the vector knowledge base, an answer corresponding to the matching vectorized representation in the multi-round dialogue dataset is determined, and the answer is used as the agricultural planting plan.

[0082] Specifically, if there is a vectorized representation matching the target vector in the vector knowledge base, the answer corresponding to the matching vectorized representation in the multi-round dialogue dataset can be determined first, and the answer can be provided to the agricultural planting plan. This process uses the known answers in the multi-round dialogue dataset to simplify the generation process of the agricultural planting plan and improve the generation efficiency.

[0083] like Figure 3 As shown, based on the above embodiment, an agricultural planting plan generation system is also provided in the embodiment of the present invention, including: The semantic slot enhancement module 31 is used to receive the user's question information, and if the question information belongs to the agricultural planting decision intention, the semantic slot enhancement is performed on the question information to obtain the target information; A vector matching module 32, used to determine a target vector corresponding to the target information, and match the target vector with a vectorized representation in a vector knowledge base; A planting plan generating module 33, configured to generate an agricultural planting plan corresponding to the question information based on a target large language model if there is no vectorized representation matching the target vector in the vector knowledge base; Among them, the vector knowledge base is constructed based on the vectorized representation of questions in agricultural planting question-answer pairs, or based on the agricultural planting question-answer pairs, the vectorized representation of questions in a multi-round dialogue dataset constructed using a first large language model, and the target large language model is fine-tuned based on an adaptive position encoding strategy and a sparse attention mechanism using the multi-round dialogue dataset.

[0084] Based on the above embodiment, the multi-round dialogue data set includes multiple dialogue records in each multi-round dialogue process; The agricultural planting plan generation system also includes a model fine-tuning module for: Determine an embedding vector for each conversation record, and determine a position encoding for each conversation record based on the adaptive position encoding strategy; Based on the embedding vector and the position code, the sparse attention mechanism is applied to calculate the sparse attention weight, and based on the sparse attention weight, the embedding vector and the position code, the Lora fine-tuning algorithm is applied to fine-tune the second large language model to obtain the target large language model.

[0085] Based on the above embodiment, for any multi-round dialogue process, each dialogue record in any multi-round dialogue process includes instructions, inputs and outputs; The instruction is used to indicate the background of any multi-round dialogue process and the role of the first large language model; The input includes historical dialogue data and current question of any multi-round dialogue process; The output includes an answer to the current question.

[0086] Based on the above embodiment, the semantic slot enhancement module is specifically used for: Performing named entity recognition on the question information, and filling preset key semantic slots based on the recognition results; If the key semantic slot is not filled, based on an interactive questioning mechanism, preset follow-up questioning words and / or ambiguous clarification words are applied to guide the user to answer, and based on the answer result, the key semantic slot is filled to obtain the target information.

[0087] Based on the above embodiment, a question-answer pair determination module is further included, which is used to: Generate multiple question instances based on the question template; For any problem instance, based on multiple third large language models, the preset prompt information of each key link of agricultural planting is applied to generate a complete planting decision plan for each key link, and based on the fourth large language model, the comprehensive preset prompt information of agricultural planting is applied to summarize the complete planting decision plans for each key link to obtain a comprehensive planting decision plan; Based on the fifth large language model, the multiple question instances are expanded with similar questioning to obtain extended instances, and the agricultural planting question and answer pairs are determined based on the multiple question instances, the extended instances and the comprehensive planting decision plans corresponding to the multiple question instances.

[0088] Based on the above embodiment, the agricultural planting plan generation system further includes an intention recognition module for: Based on the question classification model, the question information is subjected to intent recognition to determine whether the question information belongs to agricultural planting decision-making intention.

[0089] Based on the above embodiment, the planting plan generation module is further used for: If there is a vectorized representation matching the target vector in the vector knowledge base, an answer corresponding to the matching vectorized representation in the multi-round dialogue dataset is determined, and the answer is used as the agricultural planting plan.

[0090] Specifically, the functions of each module in the agricultural planting plan generation system provided in the embodiment of the present invention correspond one-to-one to the operating procedures of each step in the above-mentioned method embodiment, and the effects achieved are also consistent. Please refer to the above-mentioned embodiment for details, and no further details will be given in the embodiment of the present invention.

[0091] Figure 4An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the agricultural planting plan generation method provided in the above embodiments.

[0092] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable 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, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0093] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the agricultural planting plan generation method provided in the above embodiments.

[0094] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the agricultural planting plan generation method provided in the above-mentioned embodiments.

[0095] The system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.

[0097] 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 make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating an agricultural planting plan, characterized in that: include: Receive the user's question information, and if the question information belongs to the agricultural planting decision intention, perform semantic slot enhancement on the question information to obtain target information; Determine a target vector corresponding to the target information, and match the target vector with a vectorized representation in a vector knowledge base; If there is no vectorized representation matching the target vector in the vector knowledge base, generating an agricultural planting plan corresponding to the question information based on the target large language model; Among them, the vector knowledge base is constructed based on the vectorized representation of questions in agricultural planting question-answer pairs, or based on the agricultural planting question-answer pairs, the vectorized representation of questions in a multi-round dialogue dataset constructed using a first large language model, and the target large language model is fine-tuned based on an adaptive position encoding strategy and a sparse attention mechanism using the multi-round dialogue dataset.

2. The method for generating an agricultural planting plan according to claim 1, characterized in that: The multi-round dialogue data set includes multiple dialogue records in each multi-round dialogue process; The target large language model is fine-tuned based on the following steps: Determine an embedding vector for each conversation record, and determine a position encoding for each conversation record based on the adaptive position encoding strategy; Based on the embedding vector and the position code, the sparse attention mechanism is applied to calculate the sparse attention weight, and based on the sparse attention weight, the embedding vector and the position code, the Lora fine-tuning algorithm is applied to fine-tune the second large language model to obtain the target large language model.

3. The method for generating an agricultural planting plan according to claim 2, characterized in that: For any multi-round dialogue process, each dialogue record in any multi-round dialogue process includes instructions, inputs and outputs; The instruction is used to indicate the background of any multi-round dialogue process and the role of the first large language model; The input includes historical dialogue data and current question of any multi-round dialogue process; The output includes an answer to the current question.

4. The method for generating an agricultural planting plan according to claim 1, characterized in that: The step of performing semantic slot enhancement on the question information to obtain target information includes: Performing named entity recognition on the question information, and filling preset key semantic slots based on the recognition results; If the key semantic slot is not filled, based on an interactive questioning mechanism, preset follow-up questioning words and / or ambiguous clarification words are applied to guide the user to answer, and based on the answer result, the key semantic slot is filled to obtain the target information.

5. The method for generating an agricultural planting plan according to claim 1, characterized in that: The agricultural planting question-answer pair is obtained based on the following steps: Generate multiple question instances based on the question template; For any problem instance, based on multiple third large language models, the preset prompt information of each key link of agricultural planting is applied to generate a complete planting decision plan for each key link, and based on the fourth large language model, the comprehensive preset prompt information of agricultural planting is applied to summarize the complete planting decision plans for each key link to obtain a comprehensive planting decision plan; Based on the fifth large language model, the multiple question instances are expanded with similar questioning to obtain extended instances, and the agricultural planting question and answer pairs are determined based on the multiple question instances, the extended instances and the comprehensive planting decision plans corresponding to the multiple question instances.

6. The method for generating an agricultural planting plan according to any one of claims 1 to 5, characterized in that: The semantic slot enhancement of the question information to obtain target information includes: Based on the question classification model, the question information is subjected to intent recognition to determine whether the question information belongs to the agricultural planting decision intention.

7. The method for generating an agricultural planting plan according to any one of claims 1 to 5, characterized in that: The step of matching the target vector with the question vector in the vector knowledge base further comprises: If there is a vectorized representation matching the target vector in the vector knowledge base, an answer corresponding to the matching vectorized representation in the multi-round dialogue dataset is determined, and the answer is used as the agricultural planting plan.

8. An agricultural planting plan generation system, characterized in that: include: A semantic slot enhancement module is used to receive user's question information, and if the question information belongs to agricultural planting decision-making intention, the semantic slot enhancement is performed on the question information to obtain target information; A vector matching module, used to determine a target vector corresponding to the target information, and match the target vector with a vectorized representation in a vector knowledge base; A planting plan generation module, configured to generate an agricultural planting plan corresponding to the question information based on a target large language model if there is no vectorized representation matching the target vector in the vector knowledge base; Among them, the vector knowledge base is constructed based on the vectorized representation of questions in agricultural planting question-answer pairs, or based on the agricultural planting question-answer pairs, the vectorized representation of questions in a multi-round dialogue dataset constructed using a first large language model, and the target large language model is fine-tuned based on an adaptive position encoding strategy and a sparse attention mechanism using the multi-round dialogue dataset.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the agricultural planting plan generation method as described in any one of claims 1-7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the agricultural planting plan generation method as described in any one of claims 1-7.

Citation Information

Cited By

  • Farmland planting management scheme automatic generation method and system based on large model

    CN122115147A