Problem processing method and device based on large model, electronic equipment and storage medium

By executing the reply generation and display process in parallel, the problem of reply delay of large language models in complex problem scenarios is solved, efficiency and effect are improved, and model capabilities are fully utilized.

CN118643140APending Publication Date: 2024-09-13BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Application Number
CN202410805322.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

In complex problem scenarios, the response delay of large language models is high, and the model capabilities cannot be fully utilized, resulting in low efficiency.

Method used

By obtaining the pending questions and prompt information, input them into the large model, the output includes reply statements and tool call information, call the corresponding tools, further input the model to generate complete reply statements, and use a separate scheduler to execute the reply generation process and display process in parallel .

Benefits of technology

It effectively reduces the delay in response generation, improves the efficiency and effectiveness of question responses, and fully utilizes the capabilities of large models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643140A
    Figure CN118643140A
Patent Text Reader

Abstract

The invention provides a problem processing method and device based on a large model, electronic equipment and a storage medium, relates to the technical field of artificial intelligence, in particular to the fields of natural language processing, large models, deep learning and the like, and can be applied to scenes such as intelligent customer service, vehicle-mounted interaction and agents. According to the specific scheme, the method comprises the steps of obtaining a to-be-processed first question and first prompt information corresponding to the first question, inputting the first question and the first prompt information into a large model to obtain a first result output by the large model, and outputting a first reply statement under the condition that the first result contains the first reply statement and first tool calling information, and calling the corresponding first tool based on the first tool calling information to obtain a second result output by the first tool, inputting the second result into the large model to obtain a third result output by the large model, and outputting the second reply statement under the condition that the third result only contains the second reply statement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, in particular to the field of artificial intelligence technology such as natural language processing and deep learning, and specifically to a problem processing method, device, electronic device and storage medium based on a large model. Background Art

[0002] Currently, large language models perform well in processing and generating text. However, in complex problem scenarios, large language models are usually required in combination with tool systems for processing.

[0003] In the related art, a large language model is usually used as a router or controller, and different expert models or tools are called through the large language model for processing to obtain the final answer.

[0004] In this way, in complex problem scenarios, the delay in answering questions is high, which affects the efficiency of answering complex questions, and the performance of the large model is not fully utilized, wasting the model's capabilities. Summary of the invention

[0005] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.

[0006] The first embodiment of the present disclosure proposes a problem processing method based on a large model, including:

[0007] Obtaining a first question to be processed and first prompt information corresponding to the first question;

[0008] Inputting the first question and the first prompt information into the large model to obtain a first result output by the large model;

[0009] When the first result includes the first reply statement and the first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain the second result output by the first tool;

[0010] Input the second result into the large model to obtain a third result output by the large model;

[0011] In a case where only the second reply sentence is included in the third result, the second reply sentence is output.

[0012] The second aspect of the present disclosure provides a problem processing device based on a large model, including:

[0013] A first acquisition module, used to acquire a first question to be processed and first prompt information corresponding to the first question;

[0014] A first input module, used to input a first question and a first prompt information into the large model to obtain a first result output by the large model;

[0015] A processing module, configured to output the first reply statement when the first result includes the first reply statement and the first tool calling information, and to call the corresponding first tool based on the first tool calling information to obtain a second result output by the first tool;

[0016] A second input module is used to input the second result into the large model to obtain a third result output by the large model;

[0017] The first output module is used to output the second reply statement when the third result only includes the second reply statement.

[0018] The third aspect of the present disclosure proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the large model-based problem processing method proposed in the first aspect of the present disclosure is implemented.

[0019] The fourth aspect of the present disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the large model-based problem processing method provided in the first aspect of the present disclosure is implemented.

[0020] The fifth aspect of the present disclosure provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the large model-based problem processing method as provided in the first aspect of the present disclosure.

[0021] The problem processing method, device, electronic device and storage medium based on the large model provided by the present disclosure have the following beneficial effects:

[0022] In the disclosed embodiment, firstly, a first question to be processed and first prompt information corresponding to the first question are obtained, and the first question and the first prompt information are input into the big model to obtain a first result output by the big model. When the first result includes a first reply statement and first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain a second result output by the first tool, and the second result is input into the big model to obtain a third result output by the big model. When the third result includes only the second reply statement, the second reply statement is output, thereby setting a separate scheduler for scheduling the corresponding tool according to the output of the big model, and executing the reply generation process and the display process in parallel, thereby making full use of the capabilities of the big model, effectively reducing the delay in reply generation, and effectively improving the efficiency and effect of question replying.

[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0025] Figure 1 A flowchart of a problem processing method based on a large model provided by an embodiment of the present disclosure;

[0026] Figure 2 A flowchart of a problem processing method based on a large model provided by an embodiment of the present disclosure;

[0027] Figure 3 A flowchart of a problem processing method based on a large model provided by an embodiment of the present disclosure;

[0028] Figure 4 A flowchart of a problem processing method based on a large model provided by an embodiment of the present disclosure;

[0029] Figure 5 A schematic diagram of a model framework structure provided by an embodiment of the present disclosure;

[0030] Figure 6 A schematic diagram of the structure of a problem processing device based on a large model provided in an embodiment of the present disclosure;

[0031] Figure 7 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0032] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0033] The present disclosure relates to artificial intelligence technology fields such as natural language processing, large models, and deep learning, and can be applied to scenarios such as intelligent customer service, in-vehicle interaction, and intelligent agents.

[0034] Artificial Intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.

[0035] Natural Language Processing (NLP) is a field of computer science, artificial intelligence, and linguistics that focuses on the interaction between computers and human (natural) language. It uses computer technology to analyze, understand, and process natural language, using computers as language research tools, conducting quantitative research and processing of language information with the support of computers, and providing language descriptions that can be used by both humans and computers.

[0036] Big model, big language model refers to a deep learning model trained with a large amount of text data. It can generate natural language text or understand the meaning of language text. Big language model can handle a variety of natural language tasks, such as text classification, question and answer, dialogue, etc. It is an important path to artificial intelligence.

[0037] Deep learning is the process of learning the inherent laws and representation levels of sample data. The information obtained in the learning process is of great help in interpreting data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have analytical learning capabilities like humans and to be able to recognize data such as text, images, and sounds.

[0038] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0039] The following describes the problem processing method, device, electronic device and storage medium based on a large model according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0040] Figure 1 A flowchart of a large model-based problem processing method provided in an embodiment of the present disclosure.

[0041] like Figure 1 As shown, the problem-solving method based on the large model may include the following steps:

[0042] Step 101: Obtain a first question to be processed and first prompt information corresponding to the first question.

[0043] Among them, the first question refers to the question asked by the user to the Large Language Models (LLMs), which can be a question asked in a more complex scenario, such as questions about real-time weather inquiries, questions about the accurate results of mathematical problems, and questions in restaurant ordering scenarios, etc., or it can also be some simple text question-and-answer questions without any restrictions.

[0044] The first prompt information refers to the question prompt word set for the large language model to answer the first question. Different types of first questions will have different first prompt information.

[0045] In the present disclosure, a first question to be processed and first prompt information corresponding to the first question are obtained. The question input by the user to the platform or system where the large language model is located can be obtained as the first question to be processed. After the large language model obtains the first question, a corresponding task prompt word can be assigned to the first question according to the task type to which the first question belongs, and the task prompt word can be used as the first prompt information.

[0046] It should be noted that the method for obtaining the first question to be processed may also be any other possible method such as the user's historical questions, and the method for obtaining the first prompt information may also be any other possible method such as manual selection, and there is no limitation on this.

[0047] Step 102: input the first question and the first prompt information into the large model to obtain the first result output by the large model.

[0048] Among them, the first result refers to the answer result output by the big model after the big model processes the first question and the first prompt information.

[0049] It should be noted that, in the scenario where the first question is a complex question, the first result output by the large model may include a partial answer to the first question, and the other part may be data information used to call other tools; or, when the first question is a simple question, the first result may also be a complete answer to the first question.

[0050] After obtaining the first question to be processed and the first prompt information corresponding to the first question, the present invention can input the first question and the first prompt information into the large model to obtain the first result output by the large model.

[0051] In the present disclosure, the first question and the first prompt information are input into the big model, and a series of processing processes such as vectorization processing, knowledge retrieval and text generation are performed inside the big model to obtain a preliminary output result about the first question. The preliminary output result can be used as the first result output by the big model. The first result can include a partial answer to the first question, or can also be a complete answer to the first question, without limitation.

[0052] Step 103, when the first result includes the first reply statement and the first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain the second result output by the first tool.

[0053] The first reply statement refers to a partial reply to the first question. The first reply statement can be directly output and displayed to the user. The first reply statement is not a complete reply to the first question.

[0054] The first tool calling information refers to data information that can be used to call processing tools outside the large model.

[0055] The first tool refers to an auxiliary processing tool that can be used to handle different types of specific problems. The first tool can be, for example, any other tool such as a code executor and an expert processing model, and there is no limitation on this.

[0056] It should be noted that, taking the first tool as a code executor as an example, the first tool call information in the first result output by the large model can be a special marker, for example, separator + code + terminator, then the controller can extract the code between the separator and the terminator as input and input it into the code executor.

[0057] For example, when the first tool to be called is a query tool, the first tool calling information may be a data query statement.

[0058] The second result refers to the execution result of the first tool obtained after calling the first tool to execute the corresponding task of the first problem.

[0059] For example, when the first question input by the user is "There are chickens and rabbits in the same cage. There are 20 heads and 56 legs in total. How many chickens and rabbits are there?", the first question can be used as a more complex data calculation problem. The first result output by the large model after processing the first question and the first prompt information can include a first answer statement and a first tool calling information. The first answer statement can be "This is a classic chicken and rabbit problem. We have a cage with chickens and rabbits in it. We know that there are 20 heads and 56 legs in total." The first answer statement can be directly output and displayed to the user. The first tool calling information can be used to call the first tool (in this first question scenario, the first tool can be a code executor). The first tool executes the corresponding task for the first question to obtain the execution result of the first tool. The execution result can be used as the second result, and the second result can assist in generating further answers for the large model.

[0060] It should be noted that outputting the first reply statement to the user and calling the corresponding first tool based on the first tool calling information are performed simultaneously, thereby effectively reducing the delay in answering questions.

[0061] Step 104, input the second result into the large model to obtain a third result output by the large model.

[0062] The third result refers to the model output result obtained after the large model performs further response generation processing based on the second result.

[0063] In the present disclosure, the second result is input into the big model for processing. The second result may include the historical output result information of the big model and the output information of the first tool. The big model further processes the second result so that the big language model obtains the answer to the next question. The big model outputs the answer to the next question as the third result.

[0064] It should be noted that the third result may not provide a complete answer to the first question. In this case, the third result may include tool calling information for further calling the tool to continue answering the question. The further used tool may be the same as the first tool or may be different from the first tool. It is adaptively selected according to the actual application scenario and there is no restriction on this. Alternatively, the third result may include a completed answer statement to the first question and there is no restriction on this.

[0065] Step 105: When the third result only includes the second reply statement, output the second reply statement.

[0066] In the present disclosure, when the third result only contains the second reply statement and does not contain tool call information, it indicates that the generation of the reply statement to the first question has been completed, and the second reply statement is a complete reply statement to the first question, then the second reply statement is output and the second reply statement is output to the user.

[0067] For example, as mentioned above, "There are chickens and rabbits in the same cage. There are 20 heads and 56 legs in total. How many chickens and rabbits are there?" is the first question, and the second answer sentence can be "There are 12 chickens and 8 rabbits in the cage."

[0068] In the disclosed embodiment, firstly, a first question to be processed and first prompt information corresponding to the first question are obtained, and the first question and the first prompt information are input into the big model to obtain a first result output by the big model. When the first result includes a first reply statement and first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain a second result output by the first tool, and the second result is input into the big model to obtain a third result output by the big model. When the third result includes only the second reply statement, the second reply statement is output, thereby setting a separate scheduler for scheduling the corresponding tool according to the output of the big model, and executing the reply generation process and the display process in parallel, thereby making full use of the capabilities of the big model, effectively reducing the delay in reply generation, and effectively improving the efficiency and effect of question replying.

[0069] Figure 2A flowchart of a problem processing method based on a large model provided in one embodiment of the present disclosure.

[0070] like Figure 2 As shown, the problem-solving method based on the large model may include the following steps:

[0071] Step 201: Obtain a first question to be processed and the type of the first question.

[0072] Among them, the type of the first question can be a category selected for the first question based on a plurality of pre-set question categories, such as mathematical calculation questions, weather query questions, and data statistical analysis questions, etc., and there is no limitation on this.

[0073] Therefore, in the present disclosure, after obtaining the question text input by the user as the first question to be processed, the first question may be firstly classified to obtain the type of the first question.

[0074] Step 202: Obtain first prompt information corresponding to the type of the first question.

[0075] After obtaining the first question to be processed and the type of the first question as described above, the present disclosure may obtain first prompt information corresponding to the type of the first question.

[0076] In the present disclosure, different prompt words corresponding to various question types may be pre-set, and when obtaining first prompt information corresponding to the type of the first question, a corresponding prompt word may be selected from the pre-set candidate prompt words as the first prompt information according to the type of the first question.

[0077] It should be noted that, for different types of first questions, the content and structure of the first prompt information may be different, and the correspondence between the first question type and the first prompt information may be configured in advance.

[0078] In the present disclosure, by obtaining the first question to be processed and the type of the first question, first prompt information corresponding to the type of the first question is obtained, so that accurate prompt information can be provided according to the question type, ensuring that the model can accurately and quickly answer user questions, effectively reducing differences and errors that may occur in the answering process, thereby helping to improve the overall question answering efficiency.

[0079] Step 203: input the first question and the first prompt information into the large model to obtain the first result output by the large model.

[0080] The specific implementation form of step 203 can refer to the detailed description in other embodiments of the present disclosure, and will not be described in detail here.

[0081] Step 204: parse the first result to determine whether the first result contains a preset identifier.

[0082] Among them, the preset identifier refers to an identifier that can be used to separate the reply statement and the tool call information, such as a separator used to separate the reply statement from the code, or it can be other types of special identifiers, any identifier used to separate the reply statement and the tool call information, without any limitation.

[0083] In the present disclosure, the first result can be parsed to determine whether the first result contains a preset identifier. If the first result contains the preset identifier, it indicates that the answer statement in the first result is not the final and complete answer statement for the first question, and a tool call is required to assist the large model in giving an accurate answer statement for the first question. Correspondingly, if the first result does not contain the preset identifier, it indicates that the answer statement in the first result is the required final answer statement for the first question.

[0084] Step 205, when the first result includes a preset identifier, based on the position of the preset identifier, obtain the first reply statement and the first tool calling information included in the first result.

[0085] In the present disclosure, when the first result includes a preset identifier, it indicates that the first result includes a first reply statement and a first tool calling information. Then, the controller can be used to extract the first reply statement and the first tool calling information separated by the preset identifier, respectively, thereby obtaining the first reply statement and the first tool calling information contained in the first result.

[0086] For example, when the first tool call information is a code, the preset identifier can be a separator and a terminator used to separate the code from the reply statement. The controller can be used to extract the code between the separator and the terminator as the first tool call information. The first tool call information can be used as input and input into the first tool (i.e., the code executor). The part of the first result other than the code part and the preset identifier is the first reply statement.

[0087] In the present application, the first result is parsed to determine whether the first result contains a preset identifier. If the first result contains the preset identifier, the first reply statement and the first tool call information contained in the first result are obtained based on the position of the preset identifier. Since the preset identifier can be used to separate the first reply statement and the first tool call information, the tool call information can be accurately extracted from the first result for tool call, and the first reply statement can be extracted for output display, thereby effectively improving the efficiency of answering questions.

[0088] Step 206: output the first reply statement when the first result includes the first reply statement and the first tool calling information.

[0089] The specific implementation form of step 206 can refer to the detailed description in other embodiments of the present disclosure, and will not be described in detail here.

[0090] Step 207: Determine the type of the tool to be called based on the type of the first tool calling information.

[0091] The type of the first tool calling information may be, for example, code, data query statement, or the like.

[0092] In the present disclosure, the type of the first tool call information can be analyzed and processed. For example, when the analysis shows that the type of the first tool call information is code, then correspondingly, the type of the tool to be called is a code executor. When the type of the first tool call information is a data query statement, then correspondingly, the type of the tool to be called is a data query tool.

[0093] Step 208: Based on the first tool calling information, call the first tool associated with the tool type to obtain a second result output by the first tool.

[0094] The present disclosure determines the type of tool to be called based on the type of the first tool calling information, and can call the first tool associated with the type of tool based on the first tool calling information. The first tool can execute and process the first tool calling information to obtain a second result output by the first tool.

[0095] In the present disclosure, the type of tool to be called is determined based on the type of the first tool calling information, and the first tool associated with the type of the tool is called based on the first tool calling information. Thus, the correct tool can be obtained by analyzing the type of the tool calling information, thereby ensuring the correctness of the tool selection and the normal progress of the question answering process.

[0096] Step 209, input the second result into the large model to obtain a third result output by the large model.

[0097] Step 210: When the third result only includes the second reply statement, output the second reply statement.

[0098] The specific implementation forms of step 209 and step S210 may refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.

[0099] In the disclosed embodiment, firstly, a first question to be processed and first prompt information corresponding to the first question are obtained, and the first question and the first prompt information are input into the big model to obtain a first result output by the big model. When the first result includes a first reply statement and first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain a second result output by the first tool, and the second result is input into the big model to obtain a third result output by the big model. When the third result includes only the second reply statement, the second reply statement is output, thereby setting a separate scheduler for scheduling the corresponding tool according to the output of the big model, and executing the reply generation process and the display process in parallel, thereby making full use of the capabilities of the big model, effectively reducing the delay in reply generation, and effectively improving the efficiency and effect of question replying.

[0100] Figure 3 A flowchart of a problem processing method based on a large model provided in one embodiment of the present disclosure.

[0101] like Figure 3 As shown, the problem-solving method based on the large model may include the following steps:

[0102] Step 301, obtaining a first question to be processed and first prompt information corresponding to the first question.

[0103] Step 302: input the first question and the first prompt information into the large model to obtain the first result output by the large model.

[0104] Step 303, when the first result includes the first reply statement and the first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain the second result output by the first tool.

[0105] The specific implementation forms of steps 301 to 303 can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.

[0106] Step 304: Obtain historical information associated with the first question.

[0107] Among them, the historical information associated with the first question can be the historical response sentences and historical tool calling information generated in the process of the large model answering the first question.

[0108] In the present disclosure, historical answer statements and historical tool calling information generated in the process of the large model answering the first question can be obtained as historical information associated with the first question.

[0109] Step 305, input the second result, historical information and second prompt information into the large model to obtain the third result output by the large model.

[0110] The second prompt information refers to the prompt words required when the large model is used again for further reply generation processing. At this time, the second prompt information has a certain correlation with the second result and the historical information.

[0111] After obtaining the historical information associated with the first question as mentioned above, the present invention can input the second result, historical information and second prompt information into the big model, and the big model processes the second result, historical information and second prompt information to generate a further response to the first question, and obtain the third result output by the big model.

[0112] It should be noted that the third result may still include the tool calling information, or may not include the tool calling information.

[0113] In the present disclosure, by obtaining historical information associated with the first question, the second result, the historical information and the second prompt information are input into the large model to obtain the third result output by the large model. Since the framework in which the large model is located can save historical information and support multiple rounds of interaction, it is possible to solve complex problems through multiple steps and multiple rounds, thereby reducing the stringent requirement that the model must get the correct answer once and for all, and improving the accuracy of execution.

[0114] Step 306, when the third result also includes the second tool calling information, return to execute the operation of calling the tool until a complete answer statement corresponding to the first question is obtained.

[0115] In the present disclosure, the third result can be parsed to determine whether the third result still contains the second tool calling information. If the third result still contains the second tool calling information, return to the operation of executing the calling tool, continue to determine the type of tool to be called based on the type based on the second tool calling information, and call the second tool associated with the type of tool based on the second tool calling information to obtain the result output by the second tool, until the result output by the tool does not contain the tool calling information, and obtain the complete answer statement corresponding to the first question.

[0116] In the present disclosure, by returning to execute the operation of calling the tool when the third result also includes the second tool calling information, until the complete answer statement corresponding to the first question is obtained, multiple rounds of question answering can be performed based on the multiple rounds of tool calling information, and the model processing process is stopped when the model output result does not include the tool calling information, thereby ensuring the integrity of the finally generated answer statement.

[0117] In some embodiments of the present disclosure, returning to execute the operation of the calling tool may be based on the first tool calling information and the second tool calling information.

[0118] It should be noted that in different tool calling rounds, the called tools may be the same or different, and adaptive calling processing can be performed according to actual conditions.

[0119] In the present disclosure, by returning to execute the operation of calling the tool based on the first tool calling information and the second tool calling information, a new round of tool calling can be performed using the current tool calling information and the historical calling information, thereby ensuring that the model can grasp the valid information in the entire question answering process and ensure the correctness of the generated answer statement.

[0120] Step 307: When the third result only includes the second reply statement, output the second reply statement.

[0121] The specific implementation form of step 307 can refer to the detailed description in other embodiments of the present disclosure, and will not be described in detail here.

[0122] In the disclosed embodiment, firstly, a first question to be processed and first prompt information corresponding to the first question are obtained, and the first question and the first prompt information are input into the big model to obtain a first result output by the big model. When the first result includes a first reply statement and first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain a second result output by the first tool, and the second result is input into the big model to obtain a third result output by the big model. When the third result includes only the second reply statement, the second reply statement is output, thereby setting a separate scheduler for scheduling the corresponding tool according to the output of the big model, and executing the reply generation process and the display process in parallel, thereby making full use of the capabilities of the big model, effectively reducing the delay in reply generation, and effectively improving the efficiency and effect of question replying.

[0123] Figure 4 A flowchart of a problem processing method based on a large model provided in one embodiment of the present disclosure.

[0124] like Figure 4 As shown, the problem-solving method based on the large model may include the following steps:

[0125] Step 401, obtaining a first question to be processed and first prompt information corresponding to the first question.

[0126] Step 402: input the first question and the first prompt information into the large model to obtain the first result output by the large model.

[0127] The specific implementation forms of step 401 to step 402 can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.

[0128] Step 403, when the first result includes the first reply statement and the first tool calling information, the first reply statement is output through the first thread, and the corresponding first tool is called through the second thread based on the first tool calling information to obtain the second result output by the first tool.

[0129] Among them, the first thread is used to output the first reply statement.

[0130] The second thread is used to call the corresponding first tool based on the first tool calling information to obtain the second result output by the first tool.

[0131] It should be noted that the first thread and the second thread can be executed in parallel, so that while outputting the first reply statement, the corresponding first tool can be called to obtain the second result output by the first tool, effectively reducing the delay in reply statement generation and improving the efficiency of reply statement generation.

[0132] That is to say, the large model-based problem-solving method disclosed in the present invention adopts a full-duplex interaction mode. Different from the traditional tool calling paradigm, the present invention adopts a full-duplex interaction mode, outputting partial replies to the user at each step of the large language model, and at the same time calling the tool execution in parallel, so that the replies can be output uninterruptedly, thereby achieving no need to wait until the entire process of task decomposition, tool calling, and answer synthesis is completed before outputting the complete answer. Therefore, it can significantly reduce the user's waiting time and improve the user's interactive experience.

[0133] In the present disclosure, a first reply statement is outputted through a first thread, and a corresponding first tool is called through a second thread based on the first tool calling information. Since the output of the reply statement and the calling of the tool are processed in parallel based on different threads, a partial reply to the user is outputted at each step, and at the same time, the tool is called in parallel for execution, thereby outputting the reply uninterruptedly, which can significantly reduce the user's waiting time and enhance the user's interactive experience.

[0134] Step 404: when the second result is error indication information, obtain historical information and third prompt information associated with the first question.

[0135] The error indication information refers to the error message issued when an operation error occurs in the called tool.

[0136] In the present disclosure, if the tool call reports an error, the large model framework will obtain conversation history information related to the first question. The obtained conversation history information can be used as historical information associated with the first question, and the third prompt message corresponding to the first question can be obtained. At this time, the third prompt message can be related to the obtained historical information.

[0137] In the present disclosure, the model framework has the ability of historical memory, and can pass historical information and information of the current model to the tool, shortening the context length maintained by the large language model, thereby reducing time consumption and reducing the model's maintenance cost for the context, making the information carried by the interaction lighter.

[0138] Step 405, input the error indication information, historical information and the third prompt information into the large model to obtain a fourth result output by the large model.

[0139] After obtaining the historical information and the third prompt information associated with the first question as mentioned above, the present invention can return the running error information to the large language model, input the error indication information, the historical information and the third prompt information into the large model, and obtain the fourth result output by the large model, so that the large language model can correct the error according to the error information, complete the self-reflection function, and finally generate information that is closer to the correct answer.

[0140] For example, Figure 5 As shown, Figure 5 This is a schematic diagram of the model framework structure in the embodiment of the present disclosure. The framework mechanism of the large language model using tools enables the large language model to effectively and efficiently use external tools to solve complex problems. The overall framework includes three functions: task planning, tool calling, and reflection.

[0141] Among them, task planning refers to the framework using prompt word learning, combining user questions with corresponding task planning prompt words, and asking questions to the large language model to obtain partial user responses to the question and tool call information.

[0142] Among them, tool calling means that the framework parses the tool calling information, converts it into tool input, calls the tool to get the execution result, and then returns the tool execution result to the large language model to assist the large language model in obtaining the next problem solution. For example, in solving mathematical problems, the large language model decomposes complex problems into codes and obtains accurate calculation results by calling tools such as code-interpreter, thereby significantly reducing the difficulty of problem solving and improving the accuracy of problem solving.

[0143] In addition, the results produced by the large language model may be imperfect, resulting in inaccurate results of tool execution. Therefore, the framework provides a self-correction reflection function. If the tool call reports an error, the framework will return the conversation history and running error information to the large language model, so that the large language model can correct the error based on the error information, complete the self-reflection function, and ultimately generate information that is closer to the correct answer, effectively improving the accuracy of response generation.

[0144] In this disclosure, the framework adopts full duplex communication, multi-turn interaction and has the ability to maintain history memory:

[0145] Full-duplex interaction means that, unlike the traditional tool calling paradigm, this framework adopts a full-duplex interaction mode, outputting partial responses to users at each step of the large language model output, while calling tools in parallel, so that responses can be output uninterruptedly. This solution does not have to wait until the entire process of task decomposition, tool calling, and answer synthesis is completed before outputting a complete answer, thus significantly reducing user waiting time and improving user interaction experience.

[0146] Among them, multi-round interaction means that this framework supports multi-round interaction. When solving complex problems, it can be solved through multiple steps and multiple rounds, reducing the stringent requirement that the model must get the correct answer at once, and can improve the accuracy of execution.

[0147] Among them, historical memory means that this framework has the ability to remember history, and can pass historical information and information of the current model to the tool, shortening the context length maintained by the large language model, thereby reducing time consumption and reducing the model's maintenance cost for the context, making the information carried by the interaction lighter. Different from using a large language model as a control scheduler, this framework uses a separate controller and a large language model as a planner, allowing the large language model to focus more on "thinking" rather than some mechanical repetitive operations, thereby maintaining the versatility and independence of the large language model.

[0148] In the present application, by obtaining historical information and third prompt information associated with the first question when the second result is an error indication information, the error indication information, historical information and third prompt information are input into the large model, and the fourth result output by the large model is obtained. Since the large model provides a self-correcting reflection function hidden in the framework, if the tool call reports an error, the framework will return the conversation history and operation error information to the large language model, so that the large language model can correct the error according to the error information, complete the self-reflection function, and finally generate information that is closer to the correct answer, effectively solving the problem of hallucinations in the large language model, and the results generated may be imperfect, resulting in the problem that the results of the tool execution are not completely accurate, thereby ensuring the accuracy of the generated reply sentences.

[0149] Step 406, input the second result into the large model to obtain a third result output by the large model.

[0150] Step 407: When the third result only includes the second reply statement, output the second reply statement.

[0151] The specific implementation forms of step 406 to step 407 can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.

[0152] The problem-solving method disclosed in the present invention proposes a brand-new framework for tools for using large language models, which solves the problems of high latency, heavy context maintenance and inability to effectively utilize the capabilities of large language models in current tools. The framework is better integrated with the large language model in architecture, has strong scalability, and can provide real-time feedback on the effects during the interaction with the large language model, taking into account both effects and efficiency, and can be better applied to real-time interactive products.

[0153] In order to implement the above embodiments, the present disclosure also proposes a problem processing device based on a large model.

[0154] Figure 6 A schematic diagram of the structure of a large model-based problem processing device provided in an embodiment of the present disclosure.

[0155] like Figure 6 As shown, the large model-based problem processing device 600 includes: a first acquisition module 601, a first input module 602, a processing module 603, a second input module 604, and a first output module 605.

[0156] A first acquisition module 601 is used to acquire a first question to be processed and first prompt information corresponding to the first question;

[0157] A first input module 602 is used to input a first question and a first prompt information into the large model to obtain a first result output by the large model;

[0158] The processing module 603 is used to output the first reply statement when the first result includes the first reply statement and the first tool calling information, and call the corresponding first tool based on the first tool calling information to obtain the second result output by the first tool;

[0159] The second input module 604 is used to input the second result into the large model to obtain a third result output by the large model;

[0160] The first output module 605 is used to output the second reply statement when the third result only includes the second reply statement.

[0161] In a possible implementation of the present disclosure, the first acquisition module 601 is specifically configured to:

[0162] Obtaining a first question to be processed and the type of the first question;

[0163] First prompt information corresponding to the type of the first question is obtained.

[0164] In a possible implementation of the present disclosure, the device further includes:

[0165] A parsing module (not shown in the figure), used to parse the first result after obtaining the first result output by the large model, and determine whether the first result contains a preset identifier;

[0166] The second acquisition module (not shown in the figure) is used to acquire the first reply statement and the first tool calling information contained in the first result based on the position of the preset identifier when the first result contains a preset identifier.

[0167] In a possible implementation of the present disclosure, the processing module 603 is specifically configured to:

[0168] Determining the type of the tool to be called based on the type of the first tool calling information;

[0169] Based on the first tool calling information, a first tool associated with the tool type is called.

[0170] In a possible implementation of the present disclosure, the second input module 604 is specifically used to:

[0171] Obtaining historical information associated with the first question;

[0172] The second result, the historical information and the second prompt information are input into the large model to obtain the third result output by the large model.

[0173] In a possible implementation of the present disclosure, the device further includes:

[0174] A third acquisition module (not shown in the figure) is used to obtain the historical information associated with the first question and the third prompt information after obtaining the second result output by the first tool and when the second result is error indication information;

[0175] The second output module (not shown in the figure) is used to input the error indication information, historical information and the third prompt information into the large model to obtain the fourth result output by the large model.

[0176] In a possible implementation of the present disclosure, the device further includes:

[0177] The fourth acquisition module (not shown in the figure) is used to return to the operation of calling the tool after obtaining the third result output by the large model, if the third result also contains the second tool calling information, until the complete answer statement corresponding to the first question is obtained.

[0178] In a possible implementation of the present disclosure, the fourth acquisition module is specifically configured to:

[0179] Based on the first tool calling information and the second tool calling information, an operation of executing the calling tool is returned.

[0180] In a possible implementation of the present disclosure, the processing module 603 is further configured to:

[0181] The first reply statement is outputted through the first thread, and the corresponding first tool is called based on the first tool calling information through the second thread.

[0182] In the disclosed embodiment, firstly, a first question to be processed and first prompt information corresponding to the first question are obtained, and the first question and the first prompt information are input into the big model to obtain a first result output by the big model. When the first result includes a first reply statement and first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain a second result output by the first tool, and the second result is input into the big model to obtain a third result output by the big model. When the third result includes only the second reply statement, the second reply statement is output, thereby setting a separate scheduler for scheduling the corresponding tool according to the output of the big model, and executing the reply generation process and the display process in parallel, thereby making full use of the capabilities of the big model, effectively reducing the delay in reply generation, and effectively improving the efficiency and effect of question replying.

[0183] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0184] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0185] like Figure 7As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0186] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0187] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as a problem processing method based on a large model. For example, in some embodiments, the problem processing method based on a large model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via ROM 702 and / or a communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the problem processing method based on the large model described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform a problem processing method based on a large model in any other appropriate manner (e.g., by means of firmware).

[0188] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0189] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable large-model-based problem-solving device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0190] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 may 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.

[0191] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0192] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by 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), the Internet, and a blockchain network.

[0193] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0194] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0195] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In the description of the present disclosure, the words "if" and "if" used can be interpreted as "at the time of" or "when" or "in response to determination" or "under the circumstances of".

[0196] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A problem-solving method based on a large model, comprising: Obtaining a first question to be processed and first prompt information corresponding to the first question; Inputting the first question and the first prompt information into the large model to obtain a first result output by the large model; When the first result includes a first reply statement and first tool calling information, the first reply statement is output, and based on the first tool calling information, the corresponding first tool is called to obtain a second result output by the first tool; Inputting the second result into the large model to obtain a third result output by the large model; When only the second reply sentence is included in the third result, the second reply sentence is output.

2. The method of claim 1, wherein: The obtaining of a first question to be processed and first prompt information corresponding to the first question includes: Obtaining the first question to be processed and the type of the first question; Obtain first prompt information corresponding to the type of the first question.

3. The method of claim 1, wherein: After obtaining the first result output by the large model, the method further includes: Parsing the first result to determine whether the first result contains a preset identifier; In a case where the first result includes a preset identifier, the first reply statement and the first tool calling information included in the first result are obtained based on the position of the preset identifier.

4. The method of claim 3, wherein: The calling of the corresponding first tool based on the first tool calling information includes: Determining the type of the tool to be called based on the type of the first tool calling information; Based on the first tool calling information, a first tool associated with the type of the tool is called.

5. The method of claim 1, wherein: The step of inputting the second result into the large model to obtain a third result output by the large model includes: Obtaining historical information associated with the first question; The second result, the historical information and the second prompt information are input into the large model to obtain a third result output by the large model.

6. The method of claim 1, wherein: After obtaining the second result output by the first tool, the method further includes: When the second result is error indication information, obtaining historical information and third prompt information associated with the first question; The error indication information, the historical information and the third prompt information are input into the large model to obtain a fourth result output by the large model.

7. The method according to any one of claims 1 to 6, wherein: After obtaining the third result output by the large model, the method further includes: In the case where the third result also includes the second tool calling information, the operation of executing the calling tool is returned until a complete answer statement corresponding to the first question is obtained.

8. The method of claim 7, wherein: The returning the operation of executing the calling tool includes: Based on the first tool calling information and the second tool calling information, return to execute the operation of the calling tool.

9. The method according to any one of claims 1 to 6, wherein: The outputting the first reply statement and calling the corresponding first tool based on the first tool calling information includes: The first reply statement is outputted through the first thread, and the corresponding first tool is called based on the first tool calling information through the second thread.

10. A problem-solving device based on a large model, wherein: The device comprises: A first acquisition module, used to acquire a first question to be processed and first prompt information corresponding to the first question; A first input module, used for inputting the first question and the first prompt information into the large model to obtain a first result output by the large model; a processing module, configured to output the first reply statement if the first result includes the first reply statement and the first tool calling information, and to call the corresponding first tool based on the first tool calling information to obtain a second result output by the first tool; A second input module, used for inputting the second result into the large model to obtain a third result output by the large model; The first output module is used to output the second reply statement when the third result only includes the second reply statement.

11. The device of claim 10, wherein: The first acquisition module is specifically used to: Obtaining the first question to be processed and the type of the first question; Obtain first prompt information corresponding to the type of the first question.

12. The device of claim 10, wherein: The device also includes: A parsing module, configured to parse the first result after obtaining the first result output by the large model, and determine whether the first result contains a preset identifier; The second acquisition module is used to acquire the first reply statement and the first tool calling information included in the first result based on the position of the preset identifier when the first result includes the preset identifier.

13. The device of claim 12, wherein: The processing module is specifically used for: Determining the type of the tool to be called based on the type of the first tool calling information; Based on the first tool calling information, a first tool associated with the type of the tool is called.

14. The device of claim 10, wherein: The second input module is specifically used for: Obtaining historical information associated with the first question; The second result, the historical information and the second prompt information are input into the large model to obtain a third result output by the large model.

15. The device of claim 10, wherein: The device also includes: A third acquisition module is used for acquiring, after obtaining the second result output by the first tool, historical information and third prompt information associated with the first question when the second result is error indication information; The second output module is used to input the error indication information, the historical information and the third prompt information into the large model to obtain a fourth result output by the large model.

16. The device according to any one of claims 10 to 15, wherein: The device also includes: The fourth acquisition module is used to return to execute the operation of the calling tool after obtaining the third result output by the large model, if the third result also contains the second tool calling information, until a complete answer statement corresponding to the first question is obtained.

17. The device of claim 16, wherein: The fourth acquisition module is specifically used for: Based on the first tool calling information and the second tool calling information, return to execute the operation of the calling tool.

18. The device according to any one of claims 10 to 15, wherein: The processing module is further used for: The first reply statement is outputted through the first thread, and the corresponding first tool is called based on the first tool calling information through the second thread.

19. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that may be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 9.

20. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.

21. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Resource space-time state information prediction method based on time sequence

    CN115858952A

  • Hybrid interaction system and method based on AI large model

    CN117391078A

  • End-to-end geographic industry large language model construction and use method

    CN117669737A

  • Dialogue model training method, computer equipment and storage medium

    CN117708295A

  • Information processing method and device based on artificial intelligence, electronic equipment and intelligent agent

    CN117743542A

Cited By

  • Task answering method and device, equipment and medium

    CN119293211A

  • Question and answer processing method and device, large model training method and device, equipment and storage medium

    CN119443277A

  • Question and answer processing method, large model training method, device, equipment and storage medium

    CN119443277B