Intelligent query method and device based on large model and storage medium
By decomposing and analyzing the logical relationships of questions using a large language model, complete and coherent answers are generated, solving the problem of incomplete answers in existing technologies and improving the reliability and user experience of intelligent question-answering systems.
Patent Information
- Application Number
- CN202511431890.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-10-09
AI Technical Summary
Existing intelligent question answering technologies lack the ability to analyze the internal structure of questions in a fine-grained manner, resulting in the inability to generate complete and accurate answers, especially when dealing with complex and multi-intent questions, which are prone to omissions or misunderstandings.
By decomposing the question text based on a large language model, identifying multiple sub-questions, analyzing the logical relationships between the sub-questions, generating answers for each sub-question, and then merging them, the completeness and logical coherence of the answers are ensured.
It improves the completeness and accuracy of answers to complex questions in intelligent question-answering systems, avoids information fragmentation and logical confusion, and enhances user experience.
Smart Images

Figure CN120892545A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent question answering, and particularly relates to an intelligent query method based on a large model, a device and a storage medium. BACKGROUND
[0002] Existing intelligent question answering technology generally adopts a whole matching or keyword retrieval manner, processes a question as a whole, and attempts to directly obtain an answer through a single query, lacking a fine-grained analysis capability for the internal structure of a question. Therefore, when a user proposes a complex, multi-intent natural language question, the system can only return part of the relevant information, and even miss or misinterpret, resulting in an incomplete or logically confused final answer, that is, it is difficult to directly generate an accurate and complete answer. This defect seriously restricts the application effect of the intelligent question answering system in actual scenarios, especially in the fields of finance, medicine, enterprise data analysis and the like which have high requirements for the completeness and logic of answers.
[0003] The above content is only used to assist in understanding the technical solutions of the present application and does not represent the acknowledgement of the above content as prior art. SUMMARY
[0004] The main purpose of the present application is to provide an intelligent query method based on a large model, a device and a storage medium, aiming at solving the technical problem that the existing technology cannot generate a complete and accurate answer due to the lack of fine-grained analysis capability for the internal structure of a question.
[0005] To achieve the above purpose, the present application provides an intelligent query method based on a large model, which comprises: based on the current question text and the current question context text related to the current question text, performing question decomposition on the current question text through a large language model to obtain a plurality of corresponding sub-questions; analyzing the logical relationship between the sub-questions through the large language model to determine the mutual dependency relationship between the sub-questions; determining sub-question related data corresponding to each of the sub-questions, and based on the sub-question related data, the sub-questions and the current question context text, generating a sub-question answer corresponding to each of the sub-questions through the large language model; According to the mutual dependency relationship between the sub-questions, the sub-question answers corresponding to each of the sub-questions are merged to obtain a target answer corresponding to the current question text.
[0006] In an embodiment, the step of based on the current question text and the current question context text related to the current question text, performing question decomposition on the current question text through a large language model to obtain a plurality of corresponding sub-questions comprises: determine target source data entries corresponding to the current question text according to the current question text and the current question context text; based on the target source data entries, the current question text and the current question context text, construct question decomposition prompt words, and input the question decomposition prompt words into the large language model to perform question decomposition on the current question text to obtain original output text containing multiple sub-questions; perform JavaScript Object Notation (JSON) format verification and parsing on the original output text, and if successful, obtain multiple sub-questions in JSON format; If failed, return to perform the step of inputting the question decomposition prompt words into the large language model to perform question decomposition on the current question text, if the number of retries does not exceed a first preset threshold; In the case where the number of retries exceeds the first preset threshold and the number of rewrites does not exceed a second preset threshold, return to perform the step of constructing question decomposition prompt words based on the target source data entries, the current question text and the current question context text.
[0007] In an embodiment, the step of determining target source data entries corresponding to the current question text according to the current question text and the current question context text comprises: perform natural language preprocessing on the current question text and the current question context text to obtain a corresponding first keyword set; perform feature embedding on the current question text and the current question context text to obtain a corresponding first query representation vector; based on the first query representation vector, perform approximate nearest neighbor search in the vector database of the source database to obtain a first preset number of source data entries with the highest similarity to the first query representation vector, each of the source data entries carrying a vector similarity score; based on the first keyword set, perform full-text matching retrieval in the inverted index of the source database to obtain a first preset number of source data entries with the highest matching degree to the first keyword set, each of the source data entries carrying a keyword matching degree score; based on the keyword matching degree score of each source data entry and the vector similarity score of each source data entry, perform weighted summation to obtain a comprehensive score of each source data entry, and determine a second preset number of source data entries with the highest comprehensive score as the target source data entries, the second preset number being less than the first preset number.
[0008] In an embodiment, the step of constructing the question decomposition prompt word based on the target source data entry, the current question text and the current question context text comprises: determining a model identifier corresponding to the large language model, and searching for a question decomposition prompt word template corresponding to the large language model from a preset template library based on the model identifier; filling the question decomposition prompt word template based on the target source data entry, the current question text and the current question context text to generate an initial question decomposition prompt word; calling the large language model to optimize the initial question decomposition prompt word to generate the question decomposition prompt word.
[0009] In an embodiment, the step of performing JSON format verification and parsing on the original output text comprises: extracting a JSON object string or a JSON array string from the original output text using a regular expression; calling a JSON parsing function to perform syntax parsing on the extracted JSON object string or JSON array string to obtain a corresponding syntax parsing result; if no exception is thrown in the string extraction process and the parsing process, determining that the JSON format verification and parsing are successful, and determining the syntax parsing result as the JSON format sub-questions.
[0010] In an embodiment, the step of determining the mutual dependency relationship between the sub-questions by analyzing the logical relationship between the sub-questions by the large language model comprises: determining a model identifier corresponding to the large language model, and searching for a relationship judgment prompt word template corresponding to the large language model from a preset template library based on the model identifier; for any adjacent sub-question pair, constructing a relationship judgment prompt word corresponding to the adjacent sub-question pair based on the adjacent sub-question pair, the current question text and the current question context text and the relationship judgment prompt word template; inputting the relationship judgment prompt words corresponding to all the adjacent sub-question pairs into the large language model, respectively, determining the logical relationship between the adjacent sub-questions by the large language model, and determining the logical relationship between all the adjacent sub-questions as the mutual dependency relationship between the sub-questions.
[0011] In an embodiment, the step of determining the sub-question related data corresponding to each sub-question comprises: performing natural language preprocessing on the sub-questions to obtain a second keyword set corresponding to the sub-questions; characteristic embedding is performed on the sub-questions to obtain second query representation vectors corresponding to the sub-questions; Based on the second query representation vectors, an approximate nearest neighbor search is performed in a vector database of a question and answer database to obtain a first preset number of question and answer data entries with the highest similarity to the second query representation vectors, each of the question and answer data entries carrying a vector similarity score; Based on the second keyword set, full-text matching retrieval is performed in an inverted index of a question and answer database to obtain a first preset number of question and answer data entries with the highest matching degree to the second keyword set, each of the question and answer data entries carrying a keyword matching degree score; Based on the keyword matching degree score of each question and answer data entry and the vector similarity score of each question and answer data entry, a weighted sum is performed to obtain a comprehensive score of each question and answer data entry, and a second preset number of question and answer data entries with the highest comprehensive score are determined as the sub-question related data, the second preset number being less than the first preset number.
[0012] In an embodiment, the step of generating a sub-question answer corresponding to each sub-question by the large language model based on the sub-question related data, the sub-questions and the current question context text comprises: For each sub-question, a sub-question source data entry corresponding to the sub-question is determined according to the sub-question; Based on the sub-question source data entry, the sub-question related data, the sub-questions and the current question context text, a question analysis prompt word corresponding to the sub-question is constructed; The question analysis prompt word corresponding to the sub-question is input into the large language model to analyze and answer each sub-question, and an initial output text containing a sub-question answer is obtained; If successful, a JSON format of each sub-question answer is obtained by performing JSON format verification and analysis on the initial output text; If unsuccessful, the step of inputting the question analysis prompt word corresponding to the sub-question into the large language model to analyze and answer each sub-question is returned to be executed under the condition that the number of retries does not exceed a first preset threshold.
[0013] In an embodiment, the step of merging each sub-question answer according to the mutual dependency relationship between the sub-questions to obtain a target answer corresponding to the current question text comprises: Based on the mutual dependency relationship between the sub-questions, an integration order between each sub-question answer is determined; combining each of the sub-problem answer groups according to the integration sequence to generate a complete answer text; performing format verification on the complete answer text to verify whether the complete answer text conforms to a predefined format specification; if the format verification passes, determining the complete answer text as the target answer corresponding to the current question text.
[0014] In addition, to achieve the above object, the present application also proposes an intelligent query device based on a large model, which comprises: a question decomposition module configured to perform question decomposition on a current question text based on the current question text and a current question context text related to the current question text by a large language model to obtain a plurality of corresponding sub-questions; a relationship determination module configured to analyze logical relationships between the sub-questions by the large language model to determine mutual dependency relationships between the sub-questions; a single question analysis module configured to determine sub-question related data corresponding to each of the sub-questions, and generate a sub-question answer corresponding to each of the sub-questions based on the sub-question related data, the sub-questions and the current question context text by the large language model; an answer merging module configured to merge the sub-question answers corresponding to each of the sub-questions according to the mutual dependency relationships between the sub-questions to obtain a target answer corresponding to the current question text.
[0015] In addition, to achieve the above object, the present application also proposes an intelligent query device based on a large model, which comprises: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the intelligent query method based on a large model as described above.
[0016] In addition, to achieve the above object, the present application also proposes a storage medium, which is a computer readable storage medium, and a computer program is stored on the storage medium, the computer program being executed by a processor to implement the steps of the intelligent query method based on a large model as described above.
[0017] In addition, to achieve the above object, the present application also provides a computer program product, which comprises a computer program, the computer program being executed by a processor to implement the steps of the intelligent query method based on a large model as described above.
[0018] The one or more technical solutions provided in the present application have at least the following technical effects: based on the current question text and the current question context text related to the current question text, the current question text is decomposed into a plurality of sub-questions by a large language model, a complex large problem is converted into a series of more specific and easier to handle sub-questions, thereby improving the efficiency and accuracy of solving problems. The large language model analyzes the logical relationship between the sub-questions and the mutual dependency relationship between the sub-questions, which helps to make up for the defects of traditional methods that ignore the logical association of sub-questions, avoid answer fragmentation, and clarify the logical order between sub-questions. For each sub-question, determine the sub-question related data corresponding to the sub-question, and based on the sub-question related data, the sub-question and the current question context text, generate a sub-question answer corresponding to each sub-question by the large language model, and according to the mutual dependency relationship between the sub-questions, merge the sub-question answers corresponding to each sub-question, ensure that the answer covers the whole picture of the problem and maintains logical coherence, and generate a complete and coherent target answer corresponding to the current question text, thereby solving the technical problem in the prior art that a complete and accurate answer cannot be generated due to the lack of fine-grained analysis capability of the internal structure of the question, and improving the completeness and accuracy of the answer. Based on the intelligent query method based on the large model provided in the present application, for the current question text and its context text input by the user, the large language model is used for question decomposition, the composite question (current question text) is decomposed into a plurality of semantically independent sub-questions, the internal structure of the question is explicitly modeled, and the defect of traditional methods that only make overall matching and miss sub-intentions is overcome. Secondly, the large language model further analyzes the semantic association between each sub-question, identifies the logical relationship, and clarifies the execution order and combination mode between sub-questions, providing a reasoning path for subsequent answer organization. Then, based on the determination of the related data corresponding to each sub-question, precise sub-question answers are generated in combination with the context information, ensuring that each local query is based on reliable data support, improving the accuracy and verifiability of the answer. Finally, according to the mutual dependency relationship between the sub-questions, the multiple sub-question answers are sequentially merged to generate a coherent and complete target answer, avoiding information fragmentation and conclusion loss, not only realizing deep semantic understanding and structured decomposition of complex questions, but also ensuring the completeness and interpretability of the output results through the logic-driven answer integration mechanism, significantly improving the reliability and user experience of intelligent query in actual application scenarios. BRIEF DESCRIPTION OF DRAWINGS
[0019] The accompanying drawings, which are incorporated in and form a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application.
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, for those of ordinary skill in the art, the other drawings can be obtained based on these drawings without any creative effort.
[0021] Figure 1 A flowchart of the process provided by the first embodiment of the large model-based intelligent query method of the present application is shown in the figure. Figure 2 A functional diagram of the data module provided by the present application is shown in the figure. Figure 3 A flowchart of another large model-based intelligent query method provided by the present application is shown in the figure. Figure 4 An example diagram of a target source data item provided by the present application is shown in the figure. Figure 5 A workflow diagram of the prompt word generation module provided by the present application is shown in the figure. Figure 6 A flowchart of another large model-based intelligent query method provided by the present application is shown in the figure. Figure 7 An example diagram of sub-problem related data provided by the present application is shown in the figure. Figure 8 A flowchart of another large model-based intelligent query method provided by the present application is shown in the figure. Figure 9 A module structure diagram of the large model-based intelligent query device of the present application is shown in the figure. Figure 10 A device structure diagram of the hardware running environment involved in the large model-based intelligent query method in the embodiments of the present application is shown in the figure.
[0022] The object implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0023] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and not used to limit the present application.
[0024] In order to better understand the technical solutions of the present application, the following will be described in detail in conjunction with the accompanying drawings and specific embodiments.
[0025] The main solution of the embodiment of the present application is: based on the current problem text and the current problem context text related to the current problem text, the current problem text is decomposed into a plurality of sub-questions by a large language model; the logical relationship between the sub-questions is analyzed by the large language model to determine the mutual dependency relationship between the sub-questions; the sub-question related data corresponding to each sub-question is determined, and based on the sub-question related data, the sub-questions and the current problem context text, the sub-question answers corresponding to each sub-question are respectively generated by the large language model; according to the mutual dependency relationship between the sub-questions, the sub-question answers corresponding to each sub-question are merged to obtain the target answer corresponding to the current problem text.
[0026] In the present embodiment, for the sake of description, the following describes an intelligent query system based on a large model as an execution subject.
[0027] Since the prior art adopts the whole matching or keyword retrieval mode, the problem is treated as a whole, and the answer is directly obtained by a single query, which lacks the fine-grained analysis ability of the internal structure of the problem. Therefore, when the user proposes a complex and multi-intention natural language question, the system often can only return part of the relevant information, and even miss or misinterpret, resulting in an incomplete or logically chaotic final answer, that is, it is difficult to directly generate an accurate and complete answer.
[0028] The present application provides a solution, which uses a large language model to decompose the current problem text and its context text input by the user into a plurality of semantically independent sub-questions, realizes explicit modeling of the internal structure of the problem, and overcomes the defect of the traditional method of only whole matching and missing sub-intentions. Secondly, the large language model further analyzes the semantic association between each sub-question, identifies the logical relationship, and determines the execution order and combination mode between the sub-questions, providing a reasoning path for subsequent answer organization. Then, based on the determination of the related data corresponding to each sub-question, precise sub-question answers are generated in combination with the context information, ensuring that each local query is based on reliable data support, improving the accuracy and verifiability of the answers. Finally, according to the mutual dependency relationship between the sub-questions, the multiple sub-question answers are sequentially merged to generate a coherent and complete target answer, avoiding information fragmentation and conclusion missing, not only realizing deep semantic understanding and structured decomposition of complex problems, but also ensuring the completeness and explainability of the output results through the logic-driven answer integration mechanism, significantly improving the reliability and user experience of intelligent query in practical application scenarios.
[0029] It should be noted that the execution subject of the embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a large model-based intelligent query device capable of realizing the above functions. The following will take a large model-based intelligent query system as an example to describe the embodiment and the following embodiments.
[0030] Based on this, the embodiment of the present application provides a large model-based intelligent query method, referring to Figure 1 , Figure 1 The flowchart of the first embodiment of the large model-based intelligent query method of the present application is shown in the figure.
[0031] In the embodiment, the large model-based intelligent query method includes steps 101-104: Step 101, based on the current question text and the current question context text related to the current question text, the current question text is decomposed by a large language model to obtain a plurality of sub-questions corresponding to the current question text.
[0032] Specifically, the current question text is the original natural language question input by the user in the current dialogue, the current question context text related to the current question text is the historical question input by the user in the current dialogue and the answer to the historical question, and the large language model is an artificial intelligence (AI) model with semantic understanding and generation capability, such as Generative Pre-trained Transformer 4 (GPT-4), Claude, Google Gemini, Qwen, etc., which can be used to perform question decomposition tasks. The plurality of sub-questions are the output results after decomposition, which are a list of sub-queries in structured or natural language form.
[0033] In some embodiments, the current question text received by the user input is combined with the current question context text related thereto to form a structured input by merging the current question text with the context text to enhance the integrity of semantic understanding. Subsequently, by calling a large language model, the large language model is input with a question decomposition prompt word containing the current question text and the context text, and the question decomposition prompt word explicitly instructs the large language model to disassemble the complex question (current question text) into multiple semantically independent and individually executable sub-questions. Based on its powerful semantic understanding ability, the large language model performs intent recognition and logical analysis on the input current question text and outputs a structured result containing multiple sub-questions, usually in JSON format, which can be used as the basis for subsequent data retrieval and answer generation. By combining the current question text with the relevant context text and using the large language model for question decomposition, the multiple semantic intents implied in the complex query can be accurately identified, and the originally difficult to directly process composite question can be converted into several executable sub-questions, ambiguity can be eliminated with the help of context information, the accuracy of question understanding can be improved, the reasoning ability of the large language model can be utilized, the understanding ability of the system for complex multi-intent questions can be improved, fine-grained intent disassembly can be achieved, thereby helping to avoid the omission of intent caused by overall matching in traditional methods, ensuring that all query requirements are completely covered, and improving the completeness and accuracy of subsequent retrieval and answering.
[0034] Step 102, analyze the logical relationship between the sub-questions by the large language model to determine the mutual dependency relationship between the sub-questions.
[0035] Specifically, the logical relationship refers to the semantic connection mode between the sub-questions, which can include parallel relationship (and), selection relationship (or), comparison relationship, cause and effect relationship, etc. The mutual dependency relationship indicates the execution order or combination logic of the sub-questions, which is a structural blueprint for merging the sub-question answers corresponding to the subsequent sub-questions.
[0036] In some embodiments, based on the plurality of sub-questions, the current question text and the current question context text as inputs, a structured relationship determination prompt word is constructed and input to the large language model, the relationship determination prompt word explicitly requires the large language model to determine the semantic association type between each sub-question, including and, or, comparison, causal, etc., and output a standardized logical relationship description. Based on its deep semantic understanding ability, the large language model performs semantic comparison and intent analysis between each pair of sub-questions, identifies the interdependence between the sub-questions such as and, or, etc., as the basis for subsequent answer merging execution. Through this step, the system has structured reasoning ability for complex queries, clearly defines the solution order and combination method of sub-questions, provides a logical basis for the subsequent ordered integration of answers, ensures that the final output answer has coherence, completeness and explainability, and helps to avoid logical confusion in the answer generation process, improving the accuracy and reliability of the system in handling multi-intent question and answer query scenarios.
[0037] Step 103, determining sub-question related data corresponding to each sub-question, and based on the sub-question related data, the sub-questions and the current question context text, generating sub-question answers corresponding to each sub-question through the large language model.
[0038] Specifically, the data module serves as the information hub of the entire large model-based intelligent query system, and undertakes the core functions of data storage, management and service. Referring to Figure 2 , Figure 2A functional diagram of the data module is shown. The data module includes two main components: a source database and a question and answer database. The source database stores multiple source data for maintaining source data entries relied on by the system, such as business indicators, field definitions, entity attributes, etc.; the question and answer database stores multiple question and answer data, each of which includes an answer corresponding to a question domain. The question and answer database supports quick matching of common questions. Changes to source data and question and answer data need to be first written into a MySQL relational database to ensure transaction consistency and persistent storage. Subsequently, through a change data capture mechanism, the newly added, modified or deleted data is automatically synchronized to the vector database and the inverted index, realizing real-time updating of semantic retrieval and keyword retrieval capabilities, and ensuring consistency and real-time performance of data between multiple storage engines. When a user initiates a query, the system can perform question understanding, intent matching and answer generation based on the latest data. With continuous updating of the data module, the system not only responds to the latest business status, but also continuously improves the accuracy of semantic understanding and the coverage of retrieval, thereby realizing more intelligent and efficient user response. By using a MYSQL database to store structured information, combined with a vector knowledge base to support advanced retrieval (such as vector query, keyword matching), efficient data management and fast information retrieval can be achieved. Through the dual-layer data management mode of the vector database and the inverted index, not only the consistency and integrity of the data are guaranteed, but also the query efficiency is improved, especially the application of the vector knowledge base, so that the system can handle more complex semantic search requirements. In the decomposition of problems, single problem analysis, the large model can better understand the problem and produce better answers. The sub-problem related data corresponding to the sub-problem is the retrieval query result of the sub-problem in the question and answer database.
[0039] In some embodiments, for each decomposed sub-problem, firstly, a mixed retrieval is performed in the question and answer database, including semantic matching based on the vector database and keyword matching based on the Best Match 25 (BM25), to obtain the question and answer data entries most relevant to the sub-problem as sub-problem related data. Subsequently, the sub-problem, the sub-problem related data obtained by retrieval, and the current problem context text are jointly constructed into a problem analysis prompt word corresponding to the sub-problem, and the problem analysis prompt word corresponding to the sub-problem is input into the large language model, which explicitly requires the large language model to generate an accurate and concise natural language answer. Based on the understanding of the sub-problem intention, the large language model fuses the retrieved sub-problem related data to generate a semantically coherent and sufficiently based partial answer, i.e., a sub-problem answer. By retrieving each sub-problem corresponding query result as sub-problem related data in the question and answer database, and combining the data, the sub-problem itself, and the current context text, and using the large language model to generate a sub-problem answer, it can be ensured that the answer generation process has a basis, effectively utilizes the question and answer database, avoids the generation of sub-problem answers corresponding to sub-problems, improves the accuracy and consistency of the answer, and at the same time, with the help of the context, keeps the semantics coherent, makes the partial answer more in line with the user's real intention, realizes the knowledge-driven precise answer, provides reliable and traceable intermediate results for subsequent answer integration, and significantly enhances the intelligence and credibility of the system.
[0040] Step 104, according to the interdependence between sub-problems, merging the sub-problem answers corresponding to each sub-problem to obtain the target answer corresponding to the current problem text.
[0041] Optionally, the step of merging the sub-problem answers corresponding to each sub-problem to obtain the target answer corresponding to the current problem text according to the interdependence between sub-problems, includes: determining the integration order between the sub-problem answers based on the interdependence between the sub-problems; combining the sub-problem answers to generate a complete answer text according to the integration order; performing format verification on the complete answer text to verify whether the complete answer text conforms to the predefined format specification; if the format verification is passed, determining the complete answer text as the target answer corresponding to the current problem text; if the format verification is not passed, returning to perform the step of combining the sub-problem answers to generate a complete answer text according to the integration order until the maximum number of verification times is reached.
[0042] Specifically, the interdependence between the sub-problems is the logical relationship (such as comparison, parallelism, causality) determined in the previous step, which is used to determine how to combine the sub-problem answers.
[0043] As an example, the system receives a plurality of sub-question answers generated in the preceding stage and the determined interdependence between sub-questions. Based on the interdependence between sub-questions, the integration order of each sub-question answer is analyzed and determined, for example: for comparison type relationship, the data of each party (sub-question answer) can be listed first and then the conclusion can be drawn; for parallel type relationship, it can be organized by number or by item. Then, according to the integration order, each sub-question answer is combined to generate a complete answer text with semantic coherence and clear logic. After generation, the system starts the format verification process, and the complete answer text is verified by the rule engine in multiple dimensions, including whether it contains necessary data sources, whether it uses standard punctuation, whether there are sensitive words, whether it exceeds the maximum length limit, etc., to ensure that the output meets the predefined format specification. If the verification passes, the system confirms the complete answer text as the target answer corresponding to the current question text and returns it to the user; if the verification fails, the step of combining each sub-question answer to generate a complete answer text according to the integration order is returned until the format requirement is met or the maximum number of retries is reached. Through the above process, the transformation from fragmented partial answers to structured overall responses is realized, ensuring the logic, completeness and compliance of the final output, thereby improving the practicality and credibility of the intelligent question and answer system, so that users can obtain satisfactory answers even when faced with very complex questions.
[0044] Based on the intelligent query method based on the large model provided in the present application, based on the current question text and the current question context text related to the current question text, the current question text is decomposed into multiple sub-questions through a large language model, and the complex large problem is converted into a series of more specific and easier to handle sub-questions, thereby improving the efficiency and accuracy of solving problems. Through the analysis of the logical relationship between the sub-questions by the large language model, the interdependence between the sub-questions is analyzed, which helps to make up for the defects of traditional methods that ignore the logical association of sub-questions, avoid answer fragmentation, and clarify the logical order between sub-questions. For each sub-question, determine the sub-question related data corresponding to the sub-question, and based on the sub-question related data, the sub-question and the current question context text, generate the sub-question answer corresponding to each sub-question through the large language model, and according to the interdependence between the sub-questions, merge the sub-question answers corresponding to each sub-question, ensure that the answer covers the whole picture of the question and maintains logical coherence, and generate a complete and coherent target answer corresponding to the current question text, thereby solving the technical problem that the existing technology cannot generate a complete and accurate answer due to the lack of fine-grained analysis capability of the internal structure of the question, and improving the completeness and accuracy of the answer. Based on the intelligent query method based on the large model provided in the present application, for the current question text and its context text input by the user, the large language model is used for question decomposition, and the composite question (current question text) is decomposed into multiple semantically independent sub-questions, realizing explicit modeling of the internal structure of the question and overcoming the defect of traditional methods that only make overall matching and miss sub-intentions. Secondly, the semantic association between the sub-questions is further analyzed by the large language model, the logical relationship is recognized, and the execution order and combination mode between the sub-questions are clarified, providing a reasoning path for subsequent answer organization. Then, based on the determination of the related data corresponding to each sub-question, precise sub-question answers are generated in combination with the context information, ensuring that each local query is based on reliable data support, improving the accuracy and verifiability of the answer. Finally, according to the interdependence between the sub-questions, the multiple sub-question answers are sequentially merged to generate a coherent and complete target answer, avoiding information fragmentation and conclusion loss, not only realizing deep semantic understanding and structured decomposition of complex questions, but also ensuring the completeness and explainability of the output results through the logical driven answer integration mechanism, significantly improving the reliability and user experience of intelligent query in actual application scenarios.
[0045] In some embodiments, the step of decomposing the current question text into multiple sub-questions based on the current question text and the current question context text related to the current question text includes: determining a target source data entry corresponding to the current question text according to the current question text and the current question context text; Based on the target source data entry, the current question text and the current question context text, a question decomposition prompt word is constructed, and the question decomposition prompt word is input into a large language model to perform question decomposition on the current question text to obtain an original output text containing multiple sub-questions. JSON format verification and parsing are performed on the original output text, and if successful, multiple sub-questions in JSON format are obtained. If it fails, in the case that the number of retries does not exceed a first preset threshold, the step of inputting the question decomposition prompt word into the large language model to perform question decomposition on the current question text is executed. In the case that the number of retries exceeds the first preset threshold and the number of rewrites does not exceed a second preset threshold, the step of constructing the question decomposition prompt word based on the target source data entry, the current question text and the current question context text is executed.
[0046] Specifically, the target source data entry is the data field or entity most relevant to the current question, which is retrieved from the source database and used to guide the question decomposition direction. The question decomposition prompt word is a structured input instruction to the large language model, which can include the current question, the current question context, the target source data entry and the output format requirement, etc. The original output text is the original response returned by the large language model, which can be JSON, plain text or format error content. The first preset threshold is the upper limit of the number of retries for question decomposition (such as 3 times), which can be used to handle fluctuations in the generation of the large language model. The second preset threshold is the upper limit of the number of times of rewriting the prompt word (such as 3 times), which is used to deal with the problem of prompt word design.
[0047] As an example, referring to Figure 3 , the system receives the current question text input by the user, and combines the current question context text related thereto. Based on the current question text and the current question context text, a hybrid retrieval is performed in the source database, such as combining vector semantic matching and BM25 keyword matching, to identify and determine the target source data entry most relevant to the current query, which is used to guide the question understanding direction. Referring to Figure 4 , Figure 4A target source data entry is provided for the present application. Subsequently, based on the determined target source data entry, the current question text and the current question context text, a structured question decomposition prompt word is constructed, which explicitly contains task instructions, context information, data references and output format requirements (such as JSON structure), in order to enhance the semantic perception and output controllability of the large language model. After inputting the question decomposition prompt word into the large language model, the large language model generates original output text containing multiple sub-questions. Then, the JSON format verification and parsing are performed on the original output text to try to extract a structured sub-question list. If the parsing is successful, an effective sub-question set is obtained, and the subsequent processing flow is entered. If the parsing fails, a fault-tolerant mechanism is started: when the number of retries of question decomposition of the current question text by the large language model does not exceed a first preset threshold (such as 5 times), the question decomposition prompt word remains unchanged, and the output is generated by re-calling the large language model to cope with model generation fluctuations; when the number of retries exceeds the first threshold but the number of rewritings (the number of times of constructing the question decomposition prompt word) does not exceed a second preset threshold (such as 3 times), the step of inputting the question decomposition prompt word into the large language model to perform question decomposition on the current question text is returned to optimize the prompt word content (such as adding examples and strengthening format instructions), re-construct the prompt word and perform decomposition again. Through the above double fault-tolerant mechanism, the stability and robustness of the question decomposition process are ensured, common problems of inconsistent large model output are effectively coped with, and the complete disassembly of complex query intentions and the high availability of the system as a whole are guaranteed. In addition, if the number of rewritings exceeds the second preset threshold, the user is prompted to re-input the question. Through the closed-loop process of data-driven prompt word construction, large model decomposition, format verification and retry optimization, the complex question (current question) is converted into a structured and operable sub-question list, providing a basis for subsequent answer generation and integration, which helps the subsequent stage to analyze and process each specific aspect of the current question in depth.
[0048] In some embodiments, the step of determining the target source data entry corresponding to the current question text according to the current question text and the current question context text comprises: performing natural language preprocessing on the current question text and the current question context text to obtain a corresponding first keyword set; performing feature embedding on the current question text and the current question context text to obtain a corresponding first query representation vector; performing an approximate nearest neighbor search on the vector database of the source database based on the first query representation vector to obtain a first preset number of source data entries with the highest similarity to the first query representation vector, each source data entry carrying a vector similarity score; Based on the first keyword set, perform full-text matching retrieval in the inverted index of the source database to obtain a first preset number of source data entries with the highest matching degree to the first keyword set, each source data entry carrying a keyword matching degree score; Based on the keyword matching degree score of each source data entry and the vector similarity score of each source data entry, perform weighted summation to obtain a comprehensive score of each source data entry, and determine a second preset number of source data entries with the highest comprehensive score as target source data entries, the second preset number being less than the first preset number.
[0049] Specifically, the natural language preprocessing can be cleaning, word segmentation, stop word removal, and morphological restoration of the text (current question text, current question context text), and the natural language preprocessing extracts keywords in the current question text and the current question context text. The corresponding vector database of the source database is a database for storing source data entry vector representations, such as FAISS and Milvus, which support efficient approximate nearest neighbor search. The inverted index is an index structure for storing keyword-source data entry mappings, such as Elasticsearch, which supports keyword-based full-text matching retrieval.
[0050] As an example, the system receives the current question text input by the user and the current question context text related thereto, performs natural language preprocessing on the current question text and the context text, including word segmentation, stop word removal, part-of-speech tagging, and noun phrase extraction, identifies key words expressing the core intent, and forms a first key word set. At the same time, a pre-trained language model is used to perform feature embedding on the concatenated text to generate a high-dimensional dense vector, i.e., a first query representation vector, to capture the overall semantic information of the question. The pre-trained language model can be Bidirectional Encoder Representations from Transformers (BERT) or Text to Vector (text2vec) from a transformer. Next, two-channel retrieval is performed respectively: on the one hand, based on the first query representation vector, an Approximate Nearest Neighbor Search (ANN) is performed in the vector database of the source database to find the top K (first preset number, such as 50) source data entries with the most similar semantics to the first query representation vector, and record the vector similarity scores (such as cosine similarity) of each source data entry; on the other hand, based on the first key word set, a full-text matching retrieval is performed in the inverted index of the source database, and a BM25 algorithm or the like is used to calculate the key word matching degree to obtain the top K (first preset number, such as 50) source data entries with the highest matching degree, and record the key word matching degree scores of each source data entry. Thereafter, the results of the two retrieval channels are fused: for each retrieved source data entry, the vector similarity score and the key word matching degree score are normalized and weighted summed according to a preset weight coefficient to obtain a comprehensive score of the source data entry. For example, the semantic weight can be set to 0.6 and the key word weight to 0.4 to balance the semantic generalization ability and the precise matching ability. Finally, all the retrieved source data entries are ranked in descending order of the comprehensive score, and the top N entries (second preset number, such as 5) with the highest scores are selected as target source data entries (second preset number is smaller than the first preset number to ensure that the most relevant and high-quality target source data entries are selected). The target source data entries will be used to construct question decomposition prompts in the subsequent step to guide the large language model to focus on the correct data dimension for sub-question decomposition. By combining the advantages of semantic retrieval and key word retrieval, the mapping accuracy between complex natural language questions and underlying structured data is effectively improved, the technical defects in the prior art that a single retrieval method is easily affected by vocabulary differences or semantic drift are solved, and the understanding ability and response accuracy of the system are significantly enhanced.
[0051] In some embodiments, based on the target source data entries, the current question text, and the current question context text, the step of constructing the question decomposition prompt includes: determine a model identifier corresponding to the large language model, and based on the model identifier, search a preset template library for a question decomposition prompt word template corresponding to the large language model; fill the question decomposition prompt word template based on the target source data entry, the current question text, and the current question context text, and generate an initial question decomposition prompt word; call the large language model to optimize the initial question decomposition prompt word, and generate a question decomposition prompt word.
[0052] Specifically, the model identifier is a unique ID or name identifying the large language model used, such as gpt-4-turbo, qwen-max, ernie-bot-4.0, etc. The preset template library stores a set of prompt word templates for different large language models, supporting multi-model adaptation. The question decomposition prompt word template is a predefined prompt word structure that can be used to guide the large model to generate sub-questions. For example, the question decomposition prompt word template can be "Please decompose the user's question based on the following information: {question text}; Context: {context}; Related data: {source data}. Require to be disassembled into 3-5 specific sub-questions, output in JSON format".
[0053] As an example, the model identifier corresponding to the currently used large language model is obtained, and based on the model identifier, a question decomposition prompt word template matching the model identifier is searched from the prompt word template library. The prompt word template library pre-stores a structured instruction framework optimized for different large language models, to adapt to the instruction compliance ability and output characteristics of each large language model. After obtaining the question decomposition prompt word template corresponding to the currently used large language model, the target source data entry, the current question text input by the user, and the current question context text are filled as dynamic parameters into the preset placeholders in the question decomposition prompt word template, to generate an initial question decomposition prompt word. The initial prompt word already contains complete task instructions, semantic context, and data guidance information. To further improve the clarity and execution effect of the prompt word, the large language model itself or a stronger version of the same series is called to intelligently optimize the initial question decomposition prompt word. Specifically, by inputting meta-instructions, the model is required to enhance instruction clarity, strengthen output format constraints, and optimize language expression logic, thereby generating a more efficient and robust question decomposition prompt word. Through the above steps, not only is flexible adaptation to multiple large language models achieved, but also the quality of the prompt word is improved through the model's self-optimization capability, ensuring that the subsequent question decomposition process has higher accuracy and stability, effectively reducing the risk of semantic deviation or format errors caused by improper prompt word design.
[0054] Reference Figure 5 , Figure 5To generate the detailed workflow of the prompt word generation module in this application, which is used to dynamically generate optimized prompt words for different large language models. First, determine the model identifier corresponding to the currently used large language model, query the prompt word template library based on the model identifier corresponding to the currently used large language model, and determine whether a prompt word template matching the model identifier can be found. If there is a matching prompt word template, it is directly selected; if there is no matching item, a default prompt word template is used as an alternative to ensure the continuity and robustness of the process. After selecting the prompt word template, fill in the prompt word template based on the target source data entry (if any), the current question text, the current question context text, the sub-question source data entry (if any), and the sub-question related data (if any), etc. Generate the initial question decomposition prompt word, embed the specific parameters into the placeholders in the template, so that the prompt word has pertinence and context adaptability. Subsequently, to further improve the quality and execution effect of the prompt word, call the large language model itself or a stronger version of the same series to intelligently optimize the initial prompt word. The final question decomposition prompt word can be generated by inputting meta-instructions, requiring the model to enhance instruction clarity, strengthen output format constraints, and optimize language expression logic. The final generated prompt word not only includes question decomposition prompt words, but also covers relationship determination prompt words and question analysis prompt words, which are used to guide the large language model to perform sub-question decomposition, relationship identification between sub-questions, and sub-question analysis and answering. The joint action of the above multiple types of prompt words helps to ensure that subsequent tasks can be accurately and efficiently completed.
[0055] In some embodiments, the step of performing JSON format verification and parsing on the original output text includes: extracting a JSON object string or a JSON array string from the original output text using a regular expression; calling a JSON parsing function to perform syntax parsing on the extracted JSON object string or JSON array string to obtain a corresponding syntax parsing result; if no exception is thrown in the string extraction process and the parsing process, it is determined that the JSON format verification and parsing are successful, and the syntax parsing result is determined as a plurality of sub-questions in JSON format.
[0056] After the step of determining the syntax parsing result as a plurality of sub-questions in JSON format, it further includes: performing semantic verification on the syntax parsing result to determine whether the syntax parsing result contains required fields and the field types meet the requirements; if the semantic verification is successful, output the plurality of sub-questions in JSON format.
[0057] Specifically, large language models may output non-pure text responses containing JSON content in problem decomposition tasks, such as embedding JSON structures in natural language descriptions or including irrelevant characters at the beginning and end due to generation fluctuations. To accurately extract structured information, regular expressions are used to perform pattern matching on the original output text to identify and extract string fragments that conform to JSON object ({…}) or JSON array ([…]) syntax structures. By using regular expressions, the complete JSON structure at the outermost level can be effectively captured, even if the original output text is in a mixed format such as "The following is the decomposition result: {…}" or "json{…}", the core content can still be accurately extracted. Subsequently, a standard JSON parsing function, such as Python's json.loads(), is called to perform syntax parsing on the extracted string (JSON object string or JSON array string), converting the string into an in-memory data structure. If no syntax errors are thrown during parsing (such as missing quotes or mismatched parentheses), and the string extraction is successful, it is determined that the JSON format at the syntax level is verified, and the structured data obtained by parsing (the syntax parsing result) is taken as the candidate sub-question set. To further ensure data availability, semantic verification is performed to check whether the syntax parsing result contains predefined required fields (such as "sub_questions", "id" and "question" fields in each sub-question), and to verify whether the data types of each field conform to the specification (such as id being a string or integer, and question being a non-empty string). If the semantic verification is passed, it is confirmed that the structured data is legal and valid, and the output is a plurality of sub-questions in JSON format for subsequent logical relationship analysis. If any step fails, the system will trigger a retry or rewrite mechanism. Through JSON format verification and parsing, the fault tolerance of non-deterministic output of large models can be improved, and the accuracy and consistency of the input of downstream processes can be ensured.
[0058] In some embodiments, the step of determining the mutual dependency relationship between the sub-questions by analyzing the logical relationship between the sub-questions by the large language model comprises: determining a model identifier corresponding to the large language model, and based on the model identifier, searching a relationship judgment prompt word template corresponding to the large language model from a preset template library; for any adjacent sub-question pair, constructing a relationship judgment prompt word corresponding to the adjacent sub-question pair based on the adjacent sub-question pair, the current question text, and the current question context text and the relationship judgment prompt word template; inputting the relationship judgment prompt words corresponding to all adjacent sub-question pairs into the large language model, determining the logical relationship between the adjacent sub-questions by the large language model, and determining the logical relationship between all adjacent sub-questions as the mutual dependency relationship between the sub-questions.
[0059] Specifically, the relationship determination prompt word template is a predefined structured instruction template for guiding the model to determine the logical relationship (such as parallel, comparison, causality, etc.) between two questions, and the adjacent sub-question pair is a pair of two adjacent sub-questions (such as sub-question 1 and sub-question 2) in the question decomposition sequence, which is used for analyzing the logical relationship pair by pair, and the relationship determination prompt word is a specific input text for calling the large language model generated by filling the relationship determination prompt word template with actual parameters (adjacent sub-question pair, current question text, and current question context text).
[0060] As an example, referring to Figure 6 , first, the model identifier corresponding to the currently used large language model is obtained, and based on the model identifier, a relationship determination prompt word template matching the large language model is searched from a preset template library. The relationship determination prompt word template is a structured instruction optimized and designed, which can guide the model to accurately determine the logical association between two sub-questions. Then, for any adjacent sub-question pair (such as sub-question 1 and sub-question 2, sub-question 2 and sub-question 3, etc.), based on the current question text, the current question context text, and the selected relationship determination prompt word template, a corresponding relationship determination prompt word is constructed, i.e., the specific content of the sub-question pair, the current question text, and the current question context text are filled into the template to generate a customized prompt word for each pair of sub-questions. Subsequently, all constructed relationship determination prompt words are input into the large language model. Each relationship determination prompt word represents a logical relationship determination task for a pair of adjacent sub-questions, and the large language model analyzes each pair of sub-questions based on its powerful semantic understanding and reasoning ability, and outputs their logical relationship, such as causal relationship, parallel relationship, sequential relationship, etc. Finally, the logical relationship determination results of all adjacent sub-question pairs are collected and integrated into a complete inter-sub-question dependency relationship network, which can be used to reveal the internal relationship between sub-questions and also provides a clear structural basis for subsequent answer integration and final question solving.
[0061] Optionally, the step of constructing the relationship determination prompt word corresponding to the adjacent sub-question pair based on the adjacent sub-question pair, the current question text, and the current question context text and the relationship determination prompt word template comprises: filling the relationship determination prompt word template based on the adjacent sub-question pair, the current question text, and the current question context text to generate an initial relationship determination prompt word; calling the large language model to optimize the relationship determination prompt word to generate the relationship determination prompt word.
[0062] In some embodiments, the step of determining the sub-question related data corresponding to each sub-question comprises: performing natural language preprocessing on the sub-question to obtain a second keyword set corresponding to the sub-question; The sub-problem is characterized by embedding to obtain a second query representation vector corresponding to the sub-problem; Based on the second query representation vector, perform an approximate nearest neighbor search in the vector database of the question and answer database to obtain a first preset number of question and answer data entries with the highest similarity to the second query representation vector, each question and answer data entry carrying a vector similarity score; Based on the second keyword set, perform full-text matching retrieval in the inverted index of the question and answer database to obtain a first preset number of question and answer data entries with the highest matching degree to the second keyword set, each question and answer data entry carrying a keyword matching degree score; Based on the keyword matching degree score of each question and answer data entry and the vector similarity score of each question and answer data entry, perform weighted summation to obtain a comprehensive score of each question and answer data entry, and determine a second preset number of question and answer data entries with the highest comprehensive score as sub-problem related data, the second preset number being less than the first preset number.
[0063] Specifically, the corresponding vector database of the question and answer database is used to store the vector representation of all question entries in the question and answer database. The sub-problem related data is the question and answer retrieval result retrieved in the question and answer database through question and answer data retrieval, which serves as the knowledge basis for generating the sub-problem answer. Figure 7 , Figure 7 A sub-problem related data is provided for the present application.
[0064] As an example, for each sub-problem obtained by the current problem decomposition, natural language preprocessing is performed, including word segmentation, stop word removal, part-of-speech tagging, key entity extraction, and other operations, to identify a set of words expressing core semantics, forming a second keyword set corresponding to the sub-problem. At the same time, a pre-trained language model (such as BERT or text2vec) is used to perform feature embedding on the sub-problem text to generate a high-dimensional dense vector, i.e., a second query representation vector, to capture its deep semantic information. Subsequently, a dual-channel hybrid retrieval mechanism is started: on the one hand, based on the second query representation vector, an approximate nearest neighbor search is performed in the vector database corresponding to the question and answer database to find the top K historical problem entries (a first predetermined number, such as 50) that are most similar in semantics to the vector, and record the vector similarity score (such as cosine similarity) for each matched question and answer data entry; on the other hand, based on the second keyword set, full-text matching retrieval is performed in the inverted index structure corresponding to the question and answer database, and the BM25 algorithm is used to calculate the keyword matching degree to obtain the top K question and answer data entries (a first predetermined number, such as 50) with the highest matching degree, and record the vector similarity scores of each question and answer data entry. Thereafter, the results of the two retrieval channels are fused, and for each matched question and answer data entry, the vector similarity score and the keyword matching degree score are normalized and weighted summed according to a predetermined weight coefficient (such as a semantic weight of 0.6 and a keyword weight of 0.4) to obtain a comprehensive score for the question and answer data entry. Finally, all matched question and answer data entries are ranked in descending order of comprehensive score, and the top N question and answer data entries (a second predetermined number, such as 5) with the highest scores are selected as the sub-problem-related data corresponding to the sub-problem, where the second predetermined number is less than the first predetermined number, ensuring that the most relevant and high-quality question and answer data is selected. By combining the advantages of semantic retrieval and keyword retrieval, the matching accuracy between sub-problems and relevant question and answer data in the database is effectively improved, providing reliable knowledge support for generating accurate and reliable sub-problem answers by large language models, and significantly enhancing the intelligence level and response quality of the application.
[0065] In some embodiments, based on the sub-problem-related data, the sub-problem, and the current problem context text, the step of generating a sub-problem answer corresponding to each sub-problem by a large language model includes: For each sub-problem, determining a sub-problem source data entry corresponding to the sub-problem based on the sub-problem; Based on the sub-problem source data entry, the sub-problem-related data, the sub-problem, and the current problem context text, constructing a problem analysis prompt word corresponding to the sub-problem; Inputting the problem analysis prompt word corresponding to the sub-problem into the large language model to analyze and answer each sub-problem, obtaining an initial output text containing the sub-problem answer; performing JSON format verification and parsing on the initial output text, and if successful, obtaining the answers to each sub-question in JSON format; If the verification fails, the system will perform the step of inputting the parsed prompt words of the question corresponding to the sub-question into the large language model to parse and answer each sub-question, provided that the number of retries does not exceed a first preset threshold.
[0066] Specifically, the sub-question is a decomposed sub-task that can be independently queried. The sub-question source data entry is the original data record directly related to the sub-question, which contains the core information supporting the answer to the sub-question.
[0067] As an example, referring to Figure 8 , for each decomposed sub-question, the system performs a hybrid search in the source database, such as combining vector semantic matching and BM25 keyword matching, to identify and determine the most relevant sub-question source data entry for the sub-question, which is used to guide the understanding direction of the sub-question, i.e., the underlying database field or entity attribute in the knowledge graph that is directly related to the sub-question, which can be used to determine the data dimension that the answer depends on. Subsequently, the system integrates multiple information sources to construct structured question parsing prompt words. Based on the question parsing prompt word template, the system fills in the sub-question source data entry, sub-question related data (i.e., question and answer pairs or knowledge fragments), the sub-question itself, and the current question context text to form an input instruction that contains complete context and knowledge support, i.e., the question parsing prompt word corresponding to the sub-question. The question parsing prompt word not only guides the large language model to understand the question intent, but also provides reliable knowledge basis for it. Then, the system inputs the constructed question parsing prompt word into the large language model, which performs reasoning and generates an initial output text containing the answer to the sub-question. To ensure that the output result can be processed programmatically, the system performs strict JSON format verification and parsing on the initial output text. If the parsing is successful, the system confirms that it has obtained a structured answer to the sub-question and enters the subsequent merging process. If the parsing fails (e.g., the model outputs pure text or incorrect format), the system activates a fault-tolerant mechanism to retain the original prompt word or appropriately enhance the format constraint instructions before re-invoking the large language model to generate a response, until the output conforms to the JSON specification or the maximum number of retries is reached.
[0068] Optionally, according to the sub-question, the step of determining the sub-question source data entry corresponding to the sub-question comprises: performing natural language preprocessing on the sub-question to obtain a second keyword set corresponding to the sub-question; performing feature embedding on the sub-question to obtain a second query representation vector corresponding to the sub-question; perform an approximate nearest neighbor search based on the second query representation vector in a corresponding vector database of the source database to obtain a first preset number of source data entries with the highest similarity to the second query representation vector, each source data entry carrying a vector similarity score; perform full-text matching retrieval based on the second keyword set in a corresponding inverted index of the source database to obtain a first preset number of source data entries with the highest matching degree to the second keyword set, each source data entry carrying a keyword matching degree score; perform weighted summation based on the keyword matching degree score of each source data entry and the vector similarity score of each source data entry to obtain a comprehensive score of each source data entry, and determine a second preset number of source data entries with the highest comprehensive score as sub-problem source data entries, the second preset number being less than the first preset number.
[0069] Optionally, the step of constructing the problem analysis prompt word corresponding to the sub-problem based on the sub-problem source data entry, the sub-problem related data, the sub-problem, and the current problem context text comprises: determining a model identifier corresponding to the large language model, and based on the model identifier, searching a problem analysis prompt word template corresponding to the large language model from a preset template library; filling the problem analysis prompt word template based on the sub-problem source data entry, the sub-problem related data, the sub-problem, and the current problem context text to generate an initial problem analysis prompt word; calling the large language model to optimize the initial problem analysis prompt word to generate the problem analysis prompt word.
[0070] It should be noted that the above examples are only used for understanding the present application and do not constitute a limitation on the large model-based intelligent query method of the present application. Further simple transformations based on this technical concept are within the protection scope of the present application.
[0071] The present application also provides a large model-based intelligent query device, which is described in detail with reference to Figure 9 The large model-based intelligent query device comprises: a problem decomposition module 901 configured to perform problem decomposition on the current problem text by a large language model based on the current problem text and a current problem context text related to the current problem text to obtain a plurality of corresponding sub-problems; a relationship determination module 902 configured to analyze logical relationships between the sub-problems by the large language model to determine mutual dependency relationships between the sub-problems; a single problem analysis module 903 configured to determine sub-problem related data corresponding to each sub-problem, and generate sub-problem answers corresponding to each sub-problem by the large language model based on the sub-problem related data, the sub-problem, and the current problem context text; The answer merging module 904 is configured to merge the sub-question answers corresponding to the respective sub-questions according to the interdependence among the sub-questions, to obtain the target answer corresponding to the current question text.
[0072] The intelligent query device based on a large model provided in the present application adopts the intelligent query method based on a large model in the above embodiment, and can solve the technical problem that a complete and accurate answer cannot be generated due to the lack of fine-grained parsing capability of the internal structure of a question in the prior art. Compared with the prior art, the intelligent query device based on a large model provided in the present application has the same beneficial effects as the intelligent query method based on a large model provided in the above embodiment, and other technical features in the intelligent query device based on a large model are the same as the features disclosed in the above embodiment, which will not be repeated here.
[0073] The present application provides an intelligent query device based on a large model, which comprises at least one processor and a memory connected with the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the intelligent query method based on a large model in the above embodiment one.
[0074] Reference will be made to the following description of the embodiments of the present application, taken in conjunction with the accompanying drawings, in which Figure 10 which shows a structural schematic diagram of an intelligent query device based on a large model suitable for implementing the embodiments of the present application. The intelligent query device based on a large model in the embodiments of the present application can include, but is not limited to, mobile terminals such as notebook computers, portable application description (PAD) computers, vehicle-mounted terminals (for example, vehicle-mounted navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Figure 10 The intelligent query device based on a large model shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present application.
[0075] As Figure 10As shown, the large model based intelligent query device can include a processing apparatus 1001 (e.g., a central processor, a graphics processor, etc.) that can perform various appropriate actions and processes according to programs stored in a Read Only Memory (ROM) 1002 or loaded from a storage apparatus 1003 into a Random Access Memory (RAM) 1004. In the Random Access Memory 1004, various programs and data required for operation of the large model based intelligent query device are also stored. The processing apparatus 1001, the Read Only Memory 1002, and the Random Access Memory 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the input / output interface 1006: input apparatuses 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output apparatuses 1008 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, etc.; the storage apparatus 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication apparatus 1009. The communication apparatus 1009 can allow the large model based intelligent query device to communicate with other devices wirelessly or by wire to exchange data. Although the large model based intelligent query device with various systems is shown in the figure, it should be understood that all the shown systems are not required to be implemented or possessed. More or fewer systems can be alternatively implemented or possessed.
[0076] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication apparatus, or installed from the storage apparatus 1003, or installed from the Read Only Memory 1002. When the computer program is executed by the processing apparatus 1001, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
[0077] The intelligent query device based on a large model provided in the application adopts the intelligent query method based on a large model in the above embodiment, and can solve the technical problem that a complete and accurate answer cannot be generated due to the lack of fine-grained parsing capability of the internal structure of a question in the prior art. Compared with the prior art, the intelligent query device based on a large model provided in the application has the same beneficial effects as the intelligent query method based on a large model provided in the above embodiment, and other technical features in the intelligent query device based on a large model are the same as the features disclosed in the above embodiment method, and will not be repeated here.
[0078] It should be understood that parts of the present application can be realized by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0079] The above is merely specific implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0080] The present application provides a computer-readable storage medium having stored thereon computer-readable program instructions (i.e. computer programs) for executing the intelligent query method based on a large model in the above embodiment.
[0081] The computer readable storage medium provided in the application may be, for example, a U disk, but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or device, or any combination of the above. More specific examples of the computer readable storage medium may include, but are not limited to, an electrical connection with one or more conductive wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present embodiment, the computer readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to electrical wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0082] The above computer readable storage medium may be contained in the large model-based intelligent query device, or may exist separately without being assembled into the large model-based intelligent query device.
[0083] The above computer readable storage medium carries one or more programs, which, when executed by the large model-based intelligent query device, cause the large model-based intelligent query device to: based on the current question text and the current question context text related to the current question text, perform question decomposition on the current question text by a large language model to obtain a plurality of sub-questions corresponding to the current question text; analyze the logical relationship between the sub-questions by the large language model to determine the mutual dependency relationship between the sub-questions; determine the sub-question related data corresponding to each sub-question, and based on the sub-question related data, the sub-questions, and the current question context text, generate a sub-question answer corresponding to each sub-question by the large language model; and according to the mutual dependency relationship between the sub-questions, combine the sub-question answers corresponding to each sub-question to obtain a target answer corresponding to the current question text.
[0084] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0085] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may
[0086] The modules involved in the embodiments of the present application can be implemented in the form of software or in the form of hardware. In some cases, the name of the module does not constitute a limitation on the module itself.
[0087] The readable storage medium provided by the present application is a computer readable storage medium, which stores computer readable program instructions (i.e., computer programs) for executing the above-mentioned intelligent query method based on a large model, and can solve the technical problem that the complete and accurate answer cannot be generated due to the lack of fine-grained parsing capability of the internal structure of the problem in the prior art. Compared with the prior art, the computer readable storage medium provided by the present application has the same beneficial effects as the intelligent query method based on a large model provided by the above-mentioned embodiments, and will not be described here.
[0088] The application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the intelligent query method based on a large model as described above.
[0089] The computer program product provided by the application can solve the technical problem in the prior art that a complete and accurate answer cannot be generated due to the lack of fine-grained parsing capability of the internal structure of the question. Compared with the prior art, the beneficial effects of the computer program product provided by the application are the same as those of the intelligent query method based on a large model provided by the above-mentioned embodiments, and are not described here.
[0090] The above only describes some embodiments of the application, and does not limit the patent scope of the application. Any equivalent structural transformation made by using the content of the specification and drawings, or direct / indirect application in other related technical fields within the technical concept of the application is included in the patent protection scope of the application.
Claims
1. An intelligent query method based on a large model, characterized in that, The intelligent query method based on large models includes: Based on the current question text and the current question context text related to the current question text, the current question text is decomposed using a large language model to obtain multiple corresponding sub-questions; The logical relationships between the sub-problems are analyzed using the large language model to determine the interdependencies between the sub-problems. Determine the sub-question-related data corresponding to each sub-question, and based on the sub-question-related data, the sub-question, and the current question context text, generate the sub-question answers corresponding to each sub-question using the large language model; Based on the interdependencies between the sub-problems, the answers to each sub-problem are merged to obtain the target answer corresponding to the current question text.
2. The intelligent query method based on a large model as described in claim 1, characterized in that, The step of decomposing the current question text into multiple sub-questions using a large language model based on the current question text and the current question context text related to the current question text includes: Based on the current question text and the current question context text, determine the target source data entry corresponding to the current question text; Based on the target source data entry, the current question text, and the current question context text, a question decomposition prompt word is constructed, and the question decomposition prompt word is input into the large language model to decompose the current question text to obtain the original output text containing multiple sub-questions; Perform JavaScript object representation JSON format validation and parsing on the original output text. If successful, obtain multiple sub-questions in JSON format. If it fails, and the number of retries does not exceed the first preset threshold, return to the step of inputting the problem decomposition prompt words into the large language model to decompose the current problem text; If the number of retries exceeds the first preset threshold and the number of rewrites does not exceed the second preset threshold, return to the step of constructing problem decomposition prompt words based on the target source data entry, the current problem text, and the current problem context text.
3. The intelligent query method based on a large model as described in claim 2, characterized in that, The step of determining the target source data entry corresponding to the current question text based on the current question text and the current question context text includes: Natural language preprocessing is performed on the current question text and the current question context text to obtain the corresponding first keyword set; Feature embedding is performed on the current question text and the current question context text to obtain the corresponding first query representation vector; Based on the first query representation vector, an approximate nearest neighbor search is performed in the vector database of the source database to obtain a first preset number of source data entries with the highest similarity to the first query representation vector, and each source data entry carries a vector similarity score. Based on the first keyword set, a full-text matching search is performed in the inverted index of the source database to obtain a first preset number of source data entries with the highest matching degree to the first keyword set, and each source data entry carries a keyword matching degree score; The keyword matching score and the vector similarity score of each source data entry are weighted and summed to obtain a comprehensive score for each source data entry. The second preset number of source data entries with the highest comprehensive scores are determined as the target source data entries, where the second preset number is less than the first preset number.
4. The intelligent query method based on a large model as described in claim 2, characterized in that, The step of constructing question decomposition prompts based on the target source data entry, the current question text, and the current question context text includes: Determine the model identifier corresponding to the large language model, and based on the model identifier, search for the question decomposition prompt word template corresponding to the large language model from the preset template library; The initial problem decomposition prompt words are generated by filling in the problem decomposition prompt word template based on the target source data entry, the current problem text, and the current problem context text; The large language model is invoked to optimize the initial question decomposition prompts, thereby generating the question decomposition prompts.
5. The intelligent query method based on a large model as described in claim 1, characterized in that, The step of analyzing the logical relationships between the sub-problems using the large language model and determining the interdependencies between the sub-problems includes: Determine the model identifier corresponding to the large language model, and based on the model identifier, search for the relationship judgment prompt word template corresponding to the large language model from the preset template library; For any pair of adjacent sub-questions, construct the relationship determination prompt words corresponding to the pair of adjacent sub-questions based on the pair of adjacent sub-questions, the current question text, the current question context text, and the relationship determination prompt word template; Input the relation determination prompt words corresponding to all adjacent sub-problems into the large language model, determine the logical relationship between adjacent sub-problems through the large language model, obtain the logical relationship between all adjacent sub-problems, and determine the logical relationship between all adjacent sub-problems as the mutual dependency relationship between the sub-problems.
6. The intelligent query method based on a large model as described in claim 1, characterized in that, The step of determining the sub-problem-related data corresponding to each of the sub-problems includes: Natural language preprocessing is performed on the sub-problem to obtain the second keyword set corresponding to the sub-problem; The sub-problem is embedded with features to obtain the second query representation vector corresponding to the sub-problem; Based on the second query representation vector, an approximate nearest neighbor search is performed in the vector database of the question and answer database to obtain a first preset number of question and answer data entries with the highest similarity to the second query representation vector, and each question and answer data entry carries a vector similarity score. Based on the second keyword set, a full-text matching search is performed in the inverted index of the question and answer database to obtain a first preset number of question and answer data entries with the highest matching degree to the second keyword set, and each question and answer data entry carries a keyword matching degree score; The keyword matching score and vector similarity score of each question and answer data item are weighted and summed to obtain a comprehensive score for each question and answer data item. The second preset number of question and answer data items with the highest comprehensive scores are determined as the sub-question related data, where the second preset number is less than the first preset number.
7. The intelligent query method based on a large model as described in claim 1, characterized in that, The step of generating answers to each sub-question based on the sub-question-related data, the sub-question, and the context text of the current question using the large language model includes: For each sub-problem, determine the corresponding sub-problem source data entry based on the sub-problem; Based on the sub-question source data entries, the sub-question related data, the sub-question and the current question context text, construct the question parsing prompt words corresponding to the sub-question; The question parsing prompts corresponding to the sub-questions are input into the large language model to parse and answer each sub-question, resulting in an initial output text containing the answers to the sub-questions; Perform JSON format validation and parsing on the initial output text. If successful, obtain the answers to each of the sub-questions in JSON format. If the attempt fails, and the number of retries does not exceed a first preset threshold, the process returns to the step of inputting the question parsing prompt words corresponding to the sub-question into the large language model to parse and answer each sub-question.
8. The intelligent query method based on a large model as described in claim 1, characterized in that, The step of merging the answers to the sub-questions based on the interdependencies between the sub-questions to obtain the target answer corresponding to the current question text includes: Based on the interdependencies between the sub-problems, determine the integration order of the answers to each sub-problem; Following the integration order described above, the answers to each of the sub-questions are combined to generate the complete answer text; Perform format validation on the complete answer text to verify whether the complete answer text conforms to predefined format specifications; If the format validation passes, the complete answer text will be identified as the target answer corresponding to the current question text.
9. An intelligent query device based on a large model, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the intelligent query method based on a large model as described in any one of claims 1 to 8.
10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the intelligent query method based on a large model as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Knowledge base response method and system based on large language model
CN117951249A
Data analysis method and device, computer equipment and computer readable storage medium
CN117951271A
Bridge management and cultivation question-answering method based on cooperation of large model and knowledge graph
CN118410145A
Question and answer method and device based on large model, electronic equipment and medium
CN119884300A
Data processing method and device, equipment and storage medium
CN120353816A