A rice pest and disease question answering method based on circular retrieval
By constructing a vectorized knowledge base for rice pests and diseases and multiple rounds of iterative query optimization, the problems of insufficient knowledge coverage and poor interactivity of existing systems are solved, efficient identification and accurate diagnosis of complex diseases and diseases are achieved, and user experience and system adaptability are improved.
Patent Information
- Application Number
- CN202510645863.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-20
AI Technical Summary
The existing rice pest and disease question and answer system has problems such as limited knowledge coverage, lagging dynamic updates, insufficient fluency in natural language interactions, and poor interaction of generation modules and search modules, making it difficult to effectively identify rare pests and diseases and deal with complex contexts.
Using a circular retrieval method, a rice pest vectorized knowledge base is constructed, and multiple iterative query optimization is performed using embedded models and large language models. Combined with cosine similarity matching and adequacy scoring, targeted clarification questions are generated to guide users to provide key information, and realize dynamic updates of information and interactive diagnosis.
It significantly improves the ability to identify complex and rare diseases and pests, enhances user interaction experience, reduces maintenance costs, and improves the adaptability and accuracy of the Q&A system, allowing quick access to the latest research results.
Smart Images

Figure CN120196727B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rice pest and disease question answering, and in particular to a rice pest and disease question answering method based on circular retrieval. Background Art
[0002] In the research of rice pest and disease question answering system, most of them are still based on traditional knowledge graph method. However, the question answering system based on knowledge graph has the following problems:
[0003] Limited knowledge coverage and insufficient identification of rare pests and diseases: Knowledge graphs rely on the coverage of structured data, and their accuracy and completeness are limited by the pre-built knowledge base. Knowledge graphs may be unable to effectively identify rare or newly emerging pests and diseases due to insufficient data samples. Dynamic updates are delayed and maintenance costs are high: Knowledge graph updates require manual intervention (such as expert review and data cleaning), making it difficult to integrate the latest pest and disease research results or field emergencies in real time. Natural language interaction fluency is insufficient, making it difficult to handle complex contexts: Knowledge graph-based systems often rely on keyword matching or limited semantic parsing, requiring users to ask questions in a specific format.
[0004] Others use traditional RAG (Retrieval-Augmented Generation) models to address the shortcomings of existing large language model-based question-answering systems in terms of information accuracy and knowledge depth. However, the following issues still exist:
[0005] When faced with vague or complex user query requests, traditional RAG models passively rely on single search results to generate answers, and are unable to actively guide users to explore their real needs, which can easily lead to incomplete retrieval or misunderstanding of user intentions; traditional RAG models are based on static retrieval and have difficulty coping with complex or multi-round scenarios, which may lead to information fragmentation or context breaks; the generation module and the retrieval module have poor interactivity and lack linkage. Summary of the Invention
[0006] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a rice disease and insect pest question-answering method based on circular retrieval, which greatly improves the accuracy and comprehensiveness of the answers.
[0007] The present invention adopts the following technical solutions to achieve the above-mentioned purpose. The present invention provides a rice disease and insect pest question-answering method based on circular retrieval, comprising:
[0008] Step 1: Collect rice-related text data;
[0009] Step 2: Preprocess the collected rice data for data cleaning and data structuring;
[0010] Step 3: Block and segment the pre-processed rice text data;
[0011] Step 4: Encode the text data processed in step 3 into vector representations using the embedding model, and store the vectors in a vector database to construct a vectorized knowledge base of rice pests and diseases;
[0012] Step 5: After receiving the user's question about rice pests and diseases, the query preprocessing and enhancement function Trewrite are first applied to transform it to generate an optimized query;
[0013] Step 6: Use the embedding model to convert the optimized query into a query vector. Then, perform cosine similarity matching on the vectorized knowledge base of rice pests and diseases to find the context related to the user's question.
[0014] Step 7: Calculate the context sufficiency score. This score is composed of two parts: keyword coverage and content support. Keyword coverage is used to assess whether the retrieved content covers the corresponding concepts in the question. Content support uses the ROUGE-L indicator to assess whether the retrieved context can provide direct content basis for answering the user's question.
[0015] Step 8: Compare the sufficiency score with a pre-set threshold, and make a judgment based on the current number of interaction iterations and the set maximum number of iterations. If the sufficiency score is greater than or equal to the set threshold, the currently retrieved context information is determined to be sufficient, and the process proceeds to step 11. If the sufficiency score is less than the set threshold, and the current number of interaction iterations is less than the set maximum number of iterations, the currently retrieved context information is determined to be insufficient, and the process proceeds to step 9. If the sufficiency score is less than the set threshold, and the current number of interaction iterations is greater than or equal to the set maximum number of iterations, the currently retrieved context information with the highest score is presented to the user, and the user is prompted that the information in the current knowledge base is incomplete or insufficient to form a completely definitive recommendation, and the user is reminded to carefully refer to the provided information.
[0016] Step 9: Use the large language model as a generative model and combine it with prompt words to generate targeted clarification questions. The prompt words include the current query, the retrieved context set, and the calculated adequacy score.
[0017] Step 10: Present the clarification question to the user and receive the user's answer. Then, fuse the user's answer information with the current query to generate the next round of optimized query, and return to step 6.
[0018] Step 11: Integrate the final confirmed query and the context set that is finally retrieved and confirmed to be used to form a complete generated prompt, which is input into another large language model to generate the final answer to the user's rice disease and insect pest question.
[0019] Furthermore, step 1 specifically includes: collecting and organizing unstructured rice pest and disease related text data from various channels, including publicly published scientific research papers on rice pathology, entomology, and pesticide science, technical reports and pest and disease forecasts issued by national or local plant protection stations, and prevention and control guidelines and variety resistance information issued by professional agricultural research institutions.
[0020] Furthermore, step 3 specifically includes: implementing block processing on the rice disease and pest text data, using the title as the natural dividing point for the chapters on a certain disease or pest in scientific research papers and technical reports, and constructing a white list of professional terms in the field of rice diseases and pests. This white list is referred to during block segmentation to ensure that text fragments containing these terms are not incorrectly segmented.
[0021] Furthermore, the calculation methods for sufficiency score, keyword coverage, and content support are as follows:
[0022] ;
[0023] ;
[0024] ;
[0025] Where, Indicates keyword coverage, Indicates content support. represents the final context adequacy score, express and The length of the longest common subsequence, express length, Represents the retrieved context, Indicates the optimized query keyword set, A keyword set representing the retrieved context, and is the weight parameter.
[0026] Furthermore, the optimized query is generated as follows:
[0027] ,in Represents the optimized query, Q represents the original question input by the user, and Trewrite represents the enhancement function.
[0028] The beneficial effects of the present invention are:
[0029] The present invention improves the accuracy and coverage of the question-answering system: the traditional knowledge graph question-answering system is limited by the predefined scope of structured data and it is difficult to cover all pests and diseases, especially rare or emerging types. The traditional RAG model directly generates answers after a single search, and the depth of information acquisition is insufficient. This solution cleverly combines the powerful reasoning ability of the large language model with the multi-round dynamic retrieval mechanism: when the initial retrieval information is insufficient, the system can actively analyze the missing links and guide the user to supplement key information through generative questions. This iterative information collection and reasoning process significantly improves the diagnostic accuracy of complex and ambiguous diseases, and effectively expands the system's ability to identify and cover rare or atypical rice pests and diseases.
[0030] This invention enhances the user interaction experience and supports the analysis of complex and multi-hop questions: Traditional systems are often helpless in the face of ambiguous user descriptions or complex queries involving multiple logical relationships. The core advantage of this solution lies in its interactive clarification and iterative optimization mechanism. The system can dynamically generate highly targeted rhetorical questions based on the current search results, proactively guiding users to clarify their true intentions and provide key details. Through this "judgment-question generation-cyclic retrieval" cycle, the contextual information required to solve the problem is gradually constructed and improved, greatly enhancing the system's depth of understanding of complex contexts and its ability to effectively respond to multi-hop reasoning problems, making the user experience closer to a natural conversation with a domain expert.
[0031] The present invention improves the adaptability of question and answer and reduces maintenance costs: the construction and maintenance of knowledge graphs rely on a large amount of expert annotation and structured data processing, which is not only costly, but also the updating of knowledge often lags behind the latest research progress and actual field conditions. This solution is based on RAG and naturally has the ability to integrate unstructured text data. This means that the system can more conveniently and quickly access and utilize the latest external data sources such as scientific research literature, plant protection reports, and network information to continuously learn and absorb new knowledge. This not only greatly reduces manual maintenance costs and delays in knowledge updates, but also gives the system excellent adaptability, and can flexibly respond to the rapid development and changes in knowledge in the field of rice diseases and pests. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 This is a flow chart of a rice pest and disease question-answering method based on circular retrieval provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0033] To make the objectives, technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0034] The present invention provides a rice pest question-answering method based on circular retrieval, such as Figure 1 As shown, specifically including:
[0035] Step 1: Collect and organize unstructured rice text data from scientific research papers, technical reports, and professional agricultural research institutions;
[0036] Specifically, we systematically collect and organize unstructured text data on rice pests and diseases from a variety of authoritative sources. These sources primarily include publicly published scientific papers on rice pathology, entomology, and pesticides; technical reports and pest and disease forecasts issued by national and local plant protection stations; and control guidelines and variety resistance information published by professional agricultural research institutions (such as the China National Rice Research Institute). The goal is to build a basic dataset that provides comprehensive and in-depth coverage of major rice diseases (such as rice blast, sheath blight, bacterial leaf blight, and false smut) and pests (such as rice planthoppers, rice stem borers, and rice leaf rollers).
[0037] Step 2: Preprocess the collected rice data for data cleaning and data structuring;
[0038] Specifically, the collected raw rice pest and disease data undergoes comprehensive data cleaning and structural preprocessing. This step aims to eliminate noise in the data, such as formatting errors, irrelevant information, and repeated descriptions. Unstructured text data, such as symptom descriptions, morphological characteristics, occurrence patterns, and pesticide recommendations, is converted into a format more easily processed by machines. This lays a solid foundation for subsequent text analysis and vectorization, ensuring the professionalism and accuracy of the input data.
[0039] Step 3: Block the rice text data, segment the scientific research papers and technical reports using titles, and construct a whitelist of professional terms to preserve the complete chapter logic chain and professional terms;
[0040] The pre-processed rice pest and disease text data is segmented. The specific strategy is to segment sections of scientific papers and technical reports on a specific disease or pest using the title as a natural dividing point. Furthermore, to prevent the integrity of key professional terms such as pest and disease names, pesticide active ingredients, growth periods, and symptom descriptions from being compromised during the segmentation process, a whitelist of specialized terms in the rice pest and disease field is constructed. This whitelist is referenced during segmentation to ensure that text segments containing these terms are not incorrectly segmented, thereby maintaining the logical chain of knowledge and the integrity of professional terminology.
[0041] Step 4: Using the text-embedding-ada-002 embedding model, the text data blocks processed in the previous step are encoded into high-dimensional vector representations. These vectors capture the deep semantic information of the text. These generated text vectors are then stored in a vector database, building a rapidly searchable vectorized knowledge base of rice pests and diseases.
[0042] Step 5: After receiving the user's question about rice pests and diseases, query preprocessing and enhancement function Trewrite are first applied to transform it to generate an optimized query, normalize the colloquial description, supplement key information (such as the rice growing period), or expand the synonyms of the pest and disease names (such as "rice blast" associated with "rice fever").
[0043] The optimized query is generated as follows:
[0044] ;
[0045] in represents the optimized query, and Q represents the original question input by the user;
[0046] Trewrite represents a function that performs transformations. Its core goal is to intelligently optimize and normalize the user's original, potentially ambiguous or colloquial query, generating a clearer, more structured, and more informative version of the query, aiming to improve the efficiency and accuracy of subsequent steps. Specific operations cover several aspects: converting non-standard colloquial descriptions into professional agricultural terminology and correcting spelling errors; utilizing built-in synonym libraries or domain knowledge to expand keywords, ensuring that different expressions such as "rice blast" and "rice fever" match the same content; attempting to identify and supplement key contextual information missing from the query, such as inferring or supplementing the current rice growth period based on conversation history; and identifying and linking entities such as pests and diseases, pesticides, etc. mentioned in the query to standard identifiers in the knowledge base. Through this series of transformations, the optimized query can more accurately reflect user intent and use language that is closer to the knowledge base documents, significantly improving the recall and accuracy of subsequent vector retrieval.
[0047] Step 6: Use the specified embedding model to process the optimized query Transformed into its high-dimensional representation in vector space, namely the query vector Then, an efficient similarity search is performed in the pre-built rice pest vector knowledge base. and the text fragment vectors stored in the knowledge base The system retrieves the top-k context text fragments that are semantically closest to the user's question and forms a preliminary candidate result set based on the cosine similarity between them. These retrieved snippets are expected to contain core information directly related to the user's query, such as specific pest and disease descriptions, key diagnostic points, or effective control methods.
[0048] Among them, the calculation formula of cosine similarity is:
[0049]
[0050] Where, Represents the query vector and the i-th stored text fragment vector in the knowledge base The cosine similarity between .
[0051] Step 7: To further improve the accuracy of the retrieval context, after obtaining the candidate set B through the preliminary vector retrieval, the re-ranking model is introduced and applied to perform a secondary precise sorting to obtain the retrieved context set. This step aims to make up for the lack of ranking accuracy in the initial retrieval and solve the problem that the most relevant documents may not be at the top of the list. The core task of re-ranking is to conduct an in-depth relevance assessment of candidate documents through more complex calculations and models, and accurately place the documents that best match the user's query intent at the top of the ranking list, thereby significantly improving the accuracy of the head results. In this solution, this precise ranking process is implemented using the Cross-Encoder model: the model can simultaneously receive rewritten optimized queries With each candidate document As input, the deep semantic interaction between the two is carefully analyzed and a score is generated based on it. Finally, the candidate documents are re-ranked from high to low according to this score. After the re-ranking process, the top of the output context list is concentrated with the highest quality and most directly relevant information, and the retrieved context set is obtained. This provides a more solid foundation for subsequent context adequacy evaluation and final answer generation, effectively guarantees the accuracy of question and answer, and may effectively reduce unnecessary interactive clarification rounds.
[0052] Step 8: After retrieving the preliminary context set Finally, the core task of this step is to quantitatively assess whether this batch of information is sufficient—that is, whether it can effectively and accurately answer the user's original question. To this end, the present invention has designed a comprehensive sufficiency score, which is composed of two key dimensions:
[0053] Keyword coverage: This metric measures the extent to which the retrieved content covers the core concepts mentioned in the user's question. It ensures the relevance of the search results to the user's focus and prevents the omission of important information. It is calculated by comparing the overlap between the rewritten question keyword set and the context keyword set. The formula is:
[0054] ;
[0055] in, A set of keywords representing the question, A keyword set representing the retrieved context, Indicates the keyword coverage of the first two.
[0056] Content Support: This metric goes beyond simple relevance to provide a deeper assessment of whether the retrieved context provides direct and substantive content support for answering the user's question. This paper uses a longest common subsequence-based approach to quantify this support. Higher values generally indicate a stronger direct connection between the retrieved context and the user's question, and are therefore more likely to contain the specific information or key details necessary to generate an accurate and reliable answer.
[0057] The calculation formula is:
[0058] ;
[0059] in express and The length of the longest common subsequence, express length, Indicates content support.
[0060] The two dimensions are weighted and combined to obtain the final context adequacy score, which combines information relevance and answer generability:
[0061] ;
[0062] in, Score the adequacy between the user question and the retrieved context, and is the weight parameter.
[0063] Weight parameter and This reflects the importance of coverage and support. Experiments show that setting α = 0.6 and β = 0.4 can better balance these two aspects and achieve the best overall evaluation results. The score will serve as the key basis for the next decision, determining whether to generate the answer directly or require further interactive clarification.
[0064] Step 9: Calculate the final context adequacy score in the previous step After that, this step compares the score with the pre-set threshold τ to determine the subsequent action path. At the same time, the current number of interaction iterations n and the set maximum number of iterations are combined. Make a judgment.
[0065] Sufficient context: If , the system determines that the currently retrieved context is sufficient to directly generate a high-quality answer. The process will jump to step 12.
[0066] Insufficient context and iteration can continue: If and , indicating that the current context information is insufficient, but there is still room for improvement through interactive clarification. The process then proceeds to step 10.
[0067] The iteration limit is reached and the context is still insufficient: If and , meaning that after the maximum number of interactive clarification rounds, the retrieved context still fails to meet the pre-set sufficiency criteria. In this specific case, the system will no longer attempt to generate a comprehensive answer. Instead, it will perform the following special processing: a summary of the currently retrieved, highest-scoring context set will be presented to the user. At the same time, the system will clearly inform the user that, despite diligent retrieval and clarification efforts, the information in the current knowledge base may still be incomplete or insufficient to form a definitive diagnosis or recommendation, prompting the user to consider the information provided with caution.
[0068] Step 10: If step 9 determines that the currently retrieved context is insufficient to support a high-quality answer and the interaction round is allowed to continue, the system will initiate a clarification question mechanism. This step utilizes Deepseek-7B and a designed prompting system. The prompt will include the current query, the retrieved context set, and the calculated sufficiency score. Based on these inputs, the large language model will generate a highly targeted clarification question This question will focus on guiding users to provide specific details that are crucial for diagnosing or controlling rice pests and diseases, such as: "What is the specific shape, color, and size of the spots you observed on the rice leaves? Is there a yellow halo around the spots?" or "What is the field humidity in the affected area? Has it been cloudy and rainy recently?"
[0069] Step 11: The system presents the clarification questions generated in step 10 to the user , and receive the user's answer For example, "the disease spots are small round brown spots with a yellow halo around them" or "the humidity in the field is very high and it has been raining for the past week". After receiving the feedback, the system applies a specific integration function T to integrate the new and specific pest and disease related information provided by the user. With the current query Effective fusion is performed to generate a next round of optimized queries with richer information and stronger directionality:
[0070]
[0071] in, is the optimized query generated in this round, T is the integration function that performs information fusion, It is the newly added relevant information provided by the user in this round. Is the previous round of queries currently being processed.
[0072] Then, the interaction iteration counter n is increased by 1, carrying the new query optimized by user feedback , the entire process will return to step 6 and restart the vectorization, similarity retrieval, re-ranking and subsequent context evaluation.
[0073] Step 12: When the judgment conditions of step 9 are met, the process enters the final answer generation stage. The system will integrate the final confirmed query And the context collection that is finally retrieved and confirmed for use , building a complete generated prompt. This prompt will be input into another large language model, which will use the provided query and context information to comprehensively reason and generate the final answer to the user's rice pest and disease question. It is particularly important to note that if the process enters this step because the maximum number of iterations has been reached, but the context adequacy score at this time is still below the threshold, the system should clearly inform the user in the generated answer that the current information based on the knowledge base may not be sufficient to provide a completely conclusive answer, and may recommend that the user seek help from professional agricultural technicians or provide other auxiliary information. At the same time, the system should record such unresolved issues for subsequent knowledge base updates and model optimization.
[0074] The foregoing description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein and should not be construed as excluding other embodiments. Rather, the present invention can be used in various other combinations, modifications, and environments and can be modified within the scope of the concept described herein through the above teachings or techniques or knowledge in the relevant field. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention are intended to be protected by the appended claims.
Claims
1. A rice pest and disease question answering method based on circular retrieval, characterized in that: include: Step 1: Collect rice-related text data; Step 2: Preprocess the collected rice data for data cleaning and data structuring; Step 3: Block and segment the pre-processed rice text data; Step 4: Encode the text data processed in step 3 into vector representations using the embedding model, and store the vectors in a vector database to construct a vectorized knowledge base of rice pests and diseases; Step 5: After receiving the user's question about rice pests and diseases, query preprocessing and enhancement functions are applied to transform it to generate an optimized query; Step 6: Use the embedding model to convert the optimized query into a query vector. Then, perform cosine similarity matching on the vectorized knowledge base of rice pests and diseases to find the context related to the user's question. Step 7: Calculate the context sufficiency score. This score is composed of two parts: keyword coverage and content support. Keyword coverage is used to assess whether the retrieved content covers the corresponding concepts in the question. Content support uses the ROUGE-L indicator to assess whether the retrieved context can provide direct content basis for answering the user's question. Step 8: Compare the sufficiency score with a pre-set threshold, and make a judgment based on the current number of interaction iterations and the set maximum number of iterations. If the sufficiency score is greater than or equal to the set threshold, the currently retrieved context information is determined to be sufficient, and the process proceeds to step 11. If the sufficiency score is less than the set threshold, and the current number of interaction iterations is less than the set maximum number of iterations, the currently retrieved context information is determined to be insufficient, and the process proceeds to step 9. If the sufficiency score is less than the set threshold, and the current number of interaction iterations is greater than or equal to the set maximum number of iterations, the currently retrieved context information with the highest score is presented to the user, and the user is prompted that the information in the current knowledge base is incomplete or insufficient to form a completely definitive recommendation, and the user is reminded to carefully refer to the provided information. Step 9: Use the large language model as a generative model and combine it with prompt words to generate targeted clarification questions. The prompt words include the current query, the retrieved context set, and the calculated adequacy score. Step 10: Present the clarification question to the user and receive the user's answer. Then, fuse the user's answer information with the current query to generate the next round of optimized query, and return to step 6. Step 11: Integrate the final confirmed query and the context set that is finally retrieved and confirmed to be used to form a complete generated prompt, which is input into another large language model to generate the final answer to the user's rice disease and insect pest question.
2. The rice pest and disease question-answering method based on circular retrieval according to claim 1, characterized in that: Step 1 specifically includes: Collect and organize unstructured rice pest and disease related text data from various channels, including publicly published scientific research papers on rice pathology, entomology and pesticides, technical reports and pest and disease forecasts issued by national or local plant protection stations, and prevention and control guidelines and variety resistance information issued by professional agricultural research institutions.
3. The rice pest and disease question-answering method based on circular retrieval according to claim 2, characterized in that: Step 3 specifically includes: The text data on rice diseases and pests is segmented. For the chapters on a certain disease or pest in scientific research papers and technical reports, the titles are used as natural dividing points for segmentation. At the same time, a whitelist of professional terms in the field of rice diseases and pests is constructed. This whitelist is referred to during segmentation to ensure that text fragments containing these terms are not segmented incorrectly.
4. The rice pest and disease question-answering method based on circular retrieval according to claim 1, characterized in that: The calculation methods for sufficiency score, keyword coverage, and content support are as follows: ; ; ; Where, Indicates keyword coverage, Indicates content support. represents the final context adequacy score, express and The length of the longest common subsequence, Indicates optimized query, express length, Represents the retrieved context, Indicates the optimized query keyword set, A keyword set representing the retrieved context, and is the weight parameter.
5. The rice pest and disease question-answering method based on circular retrieval according to claim 1, characterized in that: The optimized query is generated as follows: ,in Represents the optimized query, Q represents the original question input by the user, and Trewrite represents the enhancement function.
Citation Information
Patent Citations
Method and system for evaluating quality of RAG knowledge base driven by large language model
CN119226753A
Welcoming robot conversation method
WO2023273170A1