Intelligent query method, device and storage medium based on large model
By decomposing and analyzing the logical relationships of questions using an intelligent query method based on a large language model, the problem of generating complete and accurate answers in existing technologies is solved. This enables deep semantic understanding and structural deconstruction of complex questions, improving the reliability and user experience of the intelligent question-answering system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2026-03-27
AI Technical Summary
Existing intelligent question answering systems lack the ability to fine-grainedly analyze complex, multi-intent natural language questions, resulting in an inability to generate complete and accurate answers, especially in applications such as finance, healthcare, and enterprise data analysis.
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 accuracy and completeness of intelligent question-answering systems in handling complex problems, ensures the comprehensiveness and logical coherence of answers, and enhances the user experience.
Smart Images

Figure CN120892545B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent question answering technology, and in particular to an intelligent query method, device and storage medium based on a large model. Background Technology
[0002] Existing intelligent question-answering technologies generally employ holistic matching or keyword retrieval, treating questions as a whole and attempting to obtain answers directly through a single query. This lacks the ability to analyze the internal structure of questions at a fine-grained level. Therefore, when users pose complex, multi-intent natural language questions, the system often only returns partial information, or even omissions or misunderstandings, resulting in incomplete or logically flawed answers—in other words, difficulty in generating accurate and complete responses. This deficiency severely restricts the effectiveness of intelligent question-answering systems in real-world scenarios, especially in fields such as finance, healthcare, and enterprise data analysis, where the completeness and logical coherence of answers are crucial.
[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide an intelligent query method, device, and storage medium based on a large model, aiming to solve the technical problem in the prior art that the lack of fine-grained analysis capability of the internal structure of the question leads to the inability to generate a complete and accurate answer.
[0005] To achieve the above objectives, this application proposes an intelligent query method based on a large model, which includes:
[0006] 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;
[0007] The logical relationships between the sub-problems are analyzed using the large language model to determine the interdependencies between the sub-problems.
[0008] 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;
[0009] 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.
[0010] In one embodiment, 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:
[0011] Based on the current question text and the current question context text, determine the target source data entry corresponding to the current question text;
[0012] 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;
[0013] Perform JavaScript Object Notation (JSON) format validation and parsing on the original output text. If successful, obtain multiple sub-questions in JSON format.
[0014] 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;
[0015] 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.
[0016] In one embodiment, 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:
[0017] Natural language preprocessing is performed on the current question text and the current question context text to obtain the corresponding first keyword set;
[0018] Feature embedding is performed on the current question text and the current question context text to obtain the corresponding first query representation vector;
[0019] 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.
[0020] 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;
[0021] 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.
[0022] In one embodiment, 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:
[0023] 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;
[0024] 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;
[0025] The large language model is invoked to optimize the initial question decomposition prompts, thereby generating the question decomposition prompts.
[0026] In one embodiment, the step of performing JavaScript Object Notation (JSON) format validation and parsing on the original output text includes:
[0027] Use regular expressions to extract JSON object strings or JSON array strings from the original output text;
[0028] Call the JSON parsing function to perform syntax parsing on the extracted JSON object string or the JSON array string, and obtain the corresponding syntax parsing result;
[0029] If no exceptions are thrown during the string extraction and parsing process, the JSON format verification and parsing are confirmed to be successful, and the syntax parsing result is determined to be multiple sub-problems of the JSON format.
[0030] In one embodiment, the step of analyzing the logical relationships between the sub-problems using the large language model to determine the interdependencies between the sub-problems includes:
[0031] 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;
[0032] 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;
[0033] 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.
[0034] In one embodiment, the step of determining the sub-problem-related data corresponding to each of the sub-problems includes:
[0035] Natural language preprocessing is performed on the sub-problem to obtain the second keyword set corresponding to the sub-problem;
[0036] The sub-problem is embedded with features to obtain the second query representation vector corresponding to the sub-problem;
[0037] 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.
[0038] 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;
[0039] 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.
[0040] In one embodiment, the step of generating sub-question answers corresponding to each sub-question based on the sub-question-related data, the sub-questions, and the current question context text using the large language model includes:
[0041] For each sub-problem, determine the corresponding sub-problem source data entry based on the sub-problem;
[0042] 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;
[0043] 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;
[0044] 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.
[0045] 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.
[0046] In one embodiment, 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:
[0047] Based on the interdependencies between the sub-problems, determine the integration order of the answers to each sub-problem;
[0048] Following the integration order described above, the answers to each of the sub-questions are combined to generate the complete answer text;
[0049] Perform format validation on the complete answer text to verify whether the complete answer text conforms to predefined format specifications;
[0050] If the format validation passes, the complete answer text will be identified as the target answer corresponding to the current question text.
[0051] Furthermore, to achieve the above objectives, this application also proposes a large-model-based intelligent query device, which includes:
[0052] The problem decomposition module is used to decompose the current problem text based on the current problem text and the current problem context text related to the current problem text, and obtain multiple corresponding sub-problems through a large language model.
[0053] The relationship determination module is used to analyze the logical relationships between the sub-problems through the large language model and determine the interdependencies between the sub-problems.
[0054] A single question parsing module is used to 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 through the large language model;
[0055] The answer merging module is used to merge the answers to each sub-question according to the interdependencies between the sub-questions, so as to obtain the target answer corresponding to the current question text.
[0056] Furthermore, to achieve the above objectives, this application also proposes a large-model-based intelligent query device, the device comprising: 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 large-model-based intelligent query method described above.
[0057] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and 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 above.
[0058] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the intelligent query method based on a large model as described above.
[0059] The one or more technical solutions proposed in this application have at least the following technical effects: Based on the current problem text and the current problem context text related to the current problem text, a large language model is used to decompose the current problem text into multiple corresponding sub-problems, transforming the complex large problem into a series of more specific and easier-to-handle sub-problems, thereby improving the efficiency and accuracy of problem-solving. Analyzing the logical relationships between the sub-problems through the large language model, and analyzing the interdependencies between each sub-problem, helps to compensate for the shortcomings of traditional methods that ignore the logical connections between sub-problems, avoids fragmented answers, and clarifies the logical order between sub-problems. For each sub-question, relevant sub-question data is determined. Based on this data, the sub-question itself, and the context text of the current question, the large language model generates answers for each sub-question. Then, according to the dependencies between the sub-questions, the answers are merged to ensure the answer covers the entire question while maintaining logical coherence, generating a complete and coherent target answer for the current question text. This solves the technical problem in existing technologies where a lack of fine-grained analysis of the internal structure of the question prevents the generation of complete and accurate answers, improving the completeness and accuracy of the answer. Based on the intelligent query method based on the large model provided in this application, the large language model decomposes the user-input current question text and its context text, breaking down complex questions (current question text) into multiple semantically independent sub-questions. This achieves explicit modeling of the internal structure of the question, overcoming the shortcomings of traditional methods that only perform overall matching and miss sub-intents. Furthermore, the large language model further analyzes the semantic relationships between the sub-questions, identifies their logical relationships, clarifies the execution order and combination methods between sub-questions, and provides a reasoning path for subsequent answer organization. Subsequently, based on the relevant data corresponding to each sub-question, precise answers to the sub-questions are generated by combining contextual information, ensuring that each local query is supported by reliable data and improving the accuracy and verifiability of the answers. Finally, based on the determined interdependencies between sub-questions, the answers to multiple sub-questions are systematically merged to generate a coherent and complete target answer, avoiding information fragmentation and missing conclusions. This not only achieves deep semantic understanding and structured deconstruction of complex problems, but also ensures the completeness and interpretability of the output results through a logic-driven answer integration mechanism, significantly improving the reliability and user experience of intelligent queries in practical application scenarios. Attached Figure Description
[0060] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0061] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0062] Figure 1 This is a flowchart illustrating an embodiment of the intelligent query method based on a large model in this application.
[0063] Figure 2 A functional diagram of the data module provided in this application;
[0064] Figure 3 A flowchart illustrating another intelligent query method based on a large model provided in this application;
[0065] Figure 4 An example diagram of a target source data entry provided in this application;
[0066] Figure 5 A schematic diagram of the workflow of the prompt word generation module provided in this application;
[0067] Figure 6 A flowchart illustrating another intelligent query method based on a large model provided in this application;
[0068] Figure 7 Example diagram of data related to a sub-problem provided in this application;
[0069] Figure 8 A flowchart illustrating another intelligent query method based on a large model provided in this application;
[0070] Figure 9 This is a schematic diagram of the module structure of the intelligent query device based on a large model according to an embodiment of this application;
[0071] Figure 10 This is a schematic diagram of the device structure of the hardware operating environment involved in the intelligent query method based on a large model in the embodiments of this application.
[0072] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0073] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0074] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0075] The main solution of this application embodiment is as follows: 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 relationship between the sub-questions is analyzed using the large language model to determine the interdependencies between the sub-questions; the relevant data for each sub-question is determined, and based on the relevant data, the sub-questions, and the current question context text, the answers to each sub-question are generated using the large language model; according to the interdependencies between the sub-questions, the answers to each sub-question are merged to obtain the target answer corresponding to the current question text.
[0076] In this embodiment, for ease of description, the following description will focus on identifying an intelligent query system based on a large model.
[0077] Because existing technologies use holistic matching or keyword retrieval, treating questions as a whole and attempting to obtain answers directly through a single query, they lack the ability to analyze the internal structure of questions with fine granularity. Therefore, when users pose complex, multi-intent natural language questions, the system often only returns partial relevant information, or even omissions or misunderstandings, resulting in incomplete or logically confused final answers, making it difficult to directly generate accurate and complete responses.
[0078] This application provides a solution that decomposes the current question text and its context text input by the user using a large language model. This breaks down complex questions (the current question text) into multiple semantically independent sub-questions, enabling explicit modeling of the internal structure of the question and overcoming the shortcomings of traditional methods that only perform overall matching and miss sub-intents. Secondly, the large language model further analyzes the semantic relationships between the sub-questions, identifying their logical connections and clarifying the execution order and combination methods among them, providing a reasoning path for subsequent answer organization. Subsequently, based on the relevant data corresponding to each sub-question, accurate answers to the sub-questions are generated separately, combined with contextual information, ensuring that each local query is based on reliable data support, improving the accuracy and verifiability of the answer. Finally, based on the determined interdependencies between the sub-questions, the answers to multiple sub-questions are systematically merged to generate a coherent and complete target answer, avoiding information fragmentation and missing conclusions. This not only achieves deep semantic understanding and structured deconstruction of complex questions but also ensures the integrity and interpretability of the output results through a logic-driven answer integration mechanism, significantly improving the reliability and user experience of intelligent queries in practical application scenarios.
[0079] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or a large-model-based intelligent query device capable of achieving the above functions. The following description uses a large-model-based intelligent query system as an example to illustrate this embodiment and the subsequent embodiments.
[0080] Based on this, embodiments of this application provide an intelligent query method based on a large model, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the intelligent query method based on a large model in this application.
[0081] In this embodiment, the intelligent query method based on a large model includes steps 101-104:
[0082] 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 using a large language model to obtain multiple corresponding sub-questions.
[0083] Specifically, the current question text is the original natural language question entered by the user in the current dialogue. The related context text for the current question text consists of the user's previous questions and answers entered in the current dialogue. The large language model is an artificial intelligence (AI) model with semantic understanding and generation capabilities, such as Generative Pre-trained Transformer 4 (GPT-4), Claude, Google Gemini, and Qwen, which can be used to perform question decomposition tasks. Multiple sub-questions are the output results after decomposition, which are a list of subqueries in structured or natural language form.
[0084] In some embodiments, the system receives the current question text input by the user and combines it with the associated context text to construct a structured input, thereby enhancing the completeness of semantic understanding. Subsequently, by invoking a large language model, the system inputs question decomposition prompts containing the current question text and context text. These prompts explicitly instruct the large language model to break down the complex question (current question text) into multiple semantically independent, individually executable sub-questions. Based on its powerful semantic understanding capabilities, the large language model performs intent recognition and logical analysis on the input current question text, outputting a structured result containing multiple sub-questions, typically in JSON format. This structured result can serve as the basis for subsequent data retrieval and answer generation. By combining the current question text with relevant contextual text and using a large language model to decompose the question, multiple semantic intents hidden in complex queries can be accurately identified. Complex problems that are originally difficult to handle directly are transformed into several executable sub-problems. By making full use of contextual information to eliminate ambiguity and improve the accuracy of question understanding, the reasoning ability of the large language model is leveraged to enhance the system's ability to understand complex multi-intent questions and achieve fine-grained intent decomposition. This helps to avoid intent omissions caused by overall matching in traditional methods, ensuring that all query requirements are fully covered and improving the completeness and accuracy of subsequent retrieval and answers.
[0085] Step 102: Analyze the logical relationships between sub-problems using a large language model to determine the interdependencies between them.
[0086] Specifically, logical relationships refer to the semantic connections between subproblems, which can include parallel relationships (and), selection relationships (or), comparison relationships, causal relationships, etc. Interdependencies indicate the execution order or combinational logic of subproblems, serving as a structural blueprint for merging the answers to subsequent subproblems.
[0087] In some embodiments, based on multiple sub-questions, the current question text, and the current question context text as input, structured relation determination prompts are constructed and input into the large language model. These prompts explicitly require the large language model to determine the semantic association type between the sub-questions, including conjunction (and), choice (or), comparison, causation, etc., and output standardized logical relation descriptions. Based on its deep semantic understanding capabilities, the large language model performs semantic comparison and intent analysis between pairs of sub-questions, identifying interdependencies such as conjunction (and) and choice (or), which serve as the basis for subsequent answer merging. This step enables the system to possess structured reasoning capabilities for complex queries, clarifies the solution order and combination method of sub-questions, provides a logical basis for the orderly integration of subsequent answers, ensures the final output answer is coherent, complete, and interpretable, helps avoid logical confusion in the answer generation process, and improves the accuracy and reliability of the system in handling multi-intent question-answering query scenarios.
[0088] Step 103: Determine the relevant data for each sub-problem, and based on the relevant data, the sub-problem, and the context text of the current problem, generate the answers to each sub-problem using a large language model.
[0089] Specifically, the data module, as the information hub of the entire intelligent query system based on a large model, undertakes the core functions of data storage, management, and service. (Reference) Figure 2 , Figure 2This is a functional diagram of the data module. The data module comprises two main components: a source database and a question-and-answer database. The source database stores multiple source data entries, used to maintain the source data items the system relies on, such as business metrics, field definitions, and entity attributes. The question-and-answer database stores multiple question-and-answer entries, each including the answer to the question in the question domain. The question-and-answer database supports rapid matching of common questions. Changes to both source and question-and-answer data must first be written to the MySQL relational database to ensure transaction consistency and persistent storage. Subsequently, through a change data capture mechanism, newly added, modified, or deleted data is automatically synchronized to the vector database and inverted index, enabling real-time updates of semantic retrieval and keyword retrieval capabilities, ensuring data consistency and real-time performance across 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 updates to the data module, the system can not only respond to the latest business status but also continuously improve the accuracy of semantic understanding and retrieval coverage, thereby achieving a more intelligent and efficient user response. By using a MySQL database to store structured information and combining it with a vector knowledge base to support advanced retrieval (such as vector queries and keyword matching), efficient data management and rapid information retrieval are achieved. The two-tiered data management approach using a vector database and inverted index not only ensures data consistency and integrity but also improves query efficiency. In particular, the application of the vector knowledge base allows the system to handle more complex semantic search needs. In problem decomposition and individual problem parsing, the large model can better understand the problem and generate higher-quality answers. The sub-problem-related data refers to the retrieval results of the sub-problem in the question-answering database.
[0090] In some embodiments, for each decomposed sub-question, a hybrid retrieval is first performed in the question-answering database, including semantic matching based on a vector database and keyword matching based on Best Match 25 (BM25), to obtain the most relevant question-answering data entries as sub-question related data. Subsequently, the sub-question, the retrieved sub-question related data, and the current question's context text are combined to construct the corresponding question parsing hints. These hints are then input into a large language model, explicitly requiring the model to generate accurate and concise natural language answers. Based on understanding the sub-question's intent, the large language model integrates the retrieved sub-question related data to generate semantically coherent and well-founded local answers, i.e., the sub-question answers. By retrieving query results corresponding to each sub-question from the question-and-answer database as sub-question-related data, and combining this data with the sub-question itself and the current context text, the system uses a large language model to generate sub-question answers. This ensures that the answer generation process is based on evidence, effectively utilizes the question-and-answer database, avoids the arbitrary generation of sub-question answers, improves the accuracy and consistency of answers, and maintains semantic coherence through context, making local answers more closely match the user's true intent. This achieves knowledge-driven, precise responses and provides reliable and traceable intermediate results for subsequent answer integration, significantly enhancing the system's intelligence and credibility.
[0091] Step 104: Based on the interdependencies between sub-problems, merge the answers to each sub-problem to obtain the target answer corresponding to the current question text.
[0092] Optionally, the step of merging the answers to each sub-problem according to the interdependencies between sub-problems to obtain the target answer corresponding to the current question text includes:
[0093] Based on the interdependencies among sub-problems, determine the order in which the answers to each sub-problem are integrated;
[0094] The answers to the individual sub-questions are combined in the order of integration to generate the complete answer text.
[0095] Perform format validation on the complete answer text to verify whether the complete answer text conforms to the predefined format specifications;
[0096] If the format validation passes, the complete answer text will be designated as the target answer corresponding to the current question text;
[0097] If the format validation fails, return to the step of combining the answers to the sub-questions in the integration order to generate the complete answer text, until the maximum number of validations is reached.
[0098] Specifically, the interdependencies between sub-problems are logical relationships (such as comparison, parallelism, and causality) determined by the preceding steps, which are used to determine how the answers to each sub-problem are combined.
[0099] As an example, the system receives multiple sub-question answers generated in the preceding stage, along with the established dependencies between the sub-questions. Based on these dependencies, the system parses and determines the integration order of the sub-question answers. For instance, for comparative relationships, the data for each party (sub-question answers) can be listed first, followed by a conclusion; for parallel relationships, they can be organized by number or by category. Subsequently, the system combines the sub-question answers in the integration order to generate a semantically coherent and logically clear complete answer text. After generation, the system initiates a format validation process, using a rule engine to perform multi-dimensional validation on the complete answer text, including whether it contains necessary data sources, uses standard punctuation, contains sensitive words, and exceeds the maximum length limit, ensuring that the output conforms to predefined format specifications. If the validation 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 validation fails, it returns to the step of combining the sub-question answers in the integration order to generate the complete answer text, until the format requirements are met or the maximum number of retries is reached. The above process transforms fragmented, partial answers into structured, holistic responses, ensuring the logic, completeness, and compliance of the final output. This enhances the practicality and credibility of the intelligent question-answering system, enabling users to receive satisfactory answers even when faced with highly complex questions.
[0100] Based on the intelligent query method based on a large model provided in this application, the current question text and its related context text are used to decompose the current question text using a large language model, resulting in multiple sub-questions. This transforms the complex large question into a series of more specific and easier-to-process sub-questions, thereby improving the efficiency and accuracy of problem-solving. Analyzing the logical relationships between sub-questions using a large language model helps to overcome the shortcomings of traditional methods that ignore the logical connections between sub-questions, avoids fragmented answers, and clarifies the logical order between sub-questions. For each sub-question, relevant sub-question data is determined. Based on this data, the sub-question, and the current question context text, the large language model generates answers for each sub-question. Then, according to the interdependencies between sub-questions, the answers are merged to ensure that the answer covers the entire question while maintaining logical coherence, generating a complete and coherent target answer for the current question text. This solves the technical problem in existing technologies where the lack of fine-grained analysis of the internal structure of the question prevents the generation of complete and accurate answers, thus improving the completeness and accuracy of the answers. Based on the large-scale model-based intelligent query method provided in this application, the method decomposes the current question text and its context text input by the user using a large language model. This breaks down the complex question (current question text) into multiple semantically independent sub-questions, achieving explicit modeling of the internal structure of the question and overcoming the shortcomings of traditional methods that only perform overall matching and miss sub-intents. Secondly, the large language model further analyzes the semantic relationships between the sub-questions, identifies their logical relationships, and clarifies the execution order and combination methods between sub-questions, providing a reasoning path for subsequent answer organization. Subsequently, based on the relevant data corresponding to each sub-question, accurate sub-question answers are generated separately in conjunction with contextual information, ensuring that each local query is based on reliable data support and improving the accuracy and verifiability of the answer. Finally, based on the determined interdependencies between sub-questions, the answers to multiple sub-questions are systematically merged to generate a coherent and complete target answer, avoiding information fragmentation and missing conclusions. This not only achieves deep semantic understanding and structured deconstruction of complex questions but also ensures the integrity and interpretability of the output results through a logic-driven answer integration mechanism, significantly improving the reliability and user experience of intelligent queries in practical application scenarios.
[0101] In some embodiments, 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:
[0102] Based on the current question text and the current question context text, determine the target source data entry corresponding to the current question text;
[0103] Based on the target source data entries, the current question text, and the current question context text, question decomposition prompts are constructed, and the question decomposition prompts are input into a large language model to decompose the current question text, resulting in the original output text containing multiple sub-questions.
[0104] Perform JSON format validation and parsing on the original output text. If successful, obtain multiple sub-questions in JSON format.
[0105] 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;
[0106] 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 prompts based on the target source data entry, the current problem text, and the current problem context text.
[0107] Specifically, the target source data entries are the data fields or entities most relevant to the current problem, retrieved from the source database, and used to guide the direction of problem decomposition. Problem decomposition prompts are structured input instructions given to the large language model, which may include the current problem, the current problem context, the target source data entries, and output format requirements. The raw output text is the raw response returned by the large language model, which may be JSON, plain text, or incorrectly formatted content. The first preset threshold is the upper limit for the number of retries in problem decomposition (e.g., 3 times), which can be used to handle fluctuations in the large language model's output. The second preset threshold is the upper limit for the number of times the prompts are rewritten (e.g., 3 times), used to address prompt design issues.
[0108] As an example, see reference Figure 3 The system receives the current question text input by the user and combines it with related context text. Based on the current question text and context text, a hybrid search is performed in the source database, such as combining vector semantic matching and BM25 keyword matching, to identify and determine the target source data entries most relevant to the current query, guiding the direction of question comprehension. (Reference) Figure 4 , Figure 4This application provides a target source data entry. Subsequently, based on the determined target source data entry, the current question text, and the current question context text, structured question decomposition prompts are constructed. These prompts explicitly include task instructions, contextual information, data references, and output format requirements (such as JSON structure) to enhance the semantic awareness and output controllability of the large language model. After inputting the question decomposition prompts into the large language model, the model generates raw output text containing multiple sub-questions. The raw output text is then subjected to JSON format validation and parsing to attempt to extract a structured list of sub-questions. If parsing is successful, a valid set of sub-questions is confirmed, and the process proceeds to subsequent steps. If parsing fails, a fault tolerance mechanism is activated: if the number of retries for decomposing the current question text using the large language model does not exceed a first preset threshold (e.g., 5 times), the question decomposition prompts remain unchanged, and the large language model is called again to generate output to handle model generation fluctuations; if the number of retries exceeds the first threshold but the number of rewrites (the number of times question decomposition prompts are constructed) does not exceed a second preset threshold (e.g., 3 times), the process returns to inputting the question decomposition prompts into the large language model to decompose the current question text, optimizing the prompt content (e.g., adding examples, strengthening formatting instructions), reconstructing the prompts, and performing decomposition again. This dual fault tolerance mechanism ensures the stability and robustness of the question decomposition process, effectively addressing the common problem of inconsistent large model output, guaranteeing the complete decomposition of complex query intents and the overall high availability of the system. Furthermore, if the number of rewrites exceeds the second preset threshold, the user is prompted to re-enter the question. Through a closed-loop process of data-driven prompt word construction, large model decomposition, format verification, and retry optimization, the complex problem (the current problem) is transformed into a structured and actionable list of sub-problems, providing a foundation for subsequent answer generation and integration. This helps subsequent stages to conduct in-depth analysis and processing of each specific aspect of the current problem.
[0109] In some embodiments, the step of determining the target source data entry corresponding to the current issue text based on the current issue text and the current issue context text includes:
[0110] Natural language preprocessing is performed on the current question text and the current question context text to obtain the corresponding first keyword set;
[0111] Feature embedding is performed on the current question text and the current question context text to obtain the corresponding first query representation vector;
[0112] 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. Each source data entry carries a vector similarity score.
[0113] 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. Each source data entry carries a keyword matching degree score.
[0114] The keyword matching score and vector similarity score of each source data item are weighted and summed to obtain the comprehensive score of each source data item. The second preset number of source data items with the highest comprehensive scores are determined as target source data items. The second preset number is less than the first preset number.
[0115] Specifically, natural language preprocessing (NLP) can perform operations such as cleaning, word segmentation, stop word removal, and lemmatization on the text (current question text and current question context text). NLP preprocessing also extracts keywords from the current question text and current question context text. The corresponding vector database of the source database is a database that stores the vector representations of source data entries, such as FAISS or Milvus, supporting efficient approximate nearest neighbor search. The inverted index is an index structure that stores the keyword-source data entry mapping, such as Elasticsearch, supporting keyword-based full-text matching retrieval.
[0116] As an example, the system receives the current question text and its related context text from the user. It performs natural language preprocessing on both texts, including word segmentation, stop word removal, part-of-speech tagging, and noun phrase extraction, identifying keywords expressing the core intent and forming a first keyword set. Simultaneously, a pre-trained language model is used to embed features into the concatenated text, generating a high-dimensional dense vector—the first query representation vector—to capture the overall semantic information of the question. The pre-trained language model can be a Bidirectional Encoder Representations from Transformers (BERT) or a Text-to-Vector (text2vec) model. Next, a dual-channel retrieval is performed: On 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 source data entries (a first preset number, such as 50) that are semantically most similar to the first query representation vector, and the vector similarity score (e.g., cosine similarity) of each source data entry is recorded; on the other hand, based on the first keyword set, a full-text matching retrieval is performed in the inverted index of the source database, and the keyword matching degree is calculated using algorithms such as BM25 to obtain the top K (a first preset number, such as 50) source data entries with the highest matching degree, and the keyword matching degree score of each source data entry is recorded. Afterwards, the results of the two retrieval channels are fused: for each retrieved source data entry, its vector similarity score and keyword matching degree score are normalized, and then weighted and summed according to preset weight coefficients to obtain a comprehensive score for the source data entry. For example, the semantic weight can be set to 0.6 and the keyword weight to 0.4 to balance semantic generalization ability and precise matching ability. Finally, all retrieved source data entries are sorted in descending order of their comprehensive scores, and the N entries with the highest scores are selected as target source data entries (a second preset number, such as 5). The second preset number is less than the first preset number, ensuring that the most relevant and high-quality target source data entries are selected. These target source data entries will be used to construct subsequent question decomposition prompts, guiding the large language model to focus on the correct data dimensions for sub-question breakdown. By integrating the advantages of semantic retrieval and keyword retrieval, the accuracy of the mapping between complex natural language questions and underlying structured data is effectively improved. This addresses the technical shortcomings of existing technologies where single retrieval methods are susceptible to lexical differences or semantic drift, significantly enhancing the system's understanding ability and response accuracy.
[0117] In some embodiments, 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:
[0118] 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;
[0119] The initial problem decomposition prompts are generated by filling in the problem decomposition prompt template based on the target source data entries, the current problem text, and the current problem context text.
[0120] The initial question decomposition prompts are optimized by calling a large language model to generate question decomposition prompts.
[0121] Specifically, the model identifier is a unique ID or name that identifies the large language model used, such as gpt-4-turbo, qwen-max, ernie-bot-4.0, etc. The preset template library stores a collection 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 in generating sub-questions. For example, the question decomposition prompt word template could be: "Please decompose the user question based on the following information: {question text}; context: {context}; relevant data: {source data}. The requirement is to decompose it into 3-5 specific sub-questions and output in JSON format."
[0122] As an example, the process begins by obtaining the model identifier corresponding to the currently used large language model. Based on this identifier, a matching question decomposition prompt template is searched from the prompt template library. This library pre-stores structured instruction frameworks optimized for different large language models to adapt to their instruction compliance capabilities and output characteristics. After obtaining the prompt template for the currently used large language model, the target source data entries, the user-inputted current question text, and the current question context text are used as dynamic parameters to populate the preset placeholders in the prompt template, generating initial question decomposition prompts. These initial prompts already contain complete task instructions, semantic context, and data guidance information. To further improve the clarity and execution effectiveness of the prompts, the large language model itself or a more powerful version of the same series is invoked to intelligently optimize the initial question decomposition prompts. Specifically, by inputting meta-instructions, the model is asked to enhance instruction explicitness, strengthen output format constraints, and optimize language expression logic, thereby generating more efficient and robust question decomposition prompts. Through the above steps, not only is flexible adaptation to multiple large language models achieved, but the quality of prompt words is also improved through the model's self-optimization capability, ensuring higher accuracy and stability in the subsequent problem decomposition process, and effectively reducing the risk of semantic deviation or format errors caused by improper prompt word design.
[0123] refer to Figure 5 , Figure 5This document details the workflow of the prompt generation module in this application, used to dynamically generate optimized prompts for different large language models. First, the model identifier corresponding to the currently used large language model is determined. Based on this model identifier, the prompt template library is queried to determine if a matching prompt template can be found. If a matching template exists, it is directly selected; otherwise, a default prompt template is used as an alternative to ensure the continuity and robustness of the process. After selecting a prompt template, it is populated with target source data entries (if any), the current question text, the current question context text, sub-question source data entries (if any), and sub-question related data (if any) to generate initial question decomposition prompts. By embedding specific parameters into placeholders in the template, the prompts are made targeted and context-adaptive. Subsequently, to further improve the quality and execution effect of the prompts, the large language model itself or a more powerful version of the same series is invoked to intelligently optimize the initial prompts. This can be achieved by inputting meta-instructions to request the model to enhance instruction explicitness, strengthen output format constraints, and optimize language expression logic, thereby generating the final question decomposition prompts. The generated prompts include not only question decomposition prompts, but also relationship determination prompts and question parsing prompts. These are used to guide the large language model in breaking down sub-questions, identifying relationships between sub-questions, and parsing and answering sub-questions, respectively. The combined effect of these multiple types of prompts helps ensure that subsequent tasks can be completed accurately and efficiently.
[0124] In some embodiments, the steps of performing JSON format validation and parsing on the raw output text include:
[0125] Use regular expressions to extract JSON object strings or JSON array strings from the original output text;
[0126] Call the JSON parsing function to perform syntax parsing on the extracted JSON object string or JSON array string, and obtain the corresponding syntax parsing result;
[0127] If no exceptions are thrown during the string extraction and parsing process, the JSON format verification and parsing are confirmed to be successful, and the syntax parsing result is determined to be multiple sub-problems in JSON format.
[0128] After the step of determining the result of the syntax parsing into multiple subproblems in JSON format, the following steps are also included:
[0129] Perform semantic validation on the syntax parsing results to determine whether the syntax parsing results contain the required fields and whether the field types meet the requirements;
[0130] If semantic validation is successful, output multiple sub-questions in JSON format.
[0131] Specifically, in the problem decomposition task, the large language model may output non-plain text responses containing JSON content. For example, JSON structures may be embedded in natural language descriptions, or irrelevant characters may be present 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, identifying and extracting string fragments that conform to the syntax structure of JSON objects ({...}) or JSON arrays ([...]). Regular expressions effectively capture the outermost complete JSON structure, accurately extracting the core content even if the original output text is a mixed format such as "The following is the decomposition result: {...}" or "json{...}". Subsequently, standard JSON parsing functions, such as Python's json.loads(), are called to perform syntax parsing on the extracted strings (JSON object strings or JSON array strings), converting the strings into data structures in memory. If no syntax errors are thrown during parsing (such as missing quotes, mismatched brackets, etc.), and the string extraction is successful, the JSON format verification at the syntax level is considered passed, and the parsed structured data (syntax parsing results) is used as a set of candidate sub-problems. To further ensure data availability, semantic validation is performed to check whether the syntax parsing results contain 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 specifications (e.g., id is a string or integer, and question is a non-empty string). If semantic validation passes, the structured data is confirmed to be valid, and multiple sub-questions in JSON format are output for subsequent logical relationship analysis. If any step fails, the system will trigger a retry or rewrite mechanism. JSON format validation and parsing help improve the fault tolerance for the non-deterministic output of large models, ensuring the accuracy and consistency of downstream process inputs.
[0132] In some embodiments, the step of analyzing the logical relationships between sub-problems using a large language model to determine the interdependencies between sub-problems includes:
[0133] 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;
[0134] For any pair of adjacent sub-problems, construct the corresponding relation determination prompts based on the pair of adjacent sub-problems, the current question text, the current question context text, and the relation determination prompt template;
[0135] Input the relation determination prompts corresponding to all adjacent subproblems into the large language model. Use the large language model to determine the logical relationship between adjacent subproblems, obtain the logical relationship between all adjacent subproblems, and determine the logical relationship between all adjacent subproblems as the interdependence between subproblems.
[0136] Specifically, the relation determination prompt template is a predefined structured instruction template used to guide the model to determine the logical relationship between two questions (such as parallel, comparative, causal, etc.). Adjacent sub-question pairs are two adjacent sub-questions in the question decomposition order (such as sub-question 1 and sub-question 2), used to analyze the logical relationship pair by pair. The relation determination prompt is the specific input text generated by filling the relation determination prompt template with actual parameters (adjacent sub-question pairs, current question text, and current question context text) and used to call the large language model.
[0137] As an example, see reference Figure 6 First, the model identifier corresponding to the currently used large language model is obtained. Based on the model identifier, a relation determination prompt word template matching the large language model is searched from a preset template library. The relation determination prompt word template is a structured instruction with optimized design, which can guide the model to accurately determine the logical relationship between two sub-problems. Next, for any adjacent pair of sub-problems (such as sub-problem 1 and sub-problem 2, sub-problem 2 and sub-problem 3, etc.), corresponding relation determination prompt words are constructed according to the current question text, the current question context text, and the selected relation determination prompt word template. That is, the specific content of the sub-problem pair, the current question text, and the current question context text are filled into the template to generate customized prompt words for each pair of sub-problems. Subsequently, all the constructed relation determination prompt words are concurrently input into the large language model. Each relation determination prompt word represents the logical relationship determination task of a pair of adjacent sub-problems. Based on its powerful semantic understanding and reasoning capabilities, the large language model analyzes each pair of sub-problems and outputs the logical relationship between them, such as causal relationship, parallel relationship, and sequential relationship. Finally, the logical relationship determination results of all adjacent sub-problem pairs are collected and integrated into a complete network of interdependencies between sub-problems. This network can be used to reveal the intrinsic connections between sub-problems and provides a clear structural basis for subsequent answer integration and final problem solving.
[0138] Optionally, the step of constructing relation determination prompts corresponding to adjacent sub-problem pairs based on adjacent sub-problem pairs, the current question text, the current question context text, and relation determination prompt word templates includes:
[0139] The initial relation determination prompt words are generated by filling the relation determination prompt word template based on adjacent sub-problem pairs, the current question text, and the current question context text.
[0140] The large language model is called to optimize the relation determination prompt words and generate relation determination prompt words.
[0141] In some embodiments, the step of determining the sub-problem-related data corresponding to each sub-problem includes:
[0142] Natural language preprocessing is performed on the sub-problems to obtain the second set of keywords corresponding to the sub-problems;
[0143] Feature embedding is performed on the sub-problem to obtain the second query representation vector corresponding to the sub-problem;
[0144] 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. Each question-and-answer data entry carries a vector similarity score.
[0145] Based on the second keyword set, full-text matching search is performed in the inverted index of the question and answer database to obtain the first preset number of question and answer data entries with the highest matching degree with the second keyword set. Each question and answer data entry carries a keyword matching degree score.
[0146] The comprehensive score of each question and answer data item is obtained by weighted summation of the keyword matching score and the vector similarity score of each question and answer data item. The second preset number of question and answer data items with the highest comprehensive scores are identified as sub-question related data, and the second preset number is less than the first preset number.
[0147] Specifically, the corresponding vector database of the question-and-answer database stores the vector representations of all question entries in the database. Sub-question related data consists of question-and-answer retrieval results retrieved from the database through question-and-answer data retrieval, serving as the knowledge basis for generating answers to sub-questions. (Reference) Figure 7 , Figure 7 Data related to a sub-problem provided for this application.
[0148] As an example, for each sub-problem derived from the current problem, natural language preprocessing is performed, including word segmentation, stop word removal, part-of-speech tagging, and key entity extraction, to identify the vocabulary set expressing the core semantics, forming the second keyword set corresponding to that sub-problem. Simultaneously, a pre-trained language model (such as BERT or text2vec) is used to embed features into the sub-problem text, generating a high-dimensional dense vector, i.e., the second query representation vector, to capture its deep semantic information. Subsequently, a dual-channel hybrid retrieval mechanism is initiated: On 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 question entries (a first preset number, such as 50) that are semantically most similar to the vector, and the vector similarity score (such as cosine similarity) of each matched question-and-answer data entry is recorded; on the other hand, based on the second keyword set, a full-text matching retrieval is performed in the inverted index structure corresponding to the question-and-answer database, and the keyword matching degree is calculated using algorithms such as BM25 to obtain the top K question-and-answer data entries with the highest matching degree (a first preset number, such as 50), and the vector similarity score of each question-and-answer data entry is recorded. Afterwards, the results of the two retrieval channels are fused. For each matched question-and-answer data entry, its vector similarity score and keyword matching degree score are normalized, and then weighted and summed according to preset weight coefficients (such as semantic weight 0.6, keyword weight 0.4) to obtain the comprehensive score of the question-and-answer data entry. Finally, all matched question-and-answer data entries are sorted in descending order of comprehensive score, and the N highest-scoring entries are selected as the relevant sub-question data for that sub-question (a second preset number, such as 5). The second preset number is less than the first preset number to ensure that the most relevant and high-quality question-and-answer data is selected. By integrating the advantages of semantic retrieval and keyword retrieval, the matching accuracy between sub-questions and relevant question-and-answer data in the question-and-answer database is effectively improved. This provides reliable knowledge support for the subsequent generation of accurate and credible sub-question answers by the large language model, significantly enhancing the intelligence level and response quality of this application.
[0149] In some embodiments, the step of generating answers to each sub-question based on sub-question-related data, the sub-question itself, and the context text of the current question using a large language model includes:
[0150] For each subproblem, determine the corresponding subproblem source data entry based on the subproblem;
[0151] Based on the source data entries of the sub-problem, the data related to the sub-problem, and the context text of the sub-problem and the current problem, construct the problem analysis prompt words corresponding to the sub-problem;
[0152] Input the question parsing prompts corresponding to the sub-questions into the large language model to parse and answer each sub-question, and obtain the initial output text containing the answers to the sub-questions;
[0153] Perform JSON format validation and parsing on the initial output text. If successful, obtain the answers to each sub-question in JSON format.
[0154] If the attempt fails, and the number of retries does not exceed the first preset threshold, the process returns to the step of inputting the question parsing prompts corresponding to the sub-questions into the large language model to parse and answer each sub-question.
[0155] Specifically, a sub-problem is a decomposed subtask that can be independently queried. The source data entries for a sub-problem are the original data records directly related to the sub-problem, containing the core information that supports the solution to the sub-problem.
[0156] As an example, see reference Figure 8 For each decomposed sub-question, a hybrid search is performed 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 entries. These entries guide the understanding of the sub-question, i.e., the underlying database fields or entity attributes in the knowledge graph directly related to the sub-question, which can be used to clarify the data dimensions upon which the answer depends. Subsequently, the system integrates multiple information sources to construct structured question parsing prompts. Based on the question parsing prompt template, sub-question source data entries, related data (i.e., question-answer pairs or knowledge fragments), the sub-question itself, and the current question context text are filled in to form an input instruction containing complete context and knowledge support—the question parsing prompt corresponding to the sub-question. The question parsing prompt not only guides the large language model to understand the question's intent but also provides reliable knowledge support. Next, the constructed question parsing prompt is input into the large language model, which performs reasoning and generates initial output text containing the sub-question answers. To ensure the output can be processed programmatically, strict JSON format validation and parsing are performed on the initial output text. If parsing is successful, the structured sub-question answer is confirmed, and the process proceeds to the subsequent merging process. If parsing fails (e.g., the model output is plain text or has an incorrect format), a fault tolerance mechanism is activated. Provided that the number of retries does not exceed the first preset threshold (e.g., 3 times), the original prompt word is retained or the format constraint instruction is appropriately enhanced before the large language model is called again to generate the response until the output conforms to the JSON specification or the maximum number of retries is reached.
[0157] Optionally, the step of determining the sub-problem source data entries corresponding to the sub-problem includes:
[0158] Natural language preprocessing is performed on the sub-problems to obtain the second set of keywords corresponding to the sub-problems;
[0159] Feature embedding is performed on the sub-problem to obtain the second query representation vector corresponding to the sub-problem;
[0160] Based on the second query representation vector, an approximate nearest neighbor search is performed in the 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 carries a vector similarity score.
[0161] Based on the second keyword set, a full-text matching search is performed in the 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 carries a keyword matching degree score.
[0162] The keyword matching score and vector similarity score of each source data item are weighted and summed to obtain the comprehensive score of each source data item. The second preset number of source data items with the highest comprehensive scores are determined as sub-problem source data items. The second preset number is less than the first preset number.
[0163] Optionally, the step of constructing the problem parsing hint words corresponding to the sub-problem based on the sub-problem source data entries, sub-problem related data, and the context text of the sub-problem and the current problem includes:
[0164] Determine the model identifier corresponding to the large language model, and based on the model identifier, search for the question parsing prompt word template corresponding to the large language model from the preset template library;
[0165] The problem analysis prompt word template is populated based on the sub-problem source data entries, sub-problem related data, sub-problem and current problem context text to generate initial problem analysis prompt words;
[0166] The large language model is used to optimize the initial question parsing prompts and generate question parsing prompts.
[0167] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the intelligent query method based on the large model of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0168] This application also provides an intelligent query device based on a large model; please refer to [reference needed]. Figure 9 Intelligent query devices based on large models include:
[0169] The problem decomposition module 901 is used to decompose the current problem text based on the current problem text and the current problem context text related to the current problem text, and obtain multiple corresponding sub-problems through a large language model.
[0170] The relation determination module 902 is used to analyze the logical relationships between sub-problems through a large language model and determine the interdependencies between sub-problems.
[0171] The single question parsing module 903 is used to determine the sub-question-related data corresponding to each sub-question, and generate the sub-question answers corresponding to each sub-question respectively through the large language model based on the sub-question-related data, the sub-question and the current question context text;
[0172] The answer merging module 904 is used to merge the answers to each sub-problem according to the interdependencies between sub-problems, so as to obtain the target answer corresponding to the current question text.
[0173] The intelligent query device based on a large model provided in this application, employing the intelligent query method based on a large model in the above embodiments, can solve the technical problem in the prior art where the lack of fine-grained analytical capabilities of the internal structure of the question prevents the generation of complete and accurate answers. Compared with the prior art, the beneficial effects of the intelligent query device based on a large model provided in this application are the same as those of the intelligent query method based on a large model provided in the above embodiments, and other technical features in the intelligent query device based on a large model are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0174] This application provides a large-model-based intelligent query device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to execute the large-model-based intelligent query method in Embodiment 1 above.
[0175] The following is for reference. Figure 10 This diagram illustrates a structural schematic of a large-model-based intelligent query device suitable for implementing embodiments of this application. The large-model-based intelligent query device in these embodiments may include, but is not limited to, mobile terminals such as laptops, tablets (Portable Application Description, PADs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10 The intelligent query device based on a large model shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0176] like Figure 10As shown, the large-model-based intelligent query device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. The random access memory 1004 also stores various programs and data required for the operation of the large-model-based intelligent query device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the model-based intelligent query device to communicate wirelessly or wiredly with other devices to exchange data. Although a model-based intelligent query device with various systems is shown in the figure, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.
[0177] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application 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 via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0178] The intelligent query device based on a large model provided in this application, employing the intelligent query method based on a large model in the above embodiments, can solve the technical problem in the prior art where the lack of fine-grained analytical capabilities of the internal structure of the question prevents the generation of complete and accurate answers. Compared with the prior art, the beneficial effects of the intelligent query device based on a large model provided in this application are the same as those of the intelligent query method based on a large model provided in the above embodiments, and other technical features in this intelligent query device based on a large model are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0179] It should be understood that the various parts disclosed in this application can be implemented using 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 suitable manner in one or more embodiments or examples.
[0180] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0181] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the intelligent query method based on a large model in the above embodiments.
[0182] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this 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 may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0183] The aforementioned computer-readable storage medium may be included in a large-model-based intelligent query device; or it may exist independently and not be assembled into a large-model-based intelligent query device.
[0184] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a large-model-based intelligent query device, the large-model-based intelligent query device: decomposes the current question text and its related context text using a large language model to obtain multiple sub-questions; analyzes the logical relationships between the sub-questions using the large language model to determine their interdependencies; determines the relevant data for each sub-question and generates answers for each sub-question based on the relevant data, the sub-questions, and the current question context text using the large language model; and merges the answers for each sub-question according to their interdependencies to obtain the target answer for the current question text.
[0185] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0186] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0187] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0188] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described intelligent query method based on a large model. This solves the technical problem in the prior art where the lack of fine-grained analytical capabilities regarding the internal structure of the problem prevents the generation of complete and accurate answers. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the intelligent query method based on a large model provided in the above embodiments, and will not be elaborated upon here.
[0189] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the intelligent query method based on a large model as described above.
[0190] The computer program product provided in this application can solve the technical problem in the prior art that the lack of fine-grained analysis capability of the internal structure of the problem leads to the inability to generate complete and accurate answers. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the intelligent query method based on large models provided in the above embodiments, and will not be repeated here.
[0191] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A large model-based intelligent query method, characterized in that, The intelligent query method based on a large model comprises the following steps: 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; Determine the model identifier corresponding to the large language model, and based on the model identifier, search for a relationship judgment prompt word template corresponding to the large language model from a pre-set template library; Based on the adjacent sub-question pair, the current question text and the current question context text, the relationship judgment prompt word template is filled to generate an initial relationship judgment prompt word; Call the large language model to optimize the initial relationship judgment prompt word to generate a relationship judgment prompt word; Input the relationship judgment prompt word corresponding to all adjacent sub-questions into the large language model, and determine the logical relationship between the adjacent sub-questions by the large language model to obtain the logical relationship between all adjacent sub-questions, and determine the logical relationship between all adjacent sub-questions as the mutual dependency relationship between the sub-questions; Determine the sub-question related data corresponding to each sub-question; For each sub-question, determine the sub-question source data item corresponding to the sub-question according to the sub-question; Based on the sub-question source data item, the sub-question related data, the sub-question and the current question context text, construct a question analysis prompt word corresponding to the sub-question; Input the question analysis prompt word corresponding to the sub-question into the large language model to analyze and answer each sub-question to obtain an initial output text containing a sub-question answer; Perform JSON format verification and analysis on the initial output text, if successful, obtain the JSON format of each sub-question answer; If it fails, return to execute 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, if the number of retries does not exceed a first pre-set threshold; Based on the mutual dependency relationship between the sub-questions, determine the integration order between each sub-question answer; According to the integration order, combine each sub-question answer to generate a complete answer text; Perform format verification on the complete answer text to verify whether the complete answer text conforms to the pre-defined format specification; If the format verification is passed, the complete answer text is determined as the target answer corresponding to the current question text; The step of determining the sub-question related data corresponding to each sub-question comprises: Obtain the most relevant question and answer data item as the sub-question related data. 2.The large model-based intelligent query method of claim 1, wherein, The step of decomposing the current question text into a plurality of sub-questions by a large language model based on the current question text and the current question context text related to the current question text comprises: Determine the target source data item corresponding to the current question text according to the current question text and the current question context text; constructing a question decomposition prompt word based on the target source data entry, the current question text and the current question context text, and inputting the question decomposition prompt word into the large language model to perform question decomposition on the current question text to obtain an original output text containing a plurality of sub-questions; performing JavaScript Object Notation (JSON) format verification and parsing on the original output text, and if successful, obtaining a plurality of sub-questions in JSON format; if the verification and parsing fails, and the number of retries does not exceed a first preset threshold, returning to the step of inputting the question decomposition prompt word into the large language model to perform question decomposition on the current question text; if the number of retries exceeds the first preset threshold and the number of rewrites does not exceed a second preset threshold, returning to the step of constructing a question decomposition prompt word based on the target source data entry, the current question text and the current question context text. 3.The large model-based intelligent query method of claim 2, wherein, 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 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 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 of the source data entries carrying a vector similarity score; performing full-text matching retrieval in the inverted index of the source database based on the first keyword set 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; performing 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 determining 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. 4.The large model-based intelligent query method of claim 2, wherein, The step of constructing a 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 based on the model identifier, searching for a question decomposition prompt word template corresponding to the large language model from a preset template library; 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. 5.The large model based intelligent query method of claim 1, wherein, The step of determining sub-question related data corresponding to each sub-question comprises: The sub-problem is subjected to natural language preprocessing to obtain a second keyword set corresponding to the sub-problem; The sub-problem is subjected to feature embedding to obtain a second query representation vector corresponding to the sub-problem; Based on the second query representation vector, 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 vector, each question and answer data entry carrying a vector similarity score; Based on the second keyword set, a 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 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, 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-problem related data, the second preset number being less than the first preset number.
6. A large model-based intelligent query device, characterized in that, The device 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 large model-based intelligent query method according to any one of claims 1 to 5.
7. A storage medium, characterized by The storage medium is a computer readable storage medium, and the storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the large model-based intelligent query method according to any one of claims 1 to 5.
Citation Information
Patent Citations
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