Task-based dialogue method, system, device, medium and product
By using imitation learning models in a task-based dialogue system to pre-generate task execution strategies and combining the execution step logic of large language model, the problem of slow response speed of existing systems is solved, significantly improving the user experience.
Patent Information
- Application Number
- CN202411548580.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-18
AI Technical Summary
The existing task-based dialogue system requires calling a large language model at every step of thinking, resulting in a low response speed and affecting the user experience.
The pre-trained imitation learning model determines the task execution strategy based on the target statement, reducing the number of calls to the large language model; then use the large language model to execute the steps represented by the task execution strategy to conduct multiple rounds of conversations with the client and complete the target task.
It effectively improves the system response speed and improves the user experience. By imitating the combination of learning models and large language models, it quickly generates task execution strategies and executes complex step logic.
Smart Images

Figure CN119646132A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a task-based dialogue method, system, device, medium and product. Background Art
[0002] Intelligent agents are widely used in task-based dialogue scenarios, where they complete specific tasks by conducting multiple rounds of dialogue with users. The dialogue system in task-based dialogue scenarios is mainly implemented based on the Large Language Model (LLM) to ensure that it can better plan the execution strategy of complex tasks and adjust the strategy based on user feedback.
[0003] However, in actual applications, since each step of the dialogue system's thinking requires calling a large language model, the system response speed is low, which greatly affects the user experience. Summary of the invention
[0004] In view of the above problems, embodiments of the present application provide a task-based dialogue method, system, device, medium and product to overcome the above problems or at least partially solve the above problems.
[0005] In a first aspect of an embodiment of the present application, a task-based dialogue method is provided, the method comprising: Receiving a target statement from a client, wherein the target statement is used to represent a task requirement of a target task; Determine the task execution strategy according to the target statement through a pre-trained imitation learning model, wherein the imitation learning model is obtained by imitating and learning the expert dialogue behavior logic in the field associated with the target task, and the task execution strategy is used to characterize the various steps required to complete the target task, wherein the various steps include: a relevant step for inquiring information from the client, and a relevant step for returning the execution result to the client; Through the pre-trained large language model LLM, each step represented by the task execution strategy is executed to conduct multiple rounds of dialogue with the client and complete the target task.
[0006] As a possible implementation, the steps represented by the task execution strategy are executed by using a pre-trained large language model LLM, including: Based on the pre-established thinking chain COT prompt template, generate COT prompts corresponding to each step represented by the task execution strategy; Inputting each of the COT prompts to the LLM so that the LLM executes each of the steps represented by the task execution strategy; The COT prompt template includes one or more of the following template contents: The first template content is used to indicate the objects that the LLM needs to call to execute related steps, and the objects include: at least one of different types of workflows, knowledge bases, and plug-ins; The second template content is used to instruct the LLM to determine whether the object to be called has an exception; The third template content is used to assist LLM in determining the execution flow of the relevant steps; The fourth template content is used to instruct the LLM to detect whether an exception that meets the preset exception type occurs during the execution of the relevant steps, and is used to instruct the LLM to handle the exception that meets the preset exception type.
[0007] As a possible implementation, the COT prompts corresponding to the steps represented by the task execution strategy are generated based on the pre-established COT prompt template, including: Obtain the COT prompt templates corresponding to each of the steps, and determine each piece of data to be filled in each of the COT prompt templates; For each of the steps, obtaining text information corresponding to the step from the task execution strategy; For each of the steps, obtaining keywords corresponding to each of the data to be filled in from the text information corresponding to the step; For each of the steps, the acquired keywords are used to fill in the data to be filled in the COT prompt template corresponding to the step to obtain the COT prompt corresponding to the step.
[0008] As a possible implementation, the method further includes: Detecting whether an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy; When it is detected that an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy, obtaining description information of the abnormality; Inputting the description information of the exception into the LLM to obtain response information for the exception; The reply information is returned to the client.
[0009] As a possible implementation manner, the target task is associated with at least one of intelligent customer service, in-vehicle question and answer, and smart home control, and the imitation learning model is trained by the following steps: Acquire multiple dialogue data in the field associated with the target task; The plurality of dialogue data are used to train a sequence-to-sequence (seq2seq) model, so that the seq2seq model imitates and learns the expert dialogue behavior logic in the field associated with the target task, thereby obtaining the imitation learning model.
[0010] According to a second aspect of an embodiment of the present application, a task-based dialogue system is provided, the system comprising a quick decision-making module and a thinking-action module, wherein: The quick decision module is used to receive a target statement from a client, where the target statement is used to characterize the task requirements of the target task; The quick decision module is further used to determine the task execution strategy according to the target statement through a pre-trained imitation learning model, wherein the imitation learning model is obtained by imitating and learning the expert dialogue behavior logic in the field associated with the target task, and the task execution strategy is used to characterize the various steps required to complete the target task, wherein the various steps include: a relevant step for inquiring information from the client, and a relevant step for returning the execution result to the client; The thinking action module is used to execute the various steps represented by the task execution strategy through a pre-trained large language model LLM, so as to conduct multiple rounds of dialogue with the client and complete the target task.
[0011] Optionally, the system further comprises a target module; The target module is used to generate COT prompts corresponding to each step represented by the task execution strategy based on a pre-established thinking chain COT prompt template; The thinking action module is further used to input each of the COT prompts into the LLM so that the LLM executes each step represented by the task execution strategy; The COT prompt template includes one or more of the following template contents: The first template content is used to indicate the objects that the LLM needs to call to execute related steps, and the objects include: at least one of different types of workflows, knowledge bases, and plug-ins; The second template content is used to instruct LLM to determine whether there is an exception in the object to be called; The third template content is used to assist LLM in determining the execution flow of the relevant steps; The fourth template content is used to instruct the LLM to detect whether an exception that meets the preset exception type occurs during the execution of the relevant steps, and is used to instruct the LLM to handle the exception that meets the preset exception type.
[0012] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the task-based dialogue method described in the first aspect are implemented.
[0013] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the task-based dialogue method described in the first aspect are implemented.
[0014] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the task-based dialogue method as described in the first aspect.
[0015] The embodiments of the present application include the following advantages: based on the imitation learning of the expert dialogue behavior logic in the field associated with the target task, the imitation learning model can quickly determine the behavior logic of similar experts for the target task, and then pre-generate a task execution strategy based on the behavior logic, so as to avoid multiple calls to the large language model to determine the task execution strategy; then the large language model is used to think about the complex execution logic of each step represented by the task execution strategy, and then the various steps are executed to conduct multiple rounds of dialogue with the client and complete the target task; thereby, the imitation learning model and the large language model are combined and applied to the task-based dialogue scenario, which can effectively improve the system response speed and thus improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0017] Figure 1 is an implementation flow chart of a task-based dialogue method in an embodiment of the present application; Figure 2 is a schematic diagram of an implementation process of a task-based dialogue method in an embodiment of the present application; Figure 3 It is a schematic diagram of the architecture of a seq2seq model in an embodiment of the present application; Figure 4 is a structural diagram of a task-based dialogue system in an embodiment of the present application; Figure 5 is a structural diagram of a task-based dialogue device in an embodiment of the present application; Figure 6 It is a schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0019] With the development of artificial intelligence technology, intelligent agents are increasingly used in conversation scenarios. In conversation systems related to areas such as customer service, educational guidance, and smart home control, intelligent agents are often used to handle various complex question-and-answer requests.
[0020] There are many types of dialogue systems, among which task-based dialogue systems are widely used in fields such as intelligent customer service, in-vehicle question and answer, and smart home control.
[0021] The intelligent agent in the task-based dialogue system completes specific tasks by conducting multiple rounds of dialogue with the user. In order to achieve a more natural and efficient interactive experience, the intelligent agent needs to have good understanding, reasoning and quick response capabilities.
[0022] Currently, most intelligent dialogue systems adopt a single decision-making mechanism, among which the most common ones are rule-based decision-making methods or large language model-based decision-making methods.
[0023] Rule-based decision-making methods are rarely used in task-based dialogue scenarios because they have difficulty handling complex scenarios and lack flexibility.
[0024] Decision-making methods based on large language models have been widely used in task-based dialogue scenarios because they can better plan the execution strategies of complex tasks and adjust strategies based on user feedback.
[0025] However, for a dialogue system implemented based on a large language model, since each step of thinking requires calling the large language model, that is, each step in planning the execution strategy requires calling the large language model, the processing of the target task takes a long time, resulting in a low system response speed, which greatly affects the user experience.
[0026] In response to the problems existing in the above-mentioned related technologies, the embodiments of the present application propose a task-based dialogue method, system, device, medium and product, which uses an imitation learning model to quickly determine the behavior logic of similar experts for the target task, and then pre-generates the task execution strategy based on the behavior logic, so as to avoid the need to call the large language model multiple times to determine the task execution strategy; then use the large language model to think about the complex execution logic of each step represented by the task execution strategy, and then execute each step to conduct multiple rounds of dialogue with the client and complete the target task. In this way, the imitation learning model and the large language model are combined and applied to the task-based dialogue scenario, which can effectively improve the system response speed and thus improve the user experience.
[0027] In conjunction with the accompanying drawings, a task-based dialogue method, system, device, medium and product provided by the embodiments of the present application are described in detail below through some embodiments and their application scenarios.
[0028] First, refer to Figure 1 FIG. 1 is a flowchart of an implementation of a task-based dialogue method provided in an embodiment of the present application. The method may include the following steps: Step S11: receiving a target statement from a client, wherein the target statement is used to characterize the task requirements of the target task.
[0029] Among them, the task-based dialogue method provided in the present application can be executed by a task-based dialogue system, and the task-based dialogue system can be deployed in a device such as a server.
[0030] In specific implementation, the task-based dialogue system may pre-establish an interface for the client to input sentences, such as pre-establishing a web page that supports sentence input.
[0031] The client accesses the interface and inputs the target sentence in the interface to send the target sentence to the task-based dialogue system.
[0032] For example, the client can enter the target sentence "I want to change to a more affordable package. Please recommend several and introduce them in detail." in the interface, and click the submit button after entering. The target sentence will then be sent to the task-based dialogue system.
[0033] Step S12: Determine the task execution strategy according to the target statement through the pre-trained imitation learning model.
[0034] Among them, the imitation learning model is obtained by imitating the expert dialogue behavior logic in the field associated with the target task, and the task execution strategy is used to characterize the various steps required to complete the target task, and the various steps include: relevant steps for inquiring information from the client, and relevant steps for returning execution results to the client.
[0035] In a specific implementation, the target sentence is input into the imitation learning model, and the imitation learning model then determines the task execution strategy by adopting expert-like dialogue and decision-making behaviors for the target task based on the expert dialogue behavior logic learned previously in the relevant field.
[0036] For example, for the target sentence "I want to change to a more affordable package. Please recommend several and give detailed introductions.", the imitation learning model can quickly obtain the task execution strategy as follows based on the imitation learning of the dialogue behavior logic of experts in related fields: Step 1: asking the user whether he prefers a package with more data or a package with longer call duration (i.e., a step for asking the client for information); Step 2: According to the user's preference, query the corresponding package and introduce it to the user (i.e., the relevant steps for returning the execution result to the client); Step 3: Change the package based on the user's choice.
[0037] It should be noted that the present application takes into account that task-based dialogue systems usually need to have multiple rounds of dialogues with users to complete specific tasks, and most of the task scenarios involved are relatively general, that is, the task requirements proposed by users are very likely to be similar to task requirements that have appeared in the past. Therefore, past experience can be used to pre-determine the task execution strategy for the current task.
[0038] Therefore, this application applies imitation learning technology to task-based dialogue systems, specifically by replicating the dialogue and behavior strategies of domain experts through imitation learning models, thereby quickly generating task execution strategies for specific tasks (which include relevant steps for implementing multiple rounds of dialogue with users).
[0039] Since the imitation learning model is used to pre-generate the task execution strategy, it is possible to avoid multiple calls to the large language model to determine the task execution strategy, thereby effectively improving the system response speed (for example, improving the system's response speed), thereby improving the user experience.
[0040] Step S13: Execute each step represented by the task execution strategy through the pre-trained large language model LLM to conduct multiple rounds of dialogue with the client and complete the target task.
[0041] In the specific implementation, see Figure 2 The schematic diagram of the implementation process of the task-based dialogue method shown is that for the target sentence sent by the client (which carries the relevant representation information of the task requirements of the target task), the imitation learning model is first used to process it to obtain the task execution strategy (which is used to characterize the various steps required to complete the target task).
[0042] Then, according to each step represented by the task execution strategy, each prompt information is generated which is easier to be understood by the large model.
[0043] For example, for the step represented by the task execution strategy "Based on the user's preferences, query the corresponding package and introduce it to the user;", the corresponding prompt information can be generated: "Enter the user preference workflow, enter different branches based on user preferences, call the corresponding knowledge base to obtain the package introduction, and return the answer."
[0044] The various prompt information is input into the large language model to instruct the large language model to think about (i.e., make decisions) the complex execution logic of the various steps, and then execute the various steps according to the thought-out complex execution logic to conduct multiple rounds of dialogue with the client and complete the target task.
[0045] It can be understood that the present application leverages the large language model's ability to plan execution strategies for complex tasks and adjust strategies based on user feedback to address complex strategy planning and execution problems that are difficult for imitation learning models to handle.
[0046] Specifically, the present application uses a large language model to think about and execute the execution strategy for each step represented by the task execution strategy (which is equivalent to the various subtasks divided by the target task). This can ensure the normal and accurate execution of each step represented by the task execution strategy in complex task scenarios, thereby ensuring the completion effect of the target task.
[0047] By adopting the technical solution of the embodiment of the present application, based on the imitation learning of the expert dialogue behavior logic in the field associated with the target task, the imitation learning model can quickly determine the behavior logic of similar experts for the target task, and then pre-generate the task execution strategy according to the behavior logic, so as to avoid the need to call the large language model multiple times to determine the task execution strategy; then use the large language model to think about the complex execution logic of each step represented by the task execution strategy, and then execute each step to conduct multiple rounds of dialogue with the client and complete the target task; thereby, the imitation learning model and the large language model are combined and applied to the task-based dialogue scenario, which can effectively improve the system response speed and thus improve the user experience.
[0048] As a possible implementation, the steps represented by the task execution strategy are executed by using a pre-trained large language model LLM, including: Step S21: Based on the pre-established COT prompt template, generate COT prompts corresponding to each step represented by the task execution strategy.
[0049] In the specific implementation, code can be written in advance to establish a target module for generating COT prompts. The target module can extract information from each step represented by the task execution strategy based on keyword extraction and other methods, and fill the extracted information into the Chain Of Thought (COT) prompt template corresponding to each step, so as to obtain the COT prompt corresponding to each step.
[0050] Alternatively, a text generation model may be pre-trained, wherein the text generation model has the ability to convert the task execution strategy into COT prompts corresponding to each step represented by the task execution strategy based on the COT prompt template.
[0051] In the application stage, the task-based dialogue system inputs the task execution strategy generated by the imitation learning model into the text generation model, and the text generation model can be used to generate COT prompts corresponding to each step represented by the task execution strategy.
[0052] The COT prompt template includes one or more of the following template contents: The first template content (i.e., the template content related to function positioning) is used to indicate the objects that LLM needs to call to execute related steps (including at least one of different types of workflows, knowledge bases, and plug-ins), that is, to require LLM to identify and determine the workflows, knowledge bases, or plug-ins that may need to be called; The second template content (i.e., the template content related to function assurance) is used to instruct the LLM to determine whether there is an abnormality in the object to be called, that is, to instruct the LLM to confirm whether the located function can effectively support the execution of the relevant steps, thereby ensuring that all functions required for the execution of the relevant steps are in place; The third template content (i.e., the template content related to subtask planning) is used to assist LLM in determining the execution process of the relevant steps (i.e., the relevant subtasks), that is, to guide LLM to organize appropriate operation processes to achieve the relevant subtasks; The fourth template content (i.e., the template content related to exception handling) is used to instruct the LLM to detect whether an exception that meets the preset exception type (such as an exception that may affect subsequent steps) occurs during the execution of the relevant steps, and is used to instruct the LLM on the exception handling method corresponding to the exception that meets the preset exception type, that is, to inquire the LLM whether there are exceptions that may affect subsequent steps during the execution process. If such exceptions occur, an alternative plan is initiated, such as the LLM automatically generating an exception handling plan directly based on the exception type to handle the relevant exceptions.
[0053] For example, taking a step (i.e., a subtask) represented by the task execution strategy as "searching for corresponding packages and introducing them to the user according to the user's preferences", the COT prompt corresponding to the step generated according to the above COT prompt template can be expressed as follows: 1) Call the user preference workflow and package details knowledge base (corresponding to the template content related to functional positioning); 2) Check whether the workflow is normal and whether the knowledge base exists (corresponding to the template content related to functional assurance); 3) Enter the user preference workflow, enter different branches according to user preferences, call the corresponding knowledge base to obtain package introductions, and return answers (corresponding to the template content related to subtask planning); 4) Handle exceptions: During the execution process, check whether the workflow enters normally and whether the knowledge base is called normally. If not, call LLM for exception handling (corresponding to the template content related to exception handling).
[0054] Step S22: Input each of the COT prompts to the LLM, so that the LLM executes each step represented by the task execution strategy.
[0055] In the specific implementation, the large language model will generate the execution logic of each step (that is, the execution process, which may include how to call the workflow, knowledge base and plug-in, and how to handle exceptions, etc.) according to the COT prompts corresponding to each step, and then execute each step according to the execution logic.
[0056] In this implementation, considering that the task planning effect of the large language model is greatly affected by the prompt information, that is, there is a greater uncertainty in the result. To solve the above problem, the present application designs the above COT prompt template to achieve the standardization of prompt information.
[0057] Therefore, by generating COT prompts based on the above-mentioned COT prompt template, and then guiding the large language model to generate detailed execution logic for each step, the uncertainty of the decision results of the large language model can be reduced, thereby ensuring the execution effect of each step, and then achieving a fast and accurate response to the client to efficiently complete the target task.
[0058] Optionally, the generating of COT prompts corresponding to each step represented by the task execution strategy based on the pre-established thought chain COT prompt template includes: Obtain the COT prompt templates corresponding to each of the steps, and determine each piece of data to be filled in each of the COT prompt templates; For each of the steps, obtaining text information corresponding to the step from the task execution strategy; For each of the steps, obtaining keywords corresponding to each of the data to be filled in from the text information corresponding to the step; For each of the steps, the acquired keywords are used to fill in the data to be filled in the COT prompt template corresponding to the step to obtain the COT prompt corresponding to the step.
[0059] In specific implementation, blanks may be left in advance in the COT prompt template or specific parameters may be used to indicate the data to be filled in.
[0060] For example, different parameters can be used in the COT prompt template to represent different types of data to be filled in, so that the type of data to be filled in can be quickly identified later, and then the keywords corresponding to the data to be filled in can be quickly extracted from the text information of the task execution strategy.
[0061] After extracting the keywords corresponding to the data to be filled in associated with the relevant steps from the text information, that is, after extracting the information needed to fill in the data to be filled in from the text information, the data to be filled in is filled in by filling in or replacing the information.
[0062] For example, when the data to be filled in the COT prompt template is represented by leaving blanks, the extracted keywords can be directly filled into the blanks at the corresponding data positions to be filled in the COT prompt template, thereby filling in the data to be filled in the COT prompt template.
[0063] For another example, when using specific parameters to represent the data to be filled in the COT prompt template, the specific parameters at the position of the data to be filled in the COT prompt template can be replaced with relevant keywords, thereby filling in the data to be filled in the COT prompt template.
[0064] In this implementation, a keyword extraction method is used to obtain the COT prompts corresponding to each step, which can avoid the model training step required for introducing the model, thereby reducing the implementation cost.
[0065] As a possible implementation, the method further includes: Detecting whether an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy; When it is detected that an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy, obtaining description information of the abnormality; Inputting the description information of the exception into the LLM to obtain response information for the exception; The reply information is returned to the client.
[0066] In specific implementation, based on the feedback of the LLM on the execution of the steps, it is possible to detect whether the LLM has an abnormality in the process of executing each step represented by the task execution strategy. For example, when the execution time of a certain step by the LLM exceeds the set time, it can be determined that the LLM has an abnormality in the process of executing the step.
[0067] Alternatively, the calling status of the calling object (such as workflow, knowledge base or plug-in) required for executing the step can also be monitored. If it is found during the monitoring process that the LLM fails to successfully call the relevant workflow, knowledge base or plug-in, it can be determined that an abnormality occurs in the process of LLM executing the step.
[0068] When it is determined that an exception occurs during the execution of a certain step by LLM, information about the workflow, knowledge base or plug-in that was not successfully called can be obtained, and / or information about the step where the exception occurs can be obtained, and the obtained information can be used as description information of the exception.
[0069] Subsequently, the description information of the exception is input into the LLM so that the LLM can generate specific exception handling logic, and generate reply information according to the exception handling logic. The reply information can be flexibly set according to actual needs.
[0070] For example, the reply information may be used to prompt the user (ie, the client) to input information required by the LLM to process the current exception.
[0071] For another example, the reply information may be used to provide the user with information such as the current exception or the current LLM's handling of the exception.
[0072] In this implementation, using a large model to handle exceptions can increase the system's ability to cope with abnormal situations, thereby improving the stability of the system.
[0073] As a possible implementation mode, the target task is associated with at least one of: intelligent customer service, in-vehicle question and answer, and smart home control; The imitation learning model is trained by the following steps: Step S31: Acquire multiple dialogue data in the field associated with the target task.
[0074] In a specific implementation, multiple dialogue data between an expert in the field associated with the target task (which may be a related manual service or a reliable intelligent agent) and the user are obtained.
[0075] For example, for intelligent customer service, multiple conversation data between customer service personnel (corresponding field experts) and users can be obtained.
[0076] Step S32: Use the multiple dialogue data to train a sequence-to-sequence (seq2seq) model, so that the seq2seq model can imitate and learn the expert dialogue behavior logic in the field associated with the target task, thereby obtaining the imitation learning model.
[0077] In a specific implementation, the plurality of conversation data are divided into a training set, a validation set and a test set according to a preset ratio.
[0078] The seq2seq model is trained using the training set, and the performance of the model on unseen data is evaluated using the validation set, and then the parameters of the seq2seq model are adjusted; finally, the performance of the seq2seq model is evaluated using the test set.
[0079] The training is terminated when the performance of the seq2seq model reaches the set performance requirement, and then the seq2seq model obtained at the end of the training is used as the trained imitation learning model.
[0080] For example, refer to Figure 3 The schematic diagram of the architecture of the seq2seq model shown in FIG. 1 is an encoder-decoder architecture. Figure 3 h0 represents the conversation data, x1, x2, x3, x4 represent the elements in the conversation data (such as the individual words in the user's question in the conversation data), c represents the semantic vector, and y1, y2, y3 represent the individual elements in the output sequence (such as the individual words in the customer service answer). The encoder is responsible for compressing the collected and preprocessed large amount of memory data into a semantic vector of fixed length; The decoder is responsible for generating and outputting the target sequence based on the above semantic vector.
[0081] It is understandable that the essence of the seq2seq model is to learn the probability distribution in the dataset and derive the output sequence with the maximum probability.
[0082] Taking the use of the seq2seq model to imitate the behavioral logic of customer service personnel as an example, the training process of the seq2seq model is illustrated.
[0083] First, a large amount of customer service conversation data is collected and preprocessed such as data cleaning. Then, the preprocessed customer service conversation data is used to train the seq2seq model.
[0084] During the training process, for each customer service conversation data, the seq2seq model will use the encoder to perform convolution processing on the user's questions in the customer service conversation data (corresponding to the above-mentioned memory data) to convert the user's questions into a one-dimensional vector representation (corresponding to the above-mentioned semantic vector), and the decoder will then generate a corresponding answer based on the one-dimensional vector representation.
[0085] By adjusting the parameters of the seq2seq model, the answers generated by the decoder can be gradually made closer to the answers of the customer service personnel in the customer service conversation data, so that the seq2seq model can learn the best practices of the customer service personnel.
[0086] Therefore, the seq2seq model (i.e., the imitation learning model) can quickly and accurately simulate the question-answering and decision-making behaviors of customer service personnel when subsequently processing target tasks related to intelligent customer service, and then generate a task execution strategy for the target tasks.
[0087] Based on the above examples and embodiments, this application proposes a task-based dialogue method that integrates imitation learning technology and a large language model. First, a small model (i.e., an imitation learning model) is used to simulate the dialogue and decision-making logic of domain experts to quickly obtain the task execution strategy, and then the large language model is used to think about the complex step execution logic. In this way, intuitive and fast decision-making and in-depth thinking are effectively combined. While ensuring the ability to solve complex tasks, the system response speed can be effectively improved, thereby improving the user experience.
[0088] On this basis, this application also designs a COT prompt template to standardize the prompt information input into the large language model, which can reduce the uncertainty of the decision results of the large language model and thus ensure the execution effect of each step.
[0089] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0090] Second, Figure 4 : is a structural diagram of a task-based dialogue system in an embodiment of the present application, the system includes a quick decision module and a thinking action module, wherein: The quick decision module is used to receive a target statement from a client, where the target statement is used to characterize the task requirements of the target task; The quick decision module is further used to determine the task execution strategy according to the target statement through a pre-trained imitation learning model, wherein the imitation learning model is obtained by imitating and learning the expert dialogue behavior logic in the field associated with the target task, and the task execution strategy is used to characterize the various steps required to complete the target task, wherein the various steps include: a relevant step for inquiring information from the client, and a relevant step for returning the execution result to the client; The thinking action module is used to execute the various steps represented by the task execution strategy through a pre-trained large language model LLM, so as to conduct multiple rounds of dialogue with the client and complete the target task.
[0091] In this embodiment, the fast decision-making module is built based on an imitation learning model. By learning the best practices and decision-making paths of professional dialogue personnel, it can quickly take expert-like behaviors in specific task scenarios, thereby generating task execution strategies.
[0092] The thinking-action module is built based on a large language model, which uses the large language model to handle complex planning and execution problems that are difficult for imitation learning models to deal with.
[0093] Through this design, the system can effectively combine intuitive and quick decision-making with in-depth thinking, thereby effectively improving the system response speed and improving the user experience while ensuring the ability to solve complex tasks.
[0094] By adopting the technical solution of the embodiment of the present application, based on the imitation learning of the expert dialogue behavior logic in the field associated with the target task, the imitation learning model can quickly determine the behavior logic of similar experts for the target task, and then pre-generate the task execution strategy according to the behavior logic, so as to avoid the need to call the large language model multiple times to determine the task execution strategy; then use the large language model to think about the complex execution logic of each step represented by the task execution strategy, and then execute each step to conduct multiple rounds of dialogue with the client and complete the target task; thereby, the imitation learning model and the large language model are combined and applied to the task-based dialogue scenario, which can effectively improve the system response speed and thus improve the user experience.
[0095] Optionally, the system further comprises a target module; The target module is used to generate COT prompts corresponding to each step represented by the task execution strategy based on a pre-established thinking chain COT prompt template; The thinking action module is further used to input each of the COT prompts into the LLM so that the LLM executes each step represented by the task execution strategy; The COT prompt template includes one or more of the following template contents: The first template content is used to indicate the objects that the LLM needs to call to execute related steps, and the objects include: at least one of different types of workflows, knowledge bases, and plug-ins; The second template content is used to instruct LLM to determine whether there is an exception in the object to be called; The third template content is used to assist LLM in determining the execution flow of the relevant steps; The fourth template content is used to instruct the LLM to detect whether an exception that meets the preset exception type occurs during the execution of the relevant steps, and is used to instruct the LLM to handle the exception that meets the preset exception type.
[0096] Optionally, the target module is further used to perform the following steps: Obtain the COT prompt templates corresponding to each of the steps, and determine each piece of data to be filled in each of the COT prompt templates; For each of the steps, obtaining text information corresponding to the step from the task execution strategy; For each of the steps, obtaining keywords corresponding to each of the data to be filled in from the text information corresponding to the step; For each of the steps, the acquired keywords are used to fill in the data to be filled in the COT prompt template corresponding to the step to obtain the COT prompt corresponding to the step.
[0097] Optionally, the thinking action module is further configured to perform the following steps: Detecting whether an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy; When it is detected that an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy, obtaining description information of the abnormality; Inputting the description information of the exception into the LLM to obtain response information for the exception; The reply information is returned to the client.
[0098] Optionally, the target task is associated with at least one of intelligent customer service, in-vehicle question and answer, and smart home control, and the thinking and action module is further used to perform the following steps: Acquire multiple dialogue data in the field associated with the target task; The plurality of dialogue data are used to train a sequence-to-sequence (seq2seq) model, so that the seq2seq model imitates and learns the expert dialogue behavior logic in the field associated with the target task, thereby obtaining the imitation learning model.
[0099] Thirdly, Figure 5 : is a schematic diagram of the structure of a task-based dialogue device according to an embodiment of the present application, the device comprising: A statement receiving module 510 is used to receive a target statement from a client, where the target statement is used to represent the task requirements of the target task; A strategy determination module 520 is used to determine a task execution strategy according to the target statement through a pre-trained imitation learning model, wherein the imitation learning model is obtained by imitating and learning the expert dialogue behavior logic in the field associated with the target task, and the task execution strategy is used to characterize the various steps required to complete the target task, wherein the various steps include: a relevant step for inquiring information from the client, and a relevant step for returning the execution result to the client; The task execution module 530 is used to execute the various steps represented by the task execution strategy through the pre-trained large language model LLM, so as to conduct multiple rounds of dialogue with the client and complete the target task.
[0100] By adopting the technical solution of the embodiment of the present application, based on the imitation learning of the expert dialogue behavior logic in the field associated with the target task, the imitation learning model can quickly determine the behavior logic of similar experts for the target task, and then pre-generate the task execution strategy according to the behavior logic, so as to avoid the need to call the large language model multiple times to determine the task execution strategy; then use the large language model to think about the complex execution logic of each step represented by the task execution strategy, and then execute each step to conduct multiple rounds of dialogue with the client and complete the target task; thereby, the imitation learning model and the large language model are combined and applied to the task-based dialogue scenario, which can effectively improve the system response speed and thus improve the user experience.
[0101] Optionally, the policy determination module 520 includes: A first determination module is used to generate COT prompts corresponding to each step represented by the task execution strategy based on a pre-established thinking chain COT prompt template; A second determination module, configured to input each of the COT prompts into the LLM, so that the LLM executes each of the steps represented by the task execution strategy; The COT prompt template includes one or more of the following template contents: The first template content is used to indicate the objects that the LLM needs to call to execute related steps, and the objects include: at least one of different types of workflows, knowledge bases, and plug-ins; The second template content is used to instruct the LLM to determine whether the object to be called has an exception; The third template content is used to assist LLM in determining the execution flow of the relevant steps; The fourth template content is used to instruct the LLM to detect whether an exception that meets the preset exception type occurs during the execution of the relevant steps, and is used to instruct the LLM to handle the exception that meets the preset exception type.
[0102] Optionally, the first determining module includes: A first determination submodule is used to obtain the COT prompt templates corresponding to the respective steps, and determine the data to be filled in the respective COT prompt templates; A second determination submodule is used to obtain text information corresponding to each step from the task execution strategy; A third determination submodule is used to obtain, for each of the steps, keywords corresponding to each of the data to be filled in from the text information corresponding to the step; The fourth determination submodule is used to, for each of the steps, use the acquired keywords to fill in the data to be filled in the COT prompt template corresponding to the step to obtain the COT prompt corresponding to the step.
[0103] Optionally, the device further comprises: an anomaly detection module, used to detect whether an anomaly occurs in the process of the LLM executing each step represented by the task execution strategy; An exception description module is used to obtain description information of the exception when it is detected that the LLM has an exception in the process of executing each step represented by the task execution strategy; An information generation module, used for inputting the description information of the exception into the LLM to obtain reply information for the exception; An information transmission module is used to return the reply information to the client.
[0104] Optionally, the field associated with the target task includes: at least one of: intelligent customer service, in-vehicle question and answer, and smart home control, and the device further includes: A first training module is used to obtain a plurality of dialogue data in a field associated with the target task; The second training module is used to train a sequence-to-sequence (seq2seq) model using the multiple dialogue data, so that the seq2seq model imitates and learns the expert dialogue behavior logic in the field associated with the target task to obtain the imitation learning model.
[0105] It should be noted that the device embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.
[0106] The present application also provides an electronic device, referring to Figure 6 , Figure 6 Schematic diagram of an electronic device proposed in an embodiment of the present application. Figure 6 As shown, the electronic device 100 includes: a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus communication. A computer program is stored in the memory 110. The computer program can be executed on the processor 120 to implement the steps in the task-based dialogue method disclosed in the embodiment of the present application.
[0107] The embodiment of the present application also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the task-based dialogue method disclosed in the embodiment of the present application is implemented.
[0108] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the task-based dialogue method disclosed in the embodiment of the present application.
[0109] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0110] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0111] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, systems, devices, storage media, and program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0112] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1A step that specifies a function in one or more boxes.
[0114] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0115] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0116] The above is a detailed introduction to a task-based dialogue method, system, device, medium and product provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A task-based dialogue method, characterized in that: The method comprises: Receiving a target statement from a client, wherein the target statement is used to represent a task requirement of a target task; Determine the task execution strategy according to the target statement through a pre-trained imitation learning model, wherein the imitation learning model is obtained by imitating and learning the expert dialogue behavior logic in the field associated with the target task, and the task execution strategy is used to characterize the various steps required to complete the target task, wherein the various steps include: a relevant step for inquiring information from the client, and a relevant step for returning the execution result to the client; Through the pre-trained large language model LLM, each step represented by the task execution strategy is executed to conduct multiple rounds of dialogue with the client and complete the target task.
2. The method according to claim 1, characterized in that The steps represented by the task execution strategy are executed by using the pre-trained large language model LLM, including: Based on the pre-established thinking chain COT prompt template, generate COT prompts corresponding to each step represented by the task execution strategy; Inputting each of the COT prompts to the LLM so that the LLM executes each of the steps represented by the task execution strategy; The COT prompt template includes one or more of the following template contents: The first template content is used to indicate the objects that the LLM needs to call to execute related steps, and the objects include: at least one of different types of workflows, knowledge bases, and plug-ins; The second template content is used to instruct the LLM to determine whether the object to be called has an exception; The third template content is used to assist LLM in determining the execution flow of the relevant steps; The fourth template content is used to instruct the LLM to detect whether an exception that meets the preset exception type occurs during the execution of the relevant steps, and is used to instruct the LLM to handle the exception that meets the preset exception type.
3. The method according to claim 2, characterized in that The COT prompts corresponding to the steps represented by the task execution strategy are generated based on the pre-established thinking chain COT prompt template, including: Obtain the COT prompt templates corresponding to each of the steps, and determine each piece of data to be filled in each of the COT prompt templates; For each of the steps, obtaining text information corresponding to the step from the task execution strategy; For each of the steps, obtaining keywords corresponding to each of the data to be filled in from the text information corresponding to the step; For each of the steps, the acquired keywords are used to fill in the data to be filled in the COT prompt template corresponding to the step to obtain the COT prompt corresponding to the step.
4. The method according to claim 1, characterized in that: The method further comprises: Detecting whether an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy; When it is detected that an abnormality occurs in the process of the LLM executing each step represented by the task execution strategy, obtaining description information of the abnormality; Inputting the description information of the exception into the LLM to obtain response information for the exception; The reply information is returned to the client.
5. The method according to any one of claims 1 to 4, characterized in that: The target task is associated with at least one of intelligent customer service, in-vehicle question and answer, and smart home control. The imitation learning model is trained by the following steps: Acquire multiple dialogue data in the field associated with the target task; The plurality of dialogue data are used to train a sequence-to-sequence (seq2seq) model, so that the seq2seq model imitates and learns the expert dialogue behavior logic in the field associated with the target task, thereby obtaining the imitation learning model.
6. A task-based dialogue system, characterized in that: The system includes a quick decision-making module and a thinking-action module, wherein: The quick decision module is used to receive a target statement from a client, where the target statement is used to characterize the task requirements of the target task; The quick decision module is further used to determine the task execution strategy according to the target statement through a pre-trained imitation learning model, wherein the imitation learning model is obtained by imitating and learning the expert dialogue behavior logic in the field associated with the target task, and the task execution strategy is used to characterize the various steps required to complete the target task, wherein the various steps include: a relevant step for inquiring information from the client, and a relevant step for returning the execution result to the client; The thinking action module is used to execute the various steps represented by the task execution strategy through a pre-trained large language model LLM, so as to conduct multiple rounds of dialogue with the client and complete the target task.
7. The system according to claim 6, characterized in that The system also includes a target module; The target module is used to generate COT prompts corresponding to each step represented by the task execution strategy based on a pre-established thinking chain COT prompt template; The thinking action module is further used to input each of the COT prompts into the LLM so that the LLM executes each step represented by the task execution strategy; The COT prompt template includes one or more of the following template contents: The first template content is used to indicate the objects that the LLM needs to call to execute related steps, and the objects include: at least one of different types of workflows, knowledge bases, and plug-ins; The second template content is used to instruct LLM to determine whether there is an exception in the object to be called; The third template content is used to assist LLM in determining the execution flow of the relevant steps; The fourth template content is used to instruct the LLM to detect whether an exception that meets the preset exception type occurs during the execution of the relevant steps, and is used to instruct the LLM to handle the exception that meets the preset exception type.
8. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the task-based dialogue method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the task-based dialogue method according to any one of claims 1 to 5 is implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the task-based dialogue method according to any one of claims 1 to 5 is implemented.
Citation Information
Cited By
Instruction generation method and device
CN120723304A