Query processing method and device, electronic equipment and storage medium
Through the post-judgment query processing solution, the processing flow is dynamically adjusted according to the query instructions and search results, which solves the problems of computing resource waste and incomplete information in the pre-judgment solution and achieves more efficient and accurate query processing.
Patent Information
- Application Number
- CN202510725693.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-12
AI Technical Summary
In the prior art, the pre-judgment scheme for user questions has the problems of wasting computing resources and incomplete information, and cannot accurately judge the complexity of the question, resulting in unnecessary multi-tasking or information omission.
A query processing solution based on post-judgment is adopted. After obtaining the query instructions and search results, it is determined whether it is necessary to continue searching or perform multi-tasking processing, and generate a final answer to avoid unnecessary waste of computing resources and information omission.
It improves the accuracy and efficiency of query processing, avoids the problem of inaccurate judgment of question complexity in the pre-judgment scheme, and ensures the accuracy of the final result and the effective use of resources.
Smart Images

Figure CN120632209A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a query processing method, device, electronic device, and storage medium. Background Art
[0002] With the rise of big model applications, many products based on online search big models have received widespread attention. In actual model use, user questions vary from simple to complex, and questions of varying complexity often require different solutions. For some more complex questions, multiple rounds of searches are often required to obtain relatively complete reference materials and generate an accurate answer. For example, if a user asks "What are the latest product prices of well-known refrigerator brands?", you may first need to search for well-known refrigerator brands, then search for the latest products of these brands, and finally search for the prices of these latest products. In contrast, for simple questions, a direct search may yield an answer. Therefore, a flexible approach is required to handle different user questions. Summary of the Invention
[0003] This summary is provided to briefly introduce concepts that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, according to one or more embodiments of the present disclosure, a query processing method is provided, comprising:
[0005] Obtaining a query instruction, and obtaining a first search result based on the query instruction;
[0006] generating candidate responses based on the first search results;
[0007] Determining whether to continue searching based on the query instruction and the first search result;
[0008] In response to determining that the search needs to continue, executing a multi-task processing process, including: generating at least two query tasks based on the query instruction, wherein the query tasks are used to obtain reference information required for generating a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on the execution results of the at least two query tasks and the query instruction;
[0009] In response to determining that there is no need to continue searching, the candidate answer is output as the final answer.
[0010] In a second aspect, according to one or more embodiments of the present disclosure, a query processing method is provided, including:
[0011] Obtaining a query instruction, and generating at least two query tasks based on the query instruction; wherein the query tasks are used to obtain reference information required to generate a reply based on the query instruction;
[0012] executing the at least two query tasks, and determining whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction;
[0013] In response to determining to perform a supplementary search, generating at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction, and executing the at least one supplementary query task;
[0014] In response to determining that no supplementary search is to be performed, a final answer is generated and output based on the execution results of the at least two query tasks and the query instruction.
[0015] In a third aspect, according to one or more embodiments of the present disclosure, a query processing apparatus is provided, comprising:
[0016] an acquiring unit, configured to acquire a query instruction and acquire a first search result based on the query instruction;
[0017] a first reply unit, configured to generate a candidate reply based on the first search result;
[0018] a determining unit, configured to determine whether to continue searching based on the query instruction and the first search result;
[0019] a multi-task processing unit, configured to, in response to determining that the search needs to continue, execute a multi-task processing process, including: generating at least two query tasks based on the query instruction, wherein the query tasks are used to obtain reference information required for generating a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on execution results of the at least two query tasks and the query instruction;
[0020] An output unit is configured to output the candidate answer as the final answer in response to determining that there is no need to continue searching.
[0021] In a fourth aspect, according to one or more embodiments of the present disclosure, a query processing apparatus is provided, comprising:
[0022] A task generating unit, configured to obtain a query instruction and generate at least two query tasks based on the query instruction; wherein the query tasks are configured to obtain reference information required for generating a reply based on the query instruction;
[0023] a task execution unit, configured to execute the at least two query tasks and determine whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction;
[0024] a supplementary task unit, configured to, in response to determining to perform a supplementary search, generate at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction, and execute the at least one supplementary query task;
[0025] A reply unit is configured to generate and output a final reply based on the execution results of the at least two query tasks and the query instruction in response to determining that no supplementary search is to be performed.
[0026] In a fifth aspect, according to one or more embodiments of the present disclosure, an electronic device is provided, comprising: at least one memory and at least one processor; wherein the memory is used to store program code, and the processor is used to call the program code stored in the memory to enable the electronic device to execute the method provided according to one or more embodiments of the present disclosure.
[0027] In a sixth aspect, according to one or more embodiments of the present disclosure, a non-transitory computer storage medium is provided, wherein the non-transitory computer storage medium stores a program code, and when the program code is executed by a computer device, the computer device executes the method provided according to one or more embodiments of the present disclosure.
[0028] According to one or more embodiments of the present disclosure, a post-judgment-based query processing solution is provided. This solution eliminates the need for pre-judgment to determine the complexity of a user's question. Instead, after obtaining search results, the solution determines whether further search is necessary based on the query instruction and search results. If so, the solution initiates a multi-tasking process to generate and output a final answer. If not, the solution directly outputs the answer generated based on the current search results. This allows for a more accurate determination of the need for multi-tasking based on the current actual search results, eliminating the need for pre-judgment of the complexity of the user's question. This mitigates the problem of inaccurate question complexity assessments in pre-judgment solutions.
[0029] According to one or more embodiments of the present disclosure, a multi-task query processing solution based on post-judgment is provided, which determines whether to perform a supplementary search based on the execution results of at least two query tasks and the query instructions, and generates and executes a supplementary query task in response to the determination to perform a supplementary search, thereby effectively avoiding information omission and ensuring the accuracy of the final result. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0031] Figure 1 A flowchart of a query processing method provided by an embodiment of the present disclosure;
[0032] Figure 2 A flowchart of a query processing method provided by another embodiment of the present disclosure;
[0033] Figure 3 A flowchart of a query processing method provided by another embodiment of the present disclosure;
[0034] Figure 4 A flowchart of a query processing method provided by another embodiment of the present disclosure;
[0035] Figure 5 A schematic diagram of the structure of a query processing device provided in one embodiment of the present disclosure;
[0036] Figure 6 A schematic diagram of the structure of a query processing device provided by another embodiment of the present disclosure;
[0037] Figure 7 The figure is a schematic structural diagram of an electronic device provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0038] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0039] It should be understood that the steps described in the embodiments of the present disclosure can be performed in a different order and / or in parallel. In addition, the embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0040] As used herein, the term "including" and its variations are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The term "responsive to" and related terms refer to a signal or event being affected to a certain extent by another signal or event, but not necessarily completely or directly. If event x occurs "responsive to" event y, then x may be directly or indirectly responsive to y. For example, the occurrence of y may ultimately lead to the occurrence of x, but there may be other intermediate events and / or conditions. In other cases, y may not necessarily lead to the occurrence of x, and x may occur even if y has not yet occurred. In addition, the term "responsive to" may also mean "at least partially responsive to".
[0041] The term "determine" broadly encompasses a variety of actions, and may include obtaining, calculating, computing, processing, deriving, investigating, searching (e.g., searching in a table, database, or other data structure), ascertaining, and similar actions, and may also include receiving (e.g., receiving information), accessing (e.g., accessing data in a memory), and similar actions, as well as parsing, selecting, choosing, establishing, and similar actions. Other terms are defined below. Other terms are defined below.
[0042] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the provisions of relevant laws and regulations.
[0043] It is understood that before using the technical solutions disclosed in each embodiment of the present disclosure, the user should be informed of the type, scope of use, and usage scenarios of the personal information involved in the present disclosure and obtain the user's authorization in an appropriate manner in accordance with relevant laws and regulations. For example, in response to receiving an active request from the user, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information, so that the user can independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operation of the technical solution of the present disclosure based on the prompt message.
[0044] As an optional but non-limiting implementation, in response to receiving a user's active request, a prompt message may be sent to the user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form. Furthermore, the pop-up window may also include a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0045] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0046] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different objects, devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these objects, devices, modules or units.
[0047] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0048] For the purposes of this disclosure, the phrase "A and / or B" means (A), (B), or (A and B).
[0049] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0050] In actual model usage, user questions can range from simple to complex, and questions of varying complexity often require different solutions. For example, complex questions often require multiple rounds of searches to obtain comprehensive reference materials and generate an accurate answer. For example, if a user asks "What are the latest prices for well-known refrigerator brands?", you might first search for well-known refrigerator brands, then search for their latest products, and finally search for the prices of these latest products. In contrast, simple questions may be answered with a direct search. Therefore, a flexible approach is required to address different user questions.
[0051] One possible solution is to pre-judge user questions and take different actions based on the judgment results. For example, after receiving a user question, the system can first classify the question, split complex questions into multiple tasks, and execute them sequentially. Finally, the final answer is generated based on the information retrieved from all tasks. For user questions judged to be simple, the system can directly perform the search and generate the answer.
[0052] However, the inventors have found that this solution of pre-judging user commands still has the following problems:
[0053] (1) For some user questions that are judged to be complex, relevant results may be retrieved directly without task splitting. If they are forcibly split into multiple tasks and executed, it will cause unnecessary waste of computing resources and delays; (2) For some user instructions that are judged to be simple, there may be cases where the search results do not fully meet the needs and multiple rounds of searches are required to answer them.
[0054] To address at least one of the above problems, the present disclosure proposes a query processing solution based on post-judgment. Figure 1 , which shows a flow chart of a query processing method 100 provided in an embodiment of the present disclosure. The method 100 includes:
[0055] Step S110: Acquire a query instruction, and acquire a first search result based on the query instruction.
[0056] In some embodiments, the query instruction includes at least one of the following: an original query instruction input by a user, and a rewritten query instruction generated based on the original query instruction.
[0057] Among them, the original query instructions include but are not limited to instructions input by the user in the form of text, voice, image, video, sensor signal or the like, and the content may include asking questions or prompt statements to guide the model to perform specific tasks. In some embodiments, a user instruction input module may be set, which is configured to receive multimodal input content, perform format conversion on inputs in different forms, and generate query data of a unified structure to facilitate semantic analysis and response generation by subsequent processing units. In some embodiments, a multimodal input interaction component may be provided, which includes a text editing box, a picture upload control, and a voice acquisition control; wherein, the text editing box is used to receive text instructions input by the user, the picture upload control supports the import and preview of image files, and the voice acquisition control can collect and convert voice signals into text format in real time.
[0058] In some embodiments, natural language processing technology can be used to perform semantic analysis on query instructions, identify core keywords, and then rewrite them through methods such as synonym expansion, entity normalization, sentence structure adjustment, and context-aware expansion to generate rewritten query instructions that are more suitable for subsequent processing.
[0059] In some embodiments, when searching based on query instructions, relevant synonyms, antonyms, hyponyms, and hyponyms can be expanded based on semantic relevance through semantic understanding of the query instructions to enrich the scope of search keywords and increase the comprehensiveness and accuracy of search results.
[0060] In some embodiments, a predefined search engine interface (Application Programming Interface, API) may be called to search the Internet, a database, or a knowledge base to obtain relevant web pages, documents, or structured data.
[0061] In some embodiments, before obtaining the first search result based on the query instruction, the model first determines whether a search is needed to obtain reference information. If it is determined to be necessary, the subsequent search process is triggered; otherwise, the search operation may not be performed, but the answer is directly generated relying on the model's own knowledge base or pre-trained knowledge.
[0062] Step S120: Generate candidate responses based on the first search results.
[0063] In some embodiments, the first search results may be filtered, sorted, and subjected to information extraction processing. This processed content is then integrated with the user's query into a contextual input generative model to generate candidate responses to the query. Filtering may be used to filter out advertisements, duplicate, or low-quality content; sorting may include sorting search results based on keyword matching, webpage authority, and timeliness; and information extraction may be used to extract paragraphs or summaries directly related to the query from the search results, rather than the entire webpage.
[0064] Step S130: Based on the query instruction and the search results, determine whether to continue searching.
[0065] In some embodiments, a large language model can be used to determine whether to continue searching based on the query instruction and the search results. After the user asks a question, natural language processing (NLP) can be used to analyze the semantic structure and information requirements of the question. After obtaining the search results returned by the search module, the large language model's probabilistic inference and contextual understanding capabilities can be used to determine whether there is an information gap between the current search results and the user's question, thereby determining whether to continue searching.
[0066] In some embodiments, step S130 and step S120 may be executed synchronously and in parallel to improve processing efficiency, and may also be executed in any order, which is not limited in the present disclosure.
[0067] Step S140: In response to determining that the search needs to continue, executing a multi-tasking process, including: generating at least two query tasks based on the query instruction, wherein the query task is used to obtain reference information required to generate a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on the execution results of the at least two query tasks and the query instruction.
[0068] In some embodiments, executing the query task includes: generating a search term based on the query instruction; obtaining a second search result based on the search term; and analyzing the second search result to obtain the reference information. In some embodiments, the reference information includes content directly extracted from the search results (e.g., webpage content), or a summary or abstract generated based on the extracted content.
[0069] In some embodiments, the query instruction can be disassembled and rewritten to obtain at least one search term. For example, natural language processing technology can be used to perform semantic analysis on the query instruction to identify core keywords and expand related synonyms, antonyms, hyponyms, and hyponyms based on semantic relevance to generate the search term.
[0070] In some embodiments, the results can be preliminarily screened based on factors such as the source reliability, release time, and relevance of the second search results to remove obviously irrelevant, outdated, or unreliable content. The search results are then analyzed using natural language processing technology, including word segmentation, part-of-speech tagging, syntactic analysis, semantic understanding, logical reasoning and operations, to generate the reference information.
[0071] In some embodiments, the execution results of the at least two query tasks and the query instruction may be input into a large language model to generate and output a final answer.
[0072] Step S150: In response to determining that there is no need to continue searching, outputting the candidate answer as the final answer.
[0073] According to one or more embodiments of the present disclosure, a query processing solution based on post-judgment is provided. This solution does not require a pre-judgment to determine whether the user's question is complex or not. Instead, after obtaining the search results, it determines whether it is necessary to continue searching based on the query instruction and the search results. If so, it initiates a multi-task processing process to generate and output the final answer. If not, it directly outputs the answer generated based on the current search results. In this way, it is possible to more accurately determine whether multi-task processing is necessary based on the current actual search results, without the need for a pre-judgment of whether the user's question is complex or not, thereby compensating for the problem of inaccurate judgment of question complexity in the pre-judgment solution. For example, for questions that are likely to be classified as "complex" by the pre-judgment, but in fact relevant results can be directly retrieved without task splitting, the post-judgment of the present application can avoid initiating multi-task processing, thereby avoiding wasting unnecessary computing resources and delays. Conversely, for questions that are likely to be classified as "simple" by the pre-judgment, but in fact require multi-task processing to properly answer, the post-judgment of the present application can more accurately initiate a multi-task processing process.
[0074] In some embodiments, the at least two query tasks include a first query task and a second query task; wherein, if the second query task depends on the first query task, then when executing the second query task, generating search terms according to the query instruction includes: generating search terms for the second query task based on the query instruction and the execution result of the first query task.
[0075] For example, assuming the user's question is "Which companies will exceed the sum of the revenue of Company A and Company B in 2023?", the first query task can be described as "Query the revenue of Company A and Company B in 2023"; the second query task can be described as "Query the companies whose revenue in 2023 exceeds the sum of the revenue of Company A and Company B", and the second query task depends on the first query task. In the actual execution of the first query task, the user's question must first be split into two search terms: "Company A's revenue in 2023" and "Company B's revenue in 2023", and the search results are obtained by parallel search. The search results are analyzed to generate reference information corresponding to the first query task. Then the second query task is executed. Based on the user's question and the execution results of the first query task, a new search term "Which companies will have revenue exceeding X million yuan in 2023" is obtained, and the search results are analyzed to generate reference information corresponding to the second query task.
[0076] In some embodiments, the generating of at least two query tasks includes: generating a task list including the at least two query tasks, the task list including dependency information describing each query task and other query tasks; and executing the at least two query tasks includes: executing the at least two query tasks based on the dependency information.
[0077] In some embodiments, each query task in the task list is associated with the following information: task identification information, task subject information, search tool information, and dependency information.
[0078] The task identification information is used to distinguish different tasks in the system to facilitate management and calling. In some specific implementations, the task identification information can be a unique identifier.
[0079] The task subject information is used to describe the subject or content of the query task. For example, it may be “search for the price of XX”.
[0080] Search tool information is used to describe the search tool relied upon for task execution. This search tool can be a general search engine or a tool specifically used within the enterprise for data query or information retrieval in a specific field.
[0081] Dependency information describes the dependencies between the current query task and other tasks. In some embodiments, if the value corresponding to the dependency information for a query task is empty, it indicates that the task has no dependencies and can be executed independently. If the value of the dependency information for a query task is the task identifier of another task, it indicates that the execution of the query task depends on the execution of the other task.
[0082] In this embodiment, by making the task association information include dependency information, the dependencies between the query tasks form a directed acyclic graph (DAG) structure. Tasks without dependencies can be executed in parallel, while tasks with dependencies are executed in the order of dependencies. In this way, the task execution efficiency can be maximized and the accuracy of the final result can be ensured.
[0083] In some embodiments, generating at least two query tasks based on the query instruction includes: generating at least two query tasks based on the query instruction and the search results; generating and outputting a final response based on the execution results of the at least two query tasks and the query instruction includes: generating and outputting a final response based on the execution results of the at least two query tasks and the first search results. In this embodiment, by generating at least two query tasks based on the query instruction and the currently obtained first search result, the generated query tasks do not duplicate the search content corresponding to the first search result, thereby avoiding duplicate searches and improving the efficiency of obtaining reference information.
[0084] refer to Figure 2 , which shows a flow chart of a query processing method 200 provided in an embodiment of the present disclosure. The method 200 includes:
[0085] Step S210: Obtain a query instruction, and generate at least two query tasks based on the query instruction, wherein the query tasks are used to obtain reference information required for generating a reply based on the query instruction.
[0086] In some embodiments, the query instruction includes at least one of the following: an original query instruction input by a user, and a rewritten query instruction generated based on the original query instruction.
[0087] Among them, the original query instructions include but are not limited to instructions input by the user in the form of text, voice, image, video, sensor signal or the like, and the content may include asking questions or prompt statements to guide the model to perform specific tasks. In some embodiments, a user instruction input module may be set, which is configured to receive multimodal input content, perform format conversion on inputs in different forms, and generate query data of a unified structure to facilitate semantic analysis and response generation by subsequent processing units. In some embodiments, a multimodal input interaction component may be provided, which includes a text editing box, a picture upload control, and a voice acquisition control; wherein, the text editing box is used to receive text instructions input by the user, the picture upload control supports the import and preview of image files, and the voice acquisition control can collect and convert voice signals into text format in real time.
[0088] In some embodiments, natural language processing technology can be used to perform semantic analysis on query instructions, identify core keywords, and then rewrite them through methods such as synonym expansion, entity normalization, sentence structure adjustment, and context-aware expansion to generate rewritten query instructions that are more suitable for subsequent processing.
[0089] In some embodiments, when searching based on query instructions, relevant synonyms, antonyms, hyponyms, and hyponyms can be expanded based on semantic relevance through semantic understanding of the query instructions to enrich the scope of search keywords and increase the comprehensiveness and accuracy of search results.
[0090] In some embodiments, a predefined search engine API may be called to search the Internet, a database, or a knowledge base to obtain relevant web pages, documents, or structured data.
[0091] In some embodiments, before generating at least two query tasks based on the query instruction, the model first determines whether a search is needed to obtain relevant information. If it is determined to be necessary, the subsequent multi-task process is triggered; otherwise, the search operation may not be performed, but the answer is directly generated relying on the model's own knowledge base or training knowledge.
[0092] Step S220: executing the at least two query tasks, and determining whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction.
[0093] Step S230: In response to determining to perform a supplementary search, generating at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction, and executing the at least one supplementary query task.
[0094] Step S240: In response to determining that no supplementary search is to be performed, a final reply is generated and output based on the execution results of the at least two query tasks and the query instruction.
[0095] In some embodiments, executing the query task includes: generating search terms based on the query instruction; obtaining search results based on the search terms; and analyzing the search results to obtain the reference information. In some embodiments, the reference information includes content directly extracted from the search results (e.g., webpage content), or a summary or abstract generated based on the extracted content.
[0096] In some embodiments, the execution results of at least two query tasks and the query instructions can be input into a large language model. The model analyzes the semantic structure and information requirements of the question through natural language processing (NLP) to determine whether there is an information gap between the currently obtained reference information and the user question. If so, at least one supplementary query task is generated. Otherwise, the answer can be directly output.
[0097] According to one or more embodiments of the present disclosure, a multi-task query processing solution based on post-judgment is provided, which determines whether to perform a supplementary search based on the execution results of at least two query tasks and the query instructions, and generates and executes a supplementary query task in response to the determination to perform a supplementary search, thereby effectively avoiding information omission and ensuring the accuracy of the final result.
[0098] In some embodiments, generating at least one supplementary query task includes generating a supplementary task list including the at least one supplementary query task, the supplementary task list including dependency information describing each query task with other query tasks; and executing the at least two query tasks includes executing the at least one query task based on the dependency information. In some embodiments, each supplementary query task in the supplementary task list is associated with the following information: task identification information, task subject information, search tool information, and dependency information. For relevant details, please refer to the aforementioned embodiments and will not be repeated here.
[0099] refer to Figure 3, which shows a flow chart of a query processing method provided by another embodiment of the present disclosure. Receive the user's query instruction and input it into the task planning module. If the task planning module determines that there is no need to search for reference information, it can directly generate an answer. Otherwise, the task planning module decomposes the complex problem into a series of executable task sequences, determines the dependencies and execution order between tasks, and outputs an ordered, executable task list. Each query task is executed based on the dependencies between tasks, including: generating search terms based on the query instruction, calling the search engine API to search based on the search term, and analyzing the search results to generate reference information. The execution result of each task is input into the language model together with the user's query instruction. The language model determines whether a supplementary search is needed. If so, at least one supplementary query task is generated. Otherwise, the final answer can be directly output.
[0100] refer to Figure 4 , which shows a flow chart of a query processing method provided by another embodiment of the present disclosure. The original query instruction input by the user is received and input into the rewriting model to generate a rewritten query instruction, and the predefined search engine API is called based on the rewritten query instruction to perform a search, and the search results are sent to the answer generation module and the continued retrieval module at the same time. Among them, the answer generation module is used to generate candidate replies based on the user's original query instruction, rewritten query instruction, context information and search results; the continued retrieval module is used to determine whether it is necessary to continue searching based on the user's original query instruction, rewritten query instruction, context information and search results. If it is determined that there is no need to continue searching, the candidate reply generated by the answer generation module is output as the final reply (i.e., "final reply A"). If it is determined that it is necessary to continue searching, the original query instruction, rewritten query instruction and search results are input into the task planning module. If the task planning module determines that there is no need to search for reference information, it can directly generate an answer. Otherwise, the task planning module decomposes the complex problem into a series of executable task sequences, determines the dependencies and execution order between tasks, and outputs an ordered, executable task list. Each query task is executed based on the dependencies between tasks, including: generating search terms based on the query instructions, calling the search engine API based on the search terms, and analyzing the search results to generate reference information. The execution results of each task, along with the user's query instructions, are input into the language model. The language model determines whether a supplementary search is required. If so, at least one supplementary query task is generated. Otherwise, the final answer is directly output.
[0101] In some embodiments, the task planning module, the answer generation module, and the continued retrieval module may all include a large language model (LLM). The large language model learns the inherent statistical laws and semantic representations of the text, adopts a self-attention mechanism to achieve context-aware dynamic encoding of word vectors, and uses multi-layer stacked decoder and encoder modules to build deep semantic understanding capabilities. By pre-training on large-scale data sets, the large language model has acquired powerful general modeling and generalization capabilities. After training, the model undergoes instruction fine-tuning (Instruction Tuning) and human feedback reinforcement learning (RLHF), and can handle various natural language processing tasks, including but not limited to text generation, question-answering systems, logical reasoning, semantic parsing, etc.
[0102] Accordingly, reference Figure 5 According to an embodiment of the present disclosure, a query processing device 500 is provided, comprising:
[0103] An acquiring unit 501 is configured to acquire a query instruction and acquire a first search result based on the query instruction;
[0104] A first reply unit 502, configured to generate a candidate reply based on the first search result;
[0105] A determining unit 503 is configured to determine whether to continue searching based on the query instruction and the first search result;
[0106] The multi-task processing unit 504 is configured to, in response to determining that the search needs to continue, execute a multi-task processing process, including: generating at least two query tasks based on the query instruction, wherein the query tasks are used to obtain reference information required for generating a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on the execution results of the at least two query tasks and the query instruction;
[0107] The output unit 505 is configured to output the candidate answer as the final answer in response to determining that there is no need to continue searching.
[0108] In some embodiments, the multi-tasking processing unit 504 includes:
[0109] A search term generating subunit, configured to generate a search term according to the query instruction;
[0110] a search result obtaining subunit, configured to obtain a second search result based on the search term;
[0111] The analyzing subunit is configured to analyze the second search result to obtain the reference information.
[0112] In some embodiments, the at least two query tasks include a first query task and a second query task; wherein, if the second query task depends on the first query task, then when executing the second query task, generating search terms according to the query instruction includes: generating search terms for the second query task based on the query instruction and the execution result of the first query task.
[0113] In some embodiments, the query instruction includes at least one of the following: an original query instruction input by a user, and a rewritten query instruction generated based on the original query instruction.
[0114] In some embodiments, the generating of at least two query tasks based on the query instruction includes: generating at least two query tasks based on the query instruction and the first search result; the generating of a final reply based on the execution results of the at least two query tasks and the query instruction includes: generating a final reply based on the execution results of the at least two query tasks, the query instruction and the first search result.
[0115] In some embodiments, the generating of at least two query tasks includes: generating a task list including the at least two query tasks, the task list including dependency information describing each query task and other query tasks; and executing the at least two query tasks includes: executing the at least two query tasks based on the dependency information.
[0116] Accordingly, reference Figure 6 According to an embodiment of the present disclosure, a query processing device 600 is provided, comprising:
[0117] The task generation unit 601 is configured to obtain a query instruction and generate at least two query tasks based on the query instruction; wherein the query tasks are configured to obtain reference information required for generating a reply based on the query instruction;
[0118] A task execution unit 602 is configured to execute the at least two query tasks and determine whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction;
[0119] A supplementary task unit 603 is configured to, in response to determining to perform a supplementary search, generate at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction, and execute the at least one supplementary query task;
[0120] The reply unit 604 is configured to generate and output a final reply based on the execution results of the at least two query tasks and the query instruction in response to determining that no supplementary search is to be performed.
[0121] In some embodiments, the generating of at least two query tasks includes: generating a task list including the at least two query tasks, the task list including dependency information describing each query task and other query tasks; and executing the at least two query tasks includes: executing the at least two query tasks based on the dependency information.
[0122] For the embodiments of the device, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, and the modules described as separation modules may or may not be separate. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art can understand and implement it without paying any creative work.
[0123] Accordingly, according to one or more embodiments of the present disclosure, there is provided an electronic device, including:
[0124] at least one memory and at least one processor;
[0125] The memory is used to store program codes, and the processor is used to call the program codes stored in the memory to enable the electronic device to execute the query processing method provided according to one or more embodiments of the present disclosure.
[0126] Accordingly, according to one or more embodiments of the present disclosure, a non-transitory computer storage medium is provided, which stores program code, and the program code can be executed by a computer device to enable the computer device to perform the query processing method provided according to one or more embodiments of the present disclosure.
[0127] Reference below Figure 7 , which shows a schematic diagram of the structure of an electronic device (such as a terminal device or server) 800 suitable for implementing the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include but is not limited to terminal devices such as extended reality devices (such as head-mounted displays), mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), digital TVs, desktop computers, etc. It should be noted that Figure 7 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0128] like Figure 7As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. Various programs and data required for the operation of the electronic device 800 are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0129] Typically, the following devices may be connected to the I / O interface 805: an input device 806 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0130] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0131] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable 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.
[0132] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0133] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0134] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method of the present disclosure.
[0135] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0136] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0137] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0138] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0139] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0140] According to one or more embodiments of the present disclosure, a query processing method is provided, including: obtaining a query instruction, and obtaining a first search result based on the query instruction; generating a candidate reply based on the first search result; determining whether it is necessary to continue searching based on the query instruction and the first search result; in response to determining that it is necessary to continue searching, executing a multi-task processing process, including: generating at least two query tasks based on the query instruction, wherein the query task is used to obtain reference information required to generate a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on the execution results of the at least two query tasks and the query instruction; in response to determining that it is not necessary to continue searching, outputting the candidate reply as the final reply.
[0141] According to one or more embodiments of the present disclosure, executing the query task includes: generating a search term according to the query instruction; obtaining a second search result based on the search term; and analyzing the second search result to obtain the reference information.
[0142] According to one or more embodiments of the present disclosure, the at least two query tasks include a first query task and a second query task; wherein, if the second query task depends on the first query task, then when executing the second query task, generating search terms according to the query instruction includes: generating search terms for the second query task based on the query instruction and the execution result of the first query task.
[0143] According to one or more embodiments of the present disclosure, the query instruction includes at least one of the following: an original query instruction input by a user, and a rewritten query instruction generated based on the original query instruction.
[0144] According to one or more embodiments of the present disclosure, the generating of at least two query tasks based on the query instruction includes: generating at least two query tasks based on the query instruction and the first search result; the generating of a final reply based on the execution results of the at least two query tasks and the query instruction includes: generating a final reply based on the execution results of the at least two query tasks, the query instruction and the first search result.
[0145] According to one or more embodiments of the present disclosure, the generating of at least two query tasks includes: generating a task list including the at least two query tasks, the task list including dependency information for describing each query task and other query tasks; and executing the at least two query tasks includes: executing the at least two query tasks based on the dependency information.
[0146] According to one or more embodiments of the present disclosure, according to a query processing method, the method includes: obtaining a query instruction, and generating at least two query tasks based on the query instruction; wherein the query task is used to obtain reference information required to generate a reply based on the query instruction; executing the at least two query tasks, and determining whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction; in response to determining to perform a supplementary search, generating at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction, and executing the at least one supplementary query task; in response to determining not to perform a supplementary search, generating and outputting a final reply based on the execution results of the at least two query tasks and the query instruction.
[0147] According to one or more embodiments of the present disclosure, the generating of at least two query tasks includes: generating a task list including the at least two query tasks, the task list including dependency information for describing each query task and other query tasks; and executing the at least two query tasks includes: executing the at least two query tasks based on the dependency information.
[0148] According to one or more embodiments of the present disclosure, a query processing device is provided, including: an acquisition unit for acquiring a query instruction and acquiring a first search result based on the query instruction; a first reply unit for generating a candidate reply based on the first search result; a determination unit for determining whether it is necessary to continue searching based on the query instruction and the first search result; a multi-task processing unit for executing a multi-task processing process in response to determining that it is necessary to continue searching, including: generating at least two query tasks based on the query instruction, wherein the query tasks are used to acquire reference information required for generating a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on the execution results of the at least two query tasks and the query instruction; an output unit for outputting the candidate reply as the final reply in response to determining that it is not necessary to continue searching.
[0149] According to one or more embodiments of the present disclosure, a query processing device is provided, including: a task generation unit, used to obtain a query instruction, and generate at least two query tasks based on the query instruction; wherein the query task is used to obtain reference information required to generate a reply based on the query instruction; a task execution unit, used to execute the at least two query tasks, and determine whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction; a supplementary task unit, used to generate at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction in response to determining to perform a supplementary search, and execute the at least one supplementary query task; a reply unit, used to generate and output a final reply based on the execution results of the at least two query tasks and the query instruction in response to determining not to perform a supplementary search.
[0150] According to one or more embodiments of the present disclosure, an electronic device is provided, comprising: at least one memory and at least one processor; wherein the memory is used to store program code, and the processor is used to call the program code stored in the memory to enable the electronic device to execute the query processing method provided according to one or more embodiments of the present disclosure.
[0151] According to one or more embodiments of the present disclosure, a non-transitory computer storage medium is provided, wherein the non-transitory computer storage medium stores program code, and when the program code is executed by a computer device, the computer device executes the query processing method provided according to one or more embodiments of the present disclosure.
[0152] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0153] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0154] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A query processing method, characterized in that: include: Obtaining a query instruction, and obtaining a first search result based on the query instruction; generating candidate responses based on the first search results; Determining whether to continue searching based on the query instruction and the first search result; In response to determining that the search needs to continue, executing a multi-task processing process, including: generating at least two query tasks based on the query instruction, wherein the query tasks are used to obtain reference information required for generating a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on the execution results of the at least two query tasks and the query instruction; In response to determining that there is no need to continue searching, the candidate answer is output as the final answer.
2. The method according to claim 1, characterized in that Executing the query task includes: generating a search term according to the query instruction; Obtaining a second search result based on the search term; The second search result is analyzed to obtain the reference information.
3. The method according to claim 2, characterized in that The at least two query tasks include a first query task and a second query task; Among them, if the second query task depends on the first query task, then when executing the second query task, generating search terms according to the query instruction includes: generating search terms for the second query task based on the query instruction and the execution result of the first query task.
4. The method according to claim 1, wherein The query instruction includes at least one of the following: The original query instruction input by the user and the rewritten query instruction generated based on the original query instruction.
5. The method according to claim 1, wherein Generating at least two query tasks based on the query instruction includes: generating at least two query tasks based on the query instruction and the first search result; The generating a final reply based on the execution results of the at least two query tasks and the query instruction includes: generating a final reply based on the execution results of the at least two query tasks, the query instruction and the first search result.
6. The method according to claim 1, wherein Generating at least two query tasks includes: generating a task list including the at least two query tasks, wherein the task list includes information describing dependency relationships between each query task and other query tasks; The executing the at least two query tasks includes: executing the at least two query tasks based on the dependency information.
7. A query processing method, characterized in that: include: Obtaining a query instruction, and generating at least two query tasks based on the query instruction; wherein the query tasks are used to obtain reference information required to generate a reply based on the query instruction; executing the at least two query tasks, and determining whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction; In response to determining to perform a supplementary search, generating at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction, and executing the at least one supplementary query task; In response to determining that no supplementary search is to be performed, a final answer is generated and output based on the execution results of the at least two query tasks and the query instruction.
8. The method according to claim 7, characterized in that Generating at least two query tasks includes: generating a task list including the at least two query tasks, wherein the task list includes information describing dependency relationships between each query task and other query tasks; The executing the at least two query tasks includes: executing the at least two query tasks based on the dependency information.
9. A query processing device, characterized in that: include: an acquiring unit, configured to acquire a query instruction and acquire a first search result based on the query instruction; a first reply unit, configured to generate a candidate reply based on the first search result; a determining unit, configured to determine whether to continue searching based on the query instruction and the first search result; a multi-task processing unit, configured to, in response to determining that the search needs to continue, execute a multi-task processing process, including: generating at least two query tasks based on the query instruction, wherein the query tasks are used to obtain reference information required for generating a reply based on the query instruction; executing the at least two query tasks, and generating and outputting a final reply based on execution results of the at least two query tasks and the query instruction; An output unit is configured to output the candidate answer as the final answer in response to determining that there is no need to continue searching.
10. A query processing device, characterized in that: include: A task generating unit, configured to obtain a query instruction and generate at least two query tasks based on the query instruction; wherein the query tasks are configured to obtain reference information required for generating a reply based on the query instruction; a task execution unit, configured to execute the at least two query tasks and determine whether to perform a supplementary search based on the execution results of the at least two query tasks and the query instruction; a supplementary task unit, configured to, in response to determining to perform a supplementary search, generate at least one supplementary query task based on the execution results of the at least two query tasks and the query instruction, and execute the at least one supplementary query task; A reply unit is configured to generate and output a final reply based on the execution results of the at least two query tasks and the query instruction in response to determining that no supplementary search is to be performed.
11. An electronic device, characterized in that: include: at least one memory and at least one processor; The memory is used to store program codes, and the processor is used to call the program codes stored in the memory to enable the electronic device to execute the method according to any one of claims 1 to 8.
12. A non-transitory computer storage medium, characterized in that The non-transitory computer storage medium stores a program code, and when the program code is executed by a computer device, the computer device executes the method according to any one of claims 1 to 8.
Citation Information
Cited By
Natural language number checking method and device and electronic equipment
CN121350071A
Natural language search method, device and electronic equipment
CN121350071B
Parallel query optimization method and device based on reinforcement learning, equipment and readable storage medium
CN121579529A
Deep search method and device, equipment, medium and product
CN121880493A