A dynamic switching type intelligent question and answer method and system for agricultural product quality control
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRI INFORMATION INST OF CHINESE ACAD OF AGRI SCI
- Filing Date
- 2025-11-14
- Publication Date
- 2026-08-07
AI Technical Summary
针对现有对话系统流程僵化、无法灵活处理模糊提问的问题,本发明旨在实现一种引导式的用户意图获取机制,能够主动探询并补全用户模糊查询中的关键信息
实现了引导式的用户意图获取,显著提升了对模糊、复杂问题的处理能力。 通过动态切换的探询模式和代理式引导探询模块,本发明能够主动、灵活地与用户交互,补全关键信息,克服了传统槽位填充系统的刚性和常规RAG系统的被动性,能有效应对农业品质管控这类复杂问答场景。
Smart Images

Figure CN121524294B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, particularly to natural language processing and knowledge graph technology, and more specifically, to a dynamically switching intelligent question-answering method and system for agricultural product quality control. Background Technology
[0002] With the widespread application of artificial intelligence technology, especially Large Language Models (LLMs), across various industries, intelligent question-answering systems have become crucial tools for providing professional services. In agriculture, intelligent question-answering systems are shifting from traditional question-and-answering aimed at "yield improvement" to more complex technical question-and-answering focused on optimizing agricultural product quality (such as flavor, nutrition, appearance, and storage and transportability). These tasks not only involve interdisciplinary knowledge from soil science, plant physiology, and cultivation, but also place higher demands on the model's causal reasoning, contextual understanding, and proactive interaction capabilities.
[0003] Questions raised by users in actual production, such as "My tomatoes taste bland" or "How can I increase the sugar content of apples?", are typically characterized by incomplete information, vague questions, and abstract objectives. These questions often lack key information such as crop variety, growth stage, geographical climate, and field management practices, making it difficult for question-and-answer systems to accurately interpret user intent and match relevant knowledge.
[0004] Currently, the mainstream intelligent agriculture question-answering solutions mainly fall into the following two categories: The first type is a slot-filling-based dialogue system. These systems (such as those built on platforms like Rasa and Dialogflow) guide users to provide the necessary information through multi-turn dialogues using pre-defined intents and slots. While this approach ensures information completeness, its dialogue path is rigid, lacks adaptability, struggles to handle situations with varying user expressions or ambiguous questions, and cannot incorporate complex domain knowledge for deep reasoning.
[0005] The second type is the Retrieval-Augmented Generation (RAG) question-answering system. This type of system utilizes retrieval technologies such as BM25 and Faiss to retrieve relevant documents from agricultural knowledge bases, and then uses a large language model to integrate the information and generate answers. RAG systems can provide high-quality knowledge support, but they heavily rely on users providing clear and complete queries. For vague questions, they lack proactive clarification and contextual tracking capabilities, and typically can only perform isolated, single-turn question-answering.
[0006] In the complex scenario of agricultural product quality control, users' true intentions often require clarification and information supplementation through multiple rounds of dialogue, and chain reasoning combined with domain knowledge to arrive at an effective solution. Current technologies are unable to achieve effective coordination and dynamic switching between "proactively exploring user needs" and "knowledge-driven response generation," making it difficult to provide accurate and actionable solutions when facing complex agricultural quality issues. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a dynamically switching intelligent question-and-answer method and system for agricultural product quality control. It aims to solve the following technical problems: To address the issues of rigid processes and inflexible handling of ambiguous questions in existing dialogue systems, this invention aims to implement a guided user intent acquisition mechanism that can proactively explore and supplement key information in users' fuzzy queries.
[0008] To address the problem that existing RAG systems lack contextual understanding and reasoning capabilities, making it difficult to handle complex agricultural scenarios, this invention aims to achieve deep reasoning based on dialogue history and domain knowledge, thereby generating targeted and executable solutions, rather than simply retrieving knowledge.
[0009] To achieve the above objectives, this invention provides a dynamically switching intelligent question-answering method for agricultural product quality control. The core of this method lies in constructing a question-answering framework that dynamically switches between "Inquiry Mode" and "Answering Mode." The first aspect of this invention discloses a dynamically switching intelligent question-answering method for agricultural product quality control; the method includes: Receive initial query input from the user; Initiate the inquiry mode, which is used to analyze the semantic completeness of the initial query. When the initial query lacks preset key information, generate clarifying questions through multiple rounds of dialogue to guide the user to complete the information, and record the dialogue history to update the dialogue status. When the dialogue state meets the preset integrity conditions, the system dynamically switches from the inquiry mode to the response mode. In the answering mode, a refined query is constructed based on the dialogue history and the final dialogue state. The refined query is used to retrieve relevant knowledge from a pre-built domain knowledge base, and the final answer is generated by combining the dialogue history and the relevant knowledge.
[0010] Preferably, the step of initiating the exploration mode and analyzing the semantic integrity of the initial query specifically includes: Based on a pre-constructed concept map of agricultural product quality control, entity identification and relationship analysis are performed on the initial query; The information contained in the initial query is compared with the necessary information nodes defined in the concept graph to determine the missing key information.
[0011] Preferably, the method further includes fine-tuning the large language model used to execute the interrogation and response patterns through the following steps: Based on a domain corpus, a synthetic corpus for dialogue reasoning is automatically generated using a teacher's large language model; each piece of data in the synthetic corpus includes fuzzy queries, guided dialogue rounds, final refined queries, and standard answers; The multi-turn dialogue history in the synthetic corpus is fused as the model input, and the standard answer is used as the model output. The large language model is then subjected to supervised fine-tuning to enable it to reason from fuzzy questions to solutions.
[0012] Preferably, the step of generating a synthetic corpus for dialogue reasoning includes: Seed fact generation: Extract structurally complete solutions as seed facts from the domain corpus; Refined query generation: Based on the seed fact, generate a clear and unambiguous question that can be answered by that fact; Dialogue-based deconstruction: Reverse generation of a multi-turn dialogue process that gradually clarifies the initial fuzzy query and ultimately leads to the refined query.
[0013] Preferably, the method further includes a step of pre-building the domain knowledge base, which includes: For the original documents collected in the field of agricultural product quality control, a content-aware hybrid segmentation strategy is adopted to segment the documents. The strategy combines structured segmentation based on document logical structure and semantic segmentation based on semantic similarity. The document blocks are processed using multimodal vectorization, embedding the text blocks and image information associated with the text into vectors, and indexing them together with the metadata of the blocks into the vector database.
[0014] Preferably, in the answering mode, the step of retrieving relevant knowledge from the pre-built domain knowledge base using the refined query specifically includes: Perform dialogue-enhanced retrieval by using the complete dialogue history and the refined query as retrieval input to improve the contextual relevance of the retrieval; The retrieved knowledge fragments are reordered, and the top k knowledge fragments that are most relevant to the query intent are selected.
[0015] Preferably, the final answer also includes an explanation of the reasoning process that generated the answer and source citations for the relevant knowledge.
[0016] A second aspect of this invention discloses a dynamically switching intelligent question-and-answer system for agricultural product quality control; the system employs the method described in any one of the first aspects, and the system includes: The proxy-guided inquiry module is used to execute the inquiry mode, receive the user's initial query, analyze its semantic completeness, and generate clarifying questions to conduct multi-round dialogue when the information is incomplete. The dialogue-enhanced retrieval and generation module is used to execute the response mode. It is activated after the inquiry mode is completed and is responsible for constructing a refined query, retrieving knowledge from the domain knowledge base, and generating the final answer. The agent-guided inquiry module and the dialogue-enhanced retrieval and generation module are driven by a finely tuned large language model and dynamically switch between the two modes under the scheduling of an agent core.
[0017] A third aspect of this invention discloses an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the dynamically switching intelligent question-and-answer method for agricultural product quality control as described in any of the first aspects of this disclosure.
[0018] A fourth aspect of this invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a dynamically switching intelligent question-answering method for agricultural product quality control, as described in any of the first aspects of this disclosure.
[0019] Compared with the prior art, the present invention has the following beneficial effects: This invention achieves guided user intent acquisition, significantly improving the ability to handle ambiguous and complex questions. Through dynamically switching inquiry modes and a proxy-based guided inquiry module, this invention can proactively and flexibly interact with users, supplementing key information, overcoming the rigidity of traditional slot filling systems and the passivity of conventional RAG systems, and effectively handling complex question-and-answer scenarios such as agricultural quality control.
[0020] This invention achieves deep reasoning based on domain knowledge, resulting in more professional and actionable answers. Through a dialogue-enhanced RAG and a large language model fine-tuned by reasoning, it deeply integrates the context of multi-turn dialogues with precisely retrieved domain knowledge. This enables the generation of solutions that include causal analysis, specific measures, and source citations, achieving a leap from "knowledge search" to "decision assistance," and better meeting the practical needs of users in professional fields.
[0021] This enhances the system's transparency and user trust. The final answer includes an explanation of the reasoning process and citations of knowledge sources, enabling users to understand the origin of the answer and trace its source, thus strengthening the system's credibility and usability. Attached Figure Description
[0022] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 A flowchart of a dynamically switching intelligent question-answering method for agricultural product quality control according to an embodiment of the present invention; Figure 2 This is an example diagram of the concept map for quality control of specialty agricultural products constructed in the embodiments of the present invention.
[0024] Figure 3 This is a schematic flowchart illustrating the specific implementation of a dynamic switching intelligent question-answering method for agricultural product quality control according to an embodiment of the present invention. Figure 4 This is a structural diagram of a dynamically switching intelligent question-and-answer system for agricultural product quality control according to an embodiment of the present invention. Figure 5 This is a structural diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] The first aspect of this invention discloses a dynamically switching intelligent question-and-answer method for agricultural product quality control.
[0027] Example 1: Figure 1 This is a flowchart of a dynamically switching intelligent question-answering method for agricultural product quality control according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes: Step 1: Receive the initial query input from the user. For example, the user inputs "My tomatoes don't taste good".
[0028] Step Two: Initiate Inquiry Mode. This mode is executed by an Agentic Guided-Inquiry Module (GIM). First, the system uses a pre-built concept graph for agricultural product quality control to analyze the semantic completeness of the initial query. This concept graph defines the key information nodes needed to solve specific agricultural product quality problems, such as [crop variety], [growth stage], [specific quality problem], [geographical location], and [growing environment]. By comparing the query information with the graph, the system can identify missing key information. For example, for "My tomatoes don't taste good," the system identifies missing information such as [specific quality problem] (is it bland, too acidic, or not sweet?), [crop variety], and [growth stage].
[0029] The system then enters a guided dialogue loop. GIM generates targeted, context-aware clarifying questions, such as, "What specifically do you find unpalatable about the tomato? Is it too bland or too sour?" The system maintains a Dialogue State Tracker (DST) to continuously record and integrate the user's multiple responses, gradually filling in any missing information slots.
[0030] Step 3: Dynamically switch to response mode. This loop continues until DST determines that the dialogue state meets the preset completeness conditions (i.e., the key information nodes required in the concept graph have been basically completed), or the preset dialogue round limit has been reached. At this point, the agent core dynamically switches the question-and-answer process from inquiry mode to response mode.
[0031] Step 4: Execute the response mode. This mode is executed by a Dialog-Aware RAG (DA-RAG) module. First, the system constructs a refined and complete query based on the final dialogue state (e.g., crop variety: Provence tomato, quality problem: bland taste, insufficient flavor, growing environment: Shandong greenhouse).
[0032] The DA-RAG retrieval engine then uses this refined query, along with the complete dialogue history, to retrieve information from a pre-built domain knowledge base. Because the retrieval takes into account the entire dialogue context, it can retrieve relevant knowledge more accurately than a single-turn query.
[0033] Finally, a large language model, fine-tuned through reasoning, receives the refined query, the complete dialogue history, and retrieved knowledge fragments, synthesizing this information to generate a final solution with accompanying explanations and source citations. For example: "Based on your description, Provençal tomatoes experience a loss of flavor in the later stages of greenhouse cultivation, typically related to insufficient light and potassium deficiency. It is recommended to apply high-potassium water-soluble fertilizer during the fruit ripening period and ensure at least 6 hours of adequate sunlight daily. Reference: Chapter 3 of 'Technical Guidelines for Quality Control of Greenhouse Tomatoes'." The present invention also provides a corresponding intelligent question-answering system, which includes a processor and a memory, the memory storing instructions for executing the above-described methods. Logically, the system can be divided into a Guided Inquiry Module (GIM) and a Dialogue-Enhanced Retrieval and Generation Module (DA-RAG), both scheduled by a unified agent core.
[0034] This invention is capable of: 1. Construction and indexing of domain knowledge base: The original agricultural documents are processed through a content-aware hybrid chunking strategy (combining structured chunking and semantic chunking) and multimodal vectorized indexing is performed to support efficient and accurate retrieval.
[0035] 2. Construction of a corpus for dialogue reasoning synthesis: Using the "teacher" large language model, a large amount of corpus is automatically constructed to train the model for guided dialogue and reasoning through the process of "seed fact generation → refined query generation → dialogue deconstruction".
[0036] 3. Supervised fine-tuning of the large language model: The basic large language model is fine-tuned using the above-mentioned synthetic corpus to internalize the complete reasoning chain from receiving ambiguous questions, clarifying them through dialogue, to finally providing solutions.
[0037] Example 2: To make the objectives, technical solutions, and advantages of this invention clearer, the following will use "enhancing the flavor of grassland mutton" as an example to elaborate on this invention in detail.
[0038] Please see Figure 2 and Figure 3 The present invention provides a dynamically switching intelligent question-answering method for agricultural product quality control, which specifically includes the following stages: Phase 1: Domain Knowledge Base Construction This phase aims to build a high-quality professional knowledge base focused on grassland sheep farming and mutton quality.
[0039] Step 101: Source selection and collection.
[0040] Collect agricultural technology extension manuals (such as "Ujumqin Sheep Breeding Technology Guide"), professional technical books (such as "Meat Sheep Production" and "Grassland Resource Management"), and academic journal articles (such as research on the influence of diet formulation on mutton flavor) related to grassland sheep breeding.
[0041] Step 102: Document cleaning and structuring.
[0042] All documents from various sources were converted to Markdown format using tools such as OCR. Scripts were used to automatically identify and extract tables (such as "Table of the impact of different supplementary feeds on the daily weight gain of lambs") and images (such as "Marbling patterns of different grades of mutton") from the documents, and generate structured metadata for them.
[0043] Step 103: Content-aware document chunking and indexing.
[0044] A hybrid segmentation strategy is adopted. First, the document is structurally segmented based on logical boundaries such as chapters and paragraphs. Then, for longer paragraphs, a semantic similarity model is used for secondary segmentation to ensure the thematic coherence of each segment. Each segment inherits the metadata of the source document (e.g., "Technical Focus": "Supplementary Feed").
[0045] Step 104: Indexing the multimodal vector database.
[0046] A domain-adaptive sentence converter model is used to convert text chunks into vectors. A visual language model (VLM) is used to generate dense captions for images and vectorize them together. Text vectors, image vectors, and their metadata are stored in a vector database (such as Milvus) that supports hybrid search. At this point, a RAG knowledge base is complete.
[0047] Phase Two: Building Reasoning Ability Step 201: Construct a conceptual map of agricultural product quality control.
[0048] Please see Figure 2 Using knowledge graph technology, a concept graph for mutton quality control was manually constructed. Core entities such as [sheep breed], [age], [feeding method], [geographic region], and [quality issues], as well as the relationships between them, were defined. Figure 2 The nodes within the red dashed box represent the information that the system needs to complete in the exploration mode.
[0049] Step 202: Generation of a dialogue reasoning synthesis corpus.
[0050] Training data is generated automatically using a powerful teacher LLM (such as GPT-4) and a first-stage knowledge base.
[0051] Seed fact generation: Extract solutions from the knowledge base, such as: "To improve the flavor of mutton in 6-8 month old Ujumqin lambs, 500 grams of concentrate containing flaxseed can be added to their daily diet on the basis of grazing." Refined query generation: Generate corresponding questions, such as: "How to improve the flavor of Ujumqin lamb through feeding and management?" Dialogue-based deconstruction: Reverse-generate a multi-turn dialogue that progresses from vague to clear.
[0052] Initial fuzzy search: "The lamb at our restaurant doesn't taste very good, what should we do?" Dialogue rounds: AI guides users to provide information such as breed, age, specific questions, feeding methods, and region.
[0053] This process generates a large number of training tuples in JSON format containing (fuzzy query, dialogue turn, final refined query, true answer, source paragraph).
[0054] Step 203: Fine-tuning of large language model inference.
[0055] Choose an open-source large language model with basic reasoning capabilities (such as Qwen or the DeepSeek series) as the base model. Merge the multi-turn dialogue history generated in step 202 into coherent text as input and the "true answer" as output, then perform supervised fine-tuning (SFT) on the model. Through this training, the model learns to perform logical reasoning and provide solutions after complex dialogues.
[0056] Phase 3: Operation of the Question-Answer System This is a dynamic process coordinated by a fine-tuned LLM agent.
[0057] Step 301: Query reception and routing.
[0058] The user enters the initial query: "The lamb at our restaurant doesn't taste very good, what should we do?". Upon receiving this, the system's agent core immediately activates the Guided Inquiry Module (GIM) and enters inquiry mode.
[0059] Step 302: Ambiguity detection and guided dialogue.
[0060] Based on the mutton quality concept map constructed in step 201, GIM detected missing key information such as [breed], [quality issues], and [feeding methods]. It then initiated a guided dialogue loop: AI: "Hello, what breed of sheep do you raise? Approximately how old are they?" User: "They are Ujumqin sheep, mainly lambs born that year." AI: "Understood. What specifically do you find unpleasant about the taste of the lamb? Is it the strong gamey smell, or a lack of flavor?" User: "The main problem is that it's not fragrant enough and the flavor is rather bland." …(The conversation continues until the key information is complete.) Step 303: Mode switching.
[0061] Once the Dialogue State Tracker (DST) confirms that all necessary information has been collected and generates a refined query: "How can the flavor of mutton from pure-grazing Ujumqin lambs be improved through feeding and management?", the agent core switches from inquiry mode to response mode.
[0062] Step 304: Dialogue-enhanced retrieval and reordering.
[0063] The DA-RAG retrieval system uses the complete dialogue history and final refined queries to retrieve data from the vector database constructed in step 104. The retrieval system prioritizes and sorts knowledge fragments related to "Ujumqin sheep," "flavor enhancement," "concentrate supplementation," and "flaxseed."
[0064] Step 305: Knowledge-based generation.
[0065] Step 203: The finely tuned LLM receives the refined query, the complete dialogue history, and the most relevant knowledge paragraphs retrieved.
[0066] Step 306: Response with supporting reasons.
[0067] The model integrates all information to generate a final answer, along with explanations and source citations, enhancing transparency and user trust.
[0068] Final output example: "Based on your description (Ujumqin sheep, purely pasture-raised, lacking flavor), the problem may lie in insufficient accumulation of flavor compounds due to unbalanced nutritional intake in the later stages. [Explanation of reasoning process] Research shows that to improve flavor, it is recommended that you conduct short-term supplementary feeding. The specific measure is: for 60 days before slaughter, supplement the lambs with 500 grams of concentrate containing 10% flaxseed daily, which can effectively improve the flavor of the meat. [Source citation] (Source: Key Technologies for High-Efficiency Meat Sheep Feeding)" This invention also provides an intelligent question-answering system that can run on hardware platforms such as servers, personal computers, or mobile devices. This platform includes, but is not limited to, processors, memory, network interfaces, and input / output devices. The memory stores program instructions for executing the above methods. The system's functional modules, including the Guided Inquiry Module (GIM) and the Dialogue-Enhanced Retrieval and Generation Module (DA-RAG), are all implemented by the processor calling instructions from the memory.
[0069] In summary, this invention solves the problem that existing question-and-answer systems struggle to handle ambiguous and complex questions in the agricultural field. By dynamically switching between "inquiry" and "answer" modes, it combines guided intent acquisition with knowledge-driven deep reasoning, significantly improving the accuracy, professionalism, and credibility of the question-and-answer process.
[0070] Example 3: The second aspect of this invention discloses a dynamically switching intelligent question-and-answer system for agricultural product quality control. Figure 4 This is a structural diagram of a dynamically switching intelligent question-and-answer system for agricultural product quality control according to an embodiment of the present invention; as shown below. Figure 4 As shown, the system 100 includes: The proxy-guided inquiry module 101 is used to execute the inquiry mode, receive the user's initial query, analyze its semantic completeness, and generate clarifying questions to conduct multi-round dialogue when the information is incomplete. The dialogue-enhanced retrieval enhancement generation module 102 is used to execute the answer mode. It is activated after the inquiry mode is completed and is responsible for constructing a refined query, retrieving knowledge from the domain knowledge base, and generating the final answer. The agent-guided inquiry module and the dialogue-enhanced retrieval and generation module are driven by a finely tuned large language model and dynamically switch between the two modes under the scheduling of an agent core.
[0071] A third aspect of this invention discloses an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the dynamically switching intelligent question-and-answer method for agricultural product quality control as described in any of the first aspects of this invention.
[0072] Figure 5 This is a structural diagram of an electronic device according to an embodiment of the present invention, such as... Figure 5 As shown, the electronic device includes a processor, memory, communication interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, Near Field Communication (NFC), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.
[0073] Those skilled in the art will understand that Figure 5 The structure shown is merely a structural diagram of the part related to the technical solution of this disclosure and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0074] A fourth aspect of this invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a dynamically switching intelligent question-answering method for agricultural product quality control, as described in any of the first aspects of this invention.
[0075] Please note that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. The above embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be pointed out that for those skilled in the art, several modifications and improvements can be made without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A dynamically switching intelligent question-answering method for agricultural product quality control, characterized in that, Includes the following steps: Receive initial query input from the user; Initiate the inquiry mode, which is used to analyze the semantic completeness of the initial query. When the initial query lacks preset key information, generate clarifying questions through multiple rounds of dialogue to guide the user to complete the information, and record the dialogue history to update the dialogue status. When the dialogue state meets the preset integrity conditions, the system dynamically switches from the inquiry mode to the response mode. In the answering mode, a refined query is constructed based on the dialogue history and the final dialogue state. The refined query is used to retrieve relevant knowledge from a pre-built domain knowledge base, and the final answer is generated by combining the dialogue history and the relevant knowledge. The step of initiating the probing mode and analyzing the semantic integrity of the initial query specifically includes: Based on a pre-constructed concept map of agricultural product quality control, entity identification and relationship analysis are performed on the initial query; The information contained in the initial query is compared with the necessary information nodes defined in the concept graph to determine the missing key information; The method also includes fine-tuning the large language model used to execute the inquiry and response patterns through the following steps: Based on a domain corpus, a synthetic corpus for dialogue reasoning is automatically generated using a teacher's large language model; each piece of data in the synthetic corpus includes fuzzy queries, guided dialogue rounds, final refined queries, and standard answers; The multi-turn dialogue history in the synthetic corpus is fused as the model input, and the standard answer is used as the model output. The large language model is then subjected to supervised fine-tuning to enable it to reason from fuzzy questions to solutions. The step of generating a synthetic corpus for dialogue reasoning includes: Seed fact generation: Extract structurally complete solutions as seed facts from the domain corpus; Refined query generation: Based on the seed fact, generate a clear and unambiguous question that can be answered by that fact; Conversational deconstruction: Reverse generation of a multi-turn dialogue process that gradually clarifies the initial fuzzy query and ultimately leads to the refined query; The method further includes a step of pre-building the domain knowledge base, which includes: For the original documents collected in the field of agricultural product quality control, a content-aware hybrid segmentation strategy is adopted to segment the documents. The strategy combines structured segmentation based on document logical structure and semantic segmentation based on semantic similarity. The document blocks are processed using multimodal vectorization, embedding the text blocks and image information associated with the text into vectors, and indexing them together with the metadata of the blocks into the vector database.
2. The method according to claim 1, characterized in that, In the answering mode, the step of retrieving relevant knowledge from the pre-built domain knowledge base using the refined query is as follows: Perform dialogue-enhanced retrieval by using the complete dialogue history and the refined query as retrieval input to improve the contextual relevance of the retrieval; The retrieved knowledge fragments are reordered, and the top k knowledge fragments that are most relevant to the query intent are selected.
3. The method according to claim 1, characterized in that, The final answer also includes an explanation of the reasoning process that generated the answer and references to the sources of the relevant knowledge.
4. A dynamically switching intelligent question-and-answer system for agricultural product quality control, wherein the system employs the method described in any one of claims 1-3, characterized in that... The system includes: The proxy-guided inquiry module is used to execute the inquiry mode, receive the user's initial query, analyze its semantic completeness, and generate clarifying questions to conduct multi-round dialogue when the information is incomplete. The dialogue-enhanced retrieval and generation module is used to execute the response mode. It is activated after the inquiry mode is completed and is responsible for constructing a refined query, retrieving knowledge from the domain knowledge base, and generating the final answer. The agent-guided inquiry module and the dialogue-enhanced retrieval and generation module are driven by a finely tuned large language model and dynamically switch between the two modes under the scheduling of an agent core.
5. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, it implements the steps of the dynamic switching intelligent question-and-answer method for agricultural product quality control as described in any one of claims 1 to 4.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the dynamically switching intelligent question-answering method for agricultural product quality control as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Knowledge question-answering method based on big data and related products
CN117828048A
Knowledge retrieval enhancement-based large language model question and answer method and device
CN118113836A