Dialogue task model training method, related method, device, equipment and medium
By constructing a thinking chain prompt and target loss mechanism in the dialogue task model, the problem of insufficient accuracy and timeliness of the existing dialogue model under complex dialogue requirements is solved, and more efficient dialogue task processing and model training are achieved.
Patent Information
- Application Number
- CN202411724819.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-02-25
AI Technical Summary
Existing dialogue models have problems with insufficient dialogue accuracy and timeliness in dialogue tasks, especially when facing complex or dynamically changing dialogue needs.
A dialogue task model training method is proposed. By obtaining dialogue problem information in dialogue tasks, constructing a thinking chain prompt and inputting it into the task decision model for task decision processing, obtaining the target dialogue intention information and target task decision information. Based on this information, the target loss is determined and the task decision model is trained to improve the dialogue accuracy and timeliness of the model.
It effectively improves the dialogue accuracy and timeliness of the dialogue task model, avoids the model blindly generating problem responses without understanding the dialogue intention, and reduces the computing resource overhead of model training.
Smart Images

Figure CN119514694A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of natural language processing, and more specifically, to a dialogue task model training method and related methods, devices, equipment and media. Background Art
[0002] The dialogue model is a core technology system that supports human-computer interaction. It aims to create a smooth and intelligent communication experience through technologies such as semantic understanding and generative artificial intelligence. As a bridge between users and systems, the dialogue model can convert user input into structured data and provide accurate and humanized feedback through logical reasoning and language generation. The dialogue model can be widely used in various systems that require intelligent dialogue.
[0003] For example, in the game, non-player characters (NPCs) interact with each other in a dialogue. NPCs developed based on dialogue models serve as the driving force of game tasks, communicating with game players in the form of chat to promote the completion of game tasks. The traditional dialogue model architecture is mainly a sequence-to-sequence (Seq2Seq) neural network, but it has the defects of limited context understanding and insufficient generation quality. Summary of the invention
[0004] The embodiments of the present disclosure provide a dialogue task model training method and related methods, devices, equipment and media, which can improve the dialogue accuracy of the dialogue task model.
[0005] According to one aspect of the present disclosure, a method for training a dialogue task model is provided, the method comprising: obtaining dialogue question information in a dialogue task, inputting a thought chain prompt constructed based on the dialogue question information into a task decision model for task decision processing, and obtaining target dialogue intention information and target task decision information; obtaining task context information, task attribute configuration information and task execution strategy information, and constructing a task decision prompt through the dialogue question information, the task context information, the task attribute configuration information and the task execution strategy information; inputting the task decision prompt into the task decision model for task decision processing, and obtaining predicted dialogue intention information and predicted task decision information; determining a target loss based on the difference between the predicted dialogue intention information and the target dialogue intention information, and the difference between the predicted task decision information and the target task decision information; and training the task decision model according to the target loss to obtain a trained task decision model.
[0006] According to another aspect of the present disclosure, a dialogue generation method is provided, which includes: obtaining target dialogue question information corresponding to a target dialogue role; constructing a dialogue decision prompt based on the target dialogue question information; inputting the dialogue decision prompt into a trained task decision model for decision processing to obtain role dialogue intention information and dialogue task decision information; performing answer generation processing based on the role dialogue intention information and the dialogue task decision information to obtain question answer information corresponding to the target dialogue question information; wherein the trained task decision model is obtained according to the above-mentioned dialogue task model training method.
[0007] According to another aspect of the present disclosure, a dialogue task model training device is provided, which includes: a data construction module, a task construction module, a decision processing module, a loss determination module and a model training module. The data construction module is used to obtain dialogue question information in the dialogue task, input the thought chain prompt constructed based on the dialogue question information into the task decision model for task decision processing, and obtain target dialogue intention information and target task decision information; the task construction module is used to obtain task context information, task attribute configuration information and task execution strategy information, and construct task decision prompts through the dialogue question information, the task context information, the task attribute configuration information and the task execution strategy information; the decision processing module is used to input the task decision prompts into the task decision model for task decision processing, and obtain predicted dialogue intention information and predicted task decision information; the loss determination module is used to determine the target loss based on the difference between the predicted dialogue intention information and the target dialogue intention information, and the difference between the predicted task decision information and the target task decision information; the model training module is used to train the task decision model according to the target loss to obtain a trained task decision model.
[0008] Optionally, the data construction module may include a question generation submodule, a thought generation submodule, and an information generation submodule. The question generation submodule is used to generate dialogue question information in the dialogue task based on the role simulation model; the thought generation submodule is used to construct a thought chain prompt according to the thought chain indication information, task context information, task attribute configuration information, task execution strategy information, and the dialogue question information; the information generation submodule is used to input the thought chain prompt into the task decision model for task decision processing to obtain the target dialogue intention information and the target task decision information.
[0009] Optionally, the thinking generation submodule can be specifically used to: obtain thinking chain indication information, the thinking chain indication information at least includes task relevance judgment indicators, task advancement direction indicators and task decision indicators; obtain task context information, the task context information at least includes historical dialogue information between task participating roles and task advancement roles; obtain task attribute configuration information, the task attribute configuration information at least includes task target information and role attribute information corresponding to the task advancement role; obtain task execution strategy information, the task execution strategy information at least includes role matching indicators, dialogue experience indicators, task avoidance indicators and dialogue time indicators; construct thinking chain prompts based on the thinking chain indication information, the task context information, the task attribute configuration information, the task execution strategy information and the dialogue question information.
[0010] Optionally, the question generation submodule can be specifically used to: obtain task participating role attribute information, dialogue generation requirement information, task context information and dialogue question examples corresponding to the dialogue task; construct question generation prompts based on the task participating role attribute information, the dialogue generation requirement information, the task context information and the dialogue question examples; input the question generation prompts into the role simulation model for question generation processing to obtain dialogue question information.
[0011] Optionally, the task participating role attribute information includes at least role characteristic information, role preference information and role cooperation information, and the role cooperation information is used to characterize the cooperation degree of the task participating role when interacting with the task promoting role in dialogue.
[0012] Optionally, the data construction module may further include a reply processing submodule, a state determination submodule, an information saving submodule, and a redetermining submodule. The reply processing submodule is used to input the question reply prompt constructed by the target dialogue intention information and the target task decision information into the question reply model for question reply processing to obtain the question reply information corresponding to the dialogue question information; the state determination submodule is used to determine the task state of the dialogue question information and the question reply information through the task judgment model to obtain the task state corresponding to the dialogue task; the information saving submodule is used to save the target dialogue intention information and the target task decision information when the task state is a completed task; the redetermining submodule is used to return the dialogue question information in the dialogue task generated based on the role simulation model when the task state is an uncompleted task, so as to regenerate the dialogue question information and the corresponding target dialogue intention information and target task decision information, and redetermine the task state until the task state is determined to be a completed task, and the target dialogue intention information and the target task decision information when the task is completed are saved.
[0013] Optionally, the state determination submodule can be specifically used to: obtain a state determination instruction; construct a task state determination prompt based on the state determination instruction, the dialogue question information and the question answer information; input the task state determination prompt into the task judgment model to determine the task state, and obtain the task state corresponding to the dialogue task.
[0014] Optionally, the data construction module may further include an example acquisition submodule, a judgment prompt submodule, and a model fine-tuning submodule. The example acquisition submodule is used to acquire a preset number of task state determination examples, wherein each task state determination example includes sample dialogue question information, sample question answer information, and target task state; the judgment prompt submodule is used to construct corresponding task state judgment prompts for each task state example, and obtain a preset number of task state judgment prompts; the model fine-tuning submodule is used to input the preset number of task state judgment prompts into the task judgment model for fine-tuning.
[0015] Optionally, the reply processing submodule can be specifically used to: obtain reply requirement information and question reply examples; construct question reply prompts based on the reply requirement information, the question reply examples, the dialogue question information, the target dialogue intention information and the target task decision information; input the question reply prompts into the question reply model for question reply processing to obtain question reply information corresponding to the dialogue question information.
[0016] Optionally, the model training module can be specifically used to iteratively train the first weight parameter corresponding to the task decision model and the second weight parameter corresponding to the question answering model according to the target loss until the training end condition is met, thereby obtaining the trained task decision model and question answering model.
[0017] Optionally, the loss determination module can be specifically used to: construct a reply generation prompt based on the dialogue question information, the predicted dialogue intention information and the predicted task decision information; input the reply generation prompt into the question answering model for question answering processing to obtain predicted question answer information; determine the target loss based on the difference between the predicted dialogue intention information and the target dialogue intention information, the difference between the predicted task decision information and the target task decision information, and the difference between the predicted question answer information and the target question answer information.
[0018] According to another aspect of the present disclosure, a dialogue generation device is provided, which includes: a question acquisition module, a prompt construction module, an information generation module, and an answer generation module. The question acquisition module is used to acquire the target dialogue question information corresponding to the target dialogue role; the prompt construction module is used to construct a dialogue decision prompt based on the target dialogue question information; the information generation module is used to input the dialogue decision prompt into the task decision model for decision processing to obtain the role dialogue intention information and dialogue task decision information; the answer generation module is used to perform answer generation processing based on the role dialogue intention information and the dialogue task decision information to obtain the question answer information corresponding to the target dialogue question information; wherein the task decision model is obtained according to the above-mentioned dialogue task model training method.
[0019] Optionally, the answer generation module can be specifically used to: construct a question answer prompt based on the target dialogue question information, the character dialogue intention information and the dialogue task decision information; input the question answer prompt into a trained question answering model for question answering processing to obtain question answer information corresponding to the target dialogue question information; wherein the trained question answering model is obtained according to the dialogue task model training method in the above-mentioned embodiment.
[0020] According to another aspect of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is executed by a processor, the above-mentioned dialog task model training method and dialog generation method are executed.
[0021] According to another aspect of the present disclosure, a computer device is provided, which includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is called by the processor, the computer program executes the above-mentioned dialog task model training method and dialog generation method.
[0022] According to another aspect of the present disclosure, a computer program product is provided, which includes a computer program stored in a storage medium; a processor of a computer device reads the computer program from the storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned dialogue task model training method and dialogue generation method.
[0023] The disclosed embodiment can obtain the dialogue question information in the dialogue task, and input the thought chain prompts constructed based on the dialogue question information into the task decision model for task decision processing, so as to obtain the target dialogue intention information and the target task decision information. In this way, by inputting the thought chain prompts constructed based on the prompt engineering into the task decision model, the task decision model can accurately infer and analyze the dialogue intention (that is, the target dialogue intention information) from the questions of the task participating roles (that is, the dialogue question information) through the thought chain strategy, and generate a decision for deciding how to answer the question (that is, the target task decision information), and then, the dialogue question information can be used as a sample of training data, and the target dialogue intention information and the target task decision information corresponding to the dialogue question information can be used as the target true value (that is, the ground truth) corresponding to the sample of training data, which is used to guide the training of the task decision model in the future. Furthermore, by obtaining dialogue question information, task context information, task attribute configuration information and task execution strategy information, a task decision prompt is constructed, and the task decision prompt is input into the task decision model for task decision processing to obtain predicted dialogue intention information and predicted task decision information, and then based on the difference between the predicted dialogue intention information and the target dialogue intention information, as well as the difference between the predicted task decision information and the target task decision information, the target loss is determined.
[0024] The task decision model is trained by target loss, so that the task decision model can take the target dialogue intention information and the target task decision information as the learning target, and combine the task context information, task attribute configuration information and task execution strategy information in the task decision prompt, learn to accurately analyze and derive the ability of dialogue intention and task decision from the given dialogue question information. Compared with the related technology that directly generates answers for the questions in the dialogue task, the trained task decision model obtained by the embodiment of the present disclosure can first accurately analyze the dialogue intention of the task participant role based on the dialogue question information, and generate reasonable task decisions according to the dialogue intention to guide the subsequent generation of question replies that meet the context understanding of the current dialogue scenario, effectively avoiding the dialogue model from blindly generating question replies without understanding the dialogue intention, thereby effectively improving the dialogue accuracy of the dialogue task model, avoiding the task participant role from repeatedly asking dialogue questions due to the inability to obtain accurate question replies, resulting in a waste of computing resources of the computer device. At the same time, compared with the solution of the related technology that needs to rebuild the data set and retrain when improving the dialogue model, the embodiment of the present disclosure can effectively reduce the computing resource overhead of model training by fine-tuning the task decision model during training.
[0025] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0027] Figure 1 A schematic diagram of a system architecture provided by an embodiment of the present disclosure is shown.
[0028] Figure 2 A schematic diagram of system deployment provided by an embodiment of the present disclosure is shown.
[0029] Figure 3 An application scenario diagram of a game task dialogue scenario provided by an embodiment of the present disclosure is shown.
[0030] Figure 4 An application scenario diagram of an intelligent educational interactive scenario provided by an embodiment of the present disclosure is shown.
[0031] Figure 5 A flowchart of a dialogue task model training method provided by an embodiment of the present disclosure is shown.
[0032] Figure 6 A diagram of a training data generation architecture provided by an embodiment of the present disclosure is shown.
[0033] Figure 7 A schematic diagram showing a question generation prompt provided by an embodiment of the present disclosure.
[0034] Figure 8 A schematic diagram showing a thought chain prompt provided by an embodiment of the present disclosure.
[0035] Fig. 9 A reasoning diagram of a task decision model provided by an embodiment of the present disclosure is shown.
[0036] Fig.10 A schematic diagram showing a question answering prompt provided by an embodiment of the present disclosure.
[0037] Fig.11 A schematic diagram showing a task status judgment prompt provided by an embodiment of the present disclosure.
[0038] Fig.12 A schematic diagram showing an example of a task state provided by an embodiment of the present disclosure.
[0039] Fig.13 A schematic diagram showing a task status determination prompt provided by an embodiment of the present disclosure.
[0040] Fig.14 A diagram of a training data generation architecture provided by an embodiment of the present disclosure is shown.
[0041] Fig.15 A flow chart for generating training data provided by an embodiment of the present disclosure is shown.
[0042] Fig.16 A schematic diagram showing a task decision prompt provided by an embodiment of the present disclosure.
[0043] Fig.17 A schematic diagram showing the prediction output of a task decision model provided by an embodiment of the present disclosure
[0044] Fig.18 A Transformer framework diagram of a task decision model provided by an embodiment of the present disclosure is shown.
[0045] Fig.19 A flowchart of a method for generating a dialogue provided by an embodiment of the present disclosure is shown.
[0046] Fig. 20 An example diagram of a conversation between a player and an NPC in a game scene provided by an embodiment of the present disclosure is shown.
[0047] Fig.21 A schematic diagram showing a dialogue decision prompt provided by an embodiment of the present disclosure.
[0048] Fig. 22 A schematic diagram showing a question answering prompt provided by an embodiment of the present disclosure.
[0049] Fig.23 It is a module block diagram of a dialogue task model training device provided by an embodiment of the present disclosure.
[0050] Fig.24 It is a module block diagram of a dialogue task model training device provided by an embodiment of the present disclosure.
[0051] Fig.25 It is a module block diagram of a computer device provided by an embodiment of the present disclosure.
[0052] Fig.26 It is a module block diagram of a computer-readable storage medium provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0053] In order to enable those skilled in the art to better understand the solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The implementation methods described with reference to the drawings are exemplary and are only used to explain the present disclosure, and cannot be understood as limitations on the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.
[0054] In some processes described in the specification, claims and the above drawings, multiple steps appearing in a specific order are included, but it should be clearly understood that these steps may not be executed in the order in which they appear in this document or may be executed in parallel. The step numbers are only used to distinguish different steps, and the numbers themselves do not represent any execution order. In addition, the descriptions such as "first", "second" or "target" in this document are used to distinguish similar objects, and are not necessarily used to describe a specific order, sequence or quantity.
[0055] It is worth noting that in the specific implementation of the present disclosure, related data such as dialogue problem information is involved. When the above embodiments of the present disclosure are applied to specific products or technologies, it is necessary to obtain the permission or consent of the object, and the collection, use and processing of the relevant data need to comply with relevant laws, regulations and standards. Exemplarily, when the embodiment of the present disclosure needs to obtain dialogue problem information, a separate permission or separate consent for the dialogue problem information can be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining a separate permission or separate consent, the necessary related data for enabling the normal operation of the embodiment of the present disclosure can be obtained.
[0056] The present disclosure relates to full fine-tuning (FFT) for large language models. Full fine-tuning is to fine-tune all parameters of the pre-trained model, that is, all layers and parameters of the pre-trained model are updated and optimized to meet the needs of the target task. It should be noted that, like pre-training, full fine-tuning requires sufficient memory and computing to store and process all gradients, optimizers and other parts that need to be updated during the training process. Full fine-tuning can generally achieve better model performance. This fine-tuning method is generally suitable for situations where the task requires the model to be highly flexible and adaptive.
[0057] Large language models play a key role in dialogue systems. Their language understanding and generation capabilities can use the learned knowledge to generate answers to questions. Currently, large language models are widely used in different dialogue scenarios. The application of large language models in dialogue scenarios usually includes processes such as dataset construction, dialogue model training, and rule setting. Dataset construction refers to the process in which developers build corresponding training datasets based on dialogue requirements in dialogue scenarios, where dialogue requirements may include user questions, small talk content, and task dialogues. Training datasets are used to train appropriate dialogue models for dialogue scenarios.
[0058] By using the training dataset constructed above, developers can train the large language model to obtain a dialogue model for a specific dialogue scenario. During the training process, the large language model can learn how to generate responses for dialogue needs by learning from the training dataset. Most of the dialogue models in the prior art are based on the traditional sequence-to-sequence architecture, or language models based on the Transformer architecture, such as Generative Pre-trained Transformer (GPT).
[0059] In addition to using dialogue models, it is also possible to combine dialogue rules and response templates set for dialogue needs. For example, in a game dialogue scenario, when the game character used by the player approaches the game NPC, it will trigger the NPC to call the dialogue model to conduct a task dialogue with the game character; when the game character triggers a specific event or topic, the NPC can also select a suitable response template according to the dialogue rules for dialogue communication. However, dialogue models trained with specific training data sets and dialogue systems developed with preset dialogue rules and response templates cannot make flexible and accurate responses based on real-time user interactions when faced with complex or dynamically changing dialogue needs.
[0060] In short, when faced with complex and ever-changing dialogue requirements, the accuracy and timeliness of the response content generated by the dialogue model are low. In order to solve the above problems, the inventors have proposed a dialogue task model training method provided by the embodiment of the present disclosure after research. The following first describes the system implementation environment of the above method involved in the present disclosure and the related application scenarios.
[0061] See also Figure 1 , Figure 1A schematic diagram of a system architecture is shown. The dialogue task model training method and dialogue generation method provided in the embodiment of the present application can be applied in the system 100. Among them, the data acquisition device 110 is used to generate dialogue question information, as well as target dialogue intention information and target task decision information corresponding to the dialogue question information. The data acquisition device 110 can also obtain task state determination examples for fine-tuning the task judgment model. The data acquisition device 110 can store the dialogue question information, the target dialogue intention information and target task decision information corresponding to the dialogue question information, and the task state determination examples as training data in the database 120 so that the training device 130 can use them for model training.
[0062] The training device 130 can train the task decision model and the question answering model based on the training data in the database 120 until the training end condition is met, and obtain the trained task decision model and question answering model, that is, the target model 101. Among them, the training end condition may include: the total loss value of the target loss is less than the preset value, the total loss value of the target loss is within the threshold range, or the number of training times reaches the preset number of times, etc. The target model 101 can be a deep neural network composed of one or more neural networks. For example, the task decision model of the target model 101 can include a Transformer model, etc., which is not limited here.
[0063] The execution device 140 may deploy the target model 101 trained by the training device 130. When the processing module 141 of the execution device 140 performs calculations and other related processing, the execution device 140 may call the data, programs, etc. in the data storage system 142 for the corresponding calculation processing, and store the data and instructions such as the processing results obtained by the calculation processing in the data storage system 142. For example, when the execution device 140 receives the target dialogue question information sent by the user device 150, it may call the processing module 141 to run the target model 101, so as to generate answers to the target dialogue question information according to the task decision model and the question answering model, and return the generated question answer information to the user device 150. Data transmission between the execution device 140 and the user device 150 may be performed through an input / output (I / O) interface.
[0064] The training device 130, the execution device 140 and the user device 150 can be computer devices such as servers or terminals. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), blockchains, and big data and artificial intelligence platforms. The terminal can be a laptop, a tablet computer, a desktop computer, etc.
[0065] It should be noted that Figure 1 It is only a schematic diagram of a system architecture provided in the embodiment of the present application. The system architecture and application scenarios described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Figure 1 The execution device 140 can be used to deploy the target model 101 trained by the training device 130. In other cases, the user device 150 can also directly deploy the target model 101 trained by the training device 130 and perform the coloring mode conversion directly locally.
[0066] See also Figure 2 , Figure 2 Schematic diagram of system deployment is shown. For example, the dialogue task model training method and dialogue generation method provided by the present disclosure can also be deployed in Figure 2 In the system of C / S (Client / Server) architecture shown in FIG. , the system may include a server, a gateway, the Internet, and computer equipment.
[0067] A server is a computer system that can provide certain services to the server side. Compared with ordinary computer equipment, servers have higher requirements in terms of stability, security, and performance. Figure 2 As shown, the server 210 can be a high-performance computer in a network platform, a cluster of multiple high-performance computers, a portion of a high-performance computer (e.g., a virtual machine), a combination of portions of multiple high-performance computers (e.g., virtual machines), etc.
[0068] A gateway is also called an internetwork connector or a protocol converter. Figure 2 As shown, gateway 220 realizes network interconnection at the transport layer through Internet 230, and is a computer system or device that acts as a conversion. The gateway is a translator between two systems that use different communication protocols, data formats or languages, or even completely different architectures. At the same time, the gateway can also provide filtering and security functions.
[0069] Computer devices can send requests to servers to access or use resources, data or services on the server. Figure 2 As shown, the computer device may include a tablet computer 240a, a desktop computer 240b, an intelligent service terminal 240c, a vehicle-mounted terminal (not shown), etc. In addition, it may be a single computer device or a collection of multiple computer devices.
[0070] Computer devices can communicate with the Internet in wired or wireless ways to exchange data. Figure 2 As shown, the tablet computer 240a can communicate with the Internet 230 through the wireless router 250. For another example, the message sent by the desktop computer 240b to the server 210 can be transmitted to the corresponding server 210 through the gateway 220. The message sent by the server 210 can also be transmitted to the corresponding smart service terminal 240c through the gateway 220.
[0071] As an implementation mode, the dialogue task model training method provided by the present disclosure can be implemented in part on a server and in part on a computer device. For example, the server as a service end can deploy a task decision model and a question answering model. When the server receives the target dialogue question information sent by the computer device of the user end, it can construct a dialogue decision prompt based on the target dialogue question information, input the dialogue decision prompt into the task decision model for decision processing, obtain the role dialogue intention information and the dialogue task decision information, input the role dialogue intention information and the dialogue task decision information into the question answering model, and generate question answer information for the target dialogue question information. Further, the server returns the question answer information to the computer device.
[0072] It should be noted that Figure 2 This is only a schematic diagram of a system deployment provided by the embodiment of the present disclosure. The system deployment scheme described in the embodiment of the present disclosure is only for the purpose of more clearly illustrating the technical solution of the embodiment of the present disclosure, and does not constitute a limitation on the technical solution provided by the embodiment of the present disclosure. For example, a computer device may generally refer to one of multiple devices. This embodiment only refers to Figure 2 The three computer devices (tablet computer 240a, desktop computer 240b, and intelligent service terminal 240c) shown in the figure are used as examples. It is known to those skilled in the art that with the evolution of system deployment solutions, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0073] The dialog task model training method and dialog generation method provided in the present disclosure can be applied in various scenarios, for example, Figure 3 The game mission dialogue scene shown, such as Figure 4 The smart education interactive scenes shown, etc.
[0074] (1) Game mission dialogue scenes.
[0075] Communication between non-player characters and players is an important part of game narrative. By having natural and dynamic conversations with non-player characters, players can participate in game tasks more deeply. In order to help players quickly understand task objectives and complete game tasks, reduce confusion in task execution, and improve player retention, a non-player character (NPC) can be set in the game application. The conversation ability of the NPC can be developed based on the dialogue task model training method and dialogue generation method disclosed in the present invention. When players participate in specific tasks in the game, they can have conversations with the NPC to promote the completion of the task.
[0076] like Figure 3 The game task dialogue scene shown, the game application developed based on the dialogue task model training method and dialogue generation method disclosed in the present invention, may include a server 311 deployed on a cloud server 310 and a client 321 deployed on a desktop computer 320. The server 311 is mainly responsible for performing complex calculations or logical processing, processing, analyzing or calculating the data requested by the client 321, for example, generating answers according to the target dialogue question information corresponding to the player sent by the client 321. The client 321 is mainly responsible for providing an interactive interface, sending a request to the server 311 according to the user's operation on the interactive interface, and presenting data. At this time, the player is having a dialogue with the game NPC in the game, and the task goal of the game NPC is to be responsible for selling game props to the player. For example, the player sends a dialogue question message 330 to the game NPC, "I am looking for equipment suitable for fast movement. Any recommendations?" The client 321 generates a question reply request and sends the question reply request to the server 311 of the cloud server 310 through the desktop computer 320.
[0077] Furthermore, the server 311 can respond to the question reply request, construct a dialogue decision prompt based on the dialogue question information 330 in the question reply request, and input the dialogue decision prompt into the trained task decision model for decision processing to obtain the character dialogue intention information and dialogue task decision information. Further, answer generation processing is performed based on the character dialogue intention information and the dialogue task decision information to obtain question answer information 340 corresponding to the dialogue question information 330, and the question answer information 340 is returned to the client 321 of the desktop computer 320 through the cloud server 310, and the client 321 displays the question answer information 340 in the form of a game NPC dialogue "You will definitely like this "Shadow Wind Cloak", it...".
[0078] (2) Intelligent education interactive scenarios.
[0079] In the field of intelligent education, virtual teaching assistants provide students with rich interactive scenarios and immersive learning experiences. For example, virtual teaching assistants can act as teachers in a virtual environment to help students learn languages in a situational manner, or help students learn knowledge points in a situational manner. Figure 4 In the dialogue scenario of homework tutoring shown in the figure, the intelligent education service provider can develop a virtual teaching assistant based on the dialogue task model training method and dialogue generation method disclosed in the present invention, and the server 420 of the virtual teaching assistant can be deployed on the cloud server 410. When the student inputs the learning question "If an object is not subjected to external force, it will remain stationary or move in a straight line at a uniform speed?" through the client 430 of the virtual teaching assistant, the client 430 can send the question to the server 420 of the cloud server 410, and then the server 420 generates a dialogue decision prompt according to the question, and inputs the dialogue decision prompt into the task decision model 421 for decision processing, and obtains dialogue intention information and task decision information. Further, the server 420 can construct a question answer prompt based on the learning question, the dialogue intention information and the task decision information, and input the question answer prompt into the question answer model 422 for question answer processing, and obtain the question answer corresponding to the learning question. Further, the server 420 returns the question answer to the client 430 through the cloud server 410, and the client 430 displays the question answer to the student.
[0080] It should be noted that Figure 3 and Figure 4 These are only two schematic diagrams of application scenarios provided by the embodiments of the present disclosure. The application scenarios described in the embodiments of the present disclosure are only for more clearly illustrating the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. The dialogue task model training method and dialogue generation method proposed in the present disclosure can also be used in other dialogue scenarios that require dialogue tasks. It is known to those skilled in the art that, with the evolution of application scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.
[0081] According to an embodiment of the present disclosure, a method for training a dialogue task model is provided. The method for training a dialogue task model can be executed by a computer device (such as a desktop computer, a laptop computer, or other terminal device with a certain processing capability, etc.), and the computer device has at least storage, calculation and communication functions. Figure 5 FIG. 2 shows a flow chart of the method for training a dialog task model provided in this embodiment. Figure 5 As shown, the dialogue task model training method may specifically include:
[0082] Step 110: Acquire dialogue question information in the dialogue task, input the thought chain prompts constructed based on the dialogue question information into the task decision model for task decision processing, and obtain target dialogue intention information and target task decision information.
[0083] Considering that the large language model used in the relevant technology cannot understand the speaker's conversational intention and cannot make decisions on the way to respond to conversational questions in dynamically changing conversational scenarios, the disclosed embodiment proposes to train the task decision model using conversational intention information and task decision information as training data, so that "reasoning conversational intention and task decision" becomes the inherent ability of the task decision model to improve the accuracy and timeliness of the conversation. Therefore, before training the task decision model, it is necessary to construct a large amount of diverse training data, which includes the input of the task decision model: conversational question information, and the goal of supervised learning of the task decision model, that is, the Ground Truth: target conversational intention information and target task decision information.
[0084] In the disclosed embodiment, a dialogue task refers to a type of task completed by a task participating role and a task promoting role through language interaction, such as a commodity selling task in a game, or a question explaining task in intelligent homework tutoring. The task is triggered, promoted, or completed through the development of a dialogue. Among them, a task participating role refers to an active participant in a dialogue task. A task promoting role refers to a designer and guide of a dialogue task, and its role mainly revolves around providing information, setting challenges, advancing the plot, and providing feedback on the behavior of the task participating role. For example, a role-playing game (RPG) usually has a huge world view and a complex storyline. The dialogue task between the player as a task participating role and the NPC as a task promoting role is the main form of game advancement. Players need to obtain task objectives, background information, and action guidance through dialogue with NPCs. NPCs provide players with game tasks or strategic goals through dialogue.
[0085] Dialogue question information refers to information such as questions, doubts, and statements raised by the task-participating roles to the task-promoting roles in the dialogue task. For example, in a game dialogue task, a game player raises questions about game task clues to an NPC. Another example is a learning question raised by a trainee to a virtual instructor in a virtual skill training scenario. The task decision model refers to a model used to obtain the dialogue intention information and task decision information of the task-participating roles from the dialogue question information. The task decision model is a pre-trained large language model.
[0086] The dialogue intention information refers to the purpose or goal behind the dialogue question information, indicating what effect or result the task participant hopes to achieve through this dialogue question information. For example, assuming there is a dialogue intention information: "How is the weather today?", then the corresponding dialogue intention information is "Query weather information". Task decision information refers to the strategy for replying to dialogue question information generated based on the dialogue intention information. For example, for the dialogue intention information of "Query weather information", there is task decision information "Query the weather conditions in the user's area from the weather information published on the weather website".
[0087] In some embodiments, the role simulation model is used to simulate the task participant role, and the dialogue question information of the task participant role in the dialogue task can be generated. Furthermore, by constructing a thought chain prompt to guide the task decision model to perform task decision processing, the target dialogue intention information and target task decision information corresponding to the dialogue question information can be obtained. The generation process of the target dialogue intention information and the target task decision information can include steps (1) to (3):
[0088] (1) Generate dialogue question information in dialogue tasks based on the role simulation model.
[0089] The role simulation model refers to a large language model used to simulate the task participating roles to generate dialogue question information. The input of the role simulation model is the question generation prompt, and the output of the role simulation model is the dialogue question information. Task participating role attribute information can be set in the question generation prompt to guide the role simulation model to simulate the dialogue question information of different task participating roles to improve the diversity of training data. Task participating role attribute information can at least include role feature information, role preference information and role cooperation information.
[0090] Among them, the role cooperation information is used to characterize the cooperation of the task participating role in the dialogue interaction with the task promoting role. For example, the acceptance of the game player to the task recommendation. The role cooperation information can determine the response of the task participating role to the task. The role characteristic information is used to characterize the personality characteristics of the task participating role, including whether the characteristics are positive, conservative or challenging. The role preference information is used to characterize the topics of interest shown by the task participating role in the dialogue task. The role preference information can guide the advancement of the dialogue between the task participating role and the task promoting role.
[0091] As an implementation method, Figure 6As shown in the generation architecture diagram of the training data, the computer device can obtain the task participating role attribute information, dialogue generation requirement information, task context information and dialogue question examples corresponding to the dialogue task, and construct question generation prompts based on the task participating role attribute information, dialogue generation requirement information, task context information and dialogue question examples. Furthermore, the computer device can input the question generation prompts into the role simulation model for question generation processing to obtain dialogue question information.
[0092] The dialogue generation requirement information refers to the clear specifications or expectations for the output content generated by the role simulation model, which is used to guide the role simulation model to generate questions that meet the task requirements. Task context information refers to the historical dialogue context. Optionally, the task context information can be empty to indicate that this is the beginning of the dialogue. Dialogue question examples refer to the way or mode used to show the role simulation model how to complete the question generation task. Dialogue question examples can help the role simulation model understand how to generate dialogue questions, thereby generating more expected dialogue question information.
[0093] See also Figure 7 , Figure 7 A schematic diagram of a question generating prompt is shown in FIG. Figure 7 The question generation prompt shown is used to let the role simulation model simulate the questions that players will ask in the game scene. The question generation prompt may include task participating role attribute information, dialogue generation requirement information, task context information, dialogue question examples and instructions. Among them, the instructions are used to describe the tasks that the role simulation model needs to complete, usually expressed in a direct and concise way to tell the model what to do. The instructions need to be clear and unambiguous to reduce the model's misunderstanding or deviation from the task objectives. For example, Figure 7 The instructions in the character simulation model tell "You are a language model that simulates a game player. You need to generate the conversation content between the player and the NPC in the game according to the following settings."
[0094] In this way, by setting the attribute information of the task participating roles in the question generation prompt, the role simulation model can simulate the task participating roles with different characteristics or behavior patterns, generate richer dialogue questions for the task participating roles, improve the diversity of training data, and thus improve the generalization ability of subsequent training models.
[0095] (2) Construct a thinking chain prompt based on the thinking chain instruction information, task context information, task attribute configuration information, task execution strategy information and dialogue question information.
[0096] The present disclosure considers that the main reasons why the dialogue model of the relevant technology has low accuracy and timeliness are: ① Lack of intention parsing ability. Taking the commodity promotion scene in the game as an example, NPC will also force the player to promote when the player does not show interest, destroying the immersion of the game and making wrong responses at inappropriate times, that is, the timeliness of the dialogue is low. ② Lack of task decision-making ability. Taking the virtual clinical teaching scene as an example, the virtual teacher’s answer to the question "If the patient suddenly becomes hypoglycemic and comatose, what should we do?" is "When hypoglycemic comatose, first give the patient intravenous insulin, and then observe the changes in blood sugar. If the situation does not improve, you can consider oral glucose water." The dialogue model of the relevant technology mainly relies on a pre-constructed dialogue data set, so it directly generates an incorrect answer that does not match the scene (the patient cannot swallow or take glucose water orally when in a coma) based on the dialogue data set, that is, the accuracy of the dialogue is low.
[0097] In addition, the common prompts used by the relevant technologies in dialogue scenarios rely on the model to give answers directly based on contextual information without any reasoning process. For example, common prompts only include the question itself or a simple task description, such as: "Please tell me about today's weather" or "Which option do you think is better?" This kind of prompt does not explicitly require the model to show the reasoning process, but relies more on the information shown in the context and the patterns that the model has learned to respond directly. Without the thinking process to reason and analyze the dialogue intentions of the characters involved in the task, it is impossible to make a task decision.
[0098] However, "conversation intention" and "task decision" are usually complex reasoning processes. First, the model needs to judge the motivation or implicit demand behind the question, which usually requires in-depth analysis of the conversation background, context, and potential multiple intentions. Second, the model needs to generate an appropriate response strategy (that is, task decision). Specifically, the model must not only make an accurate answer, but also give an appropriate response based on the context and intention of the conversation, for example, whether to provide a direct answer, ask guiding questions, or adopt a more complex conversation strategy. This reasoning process cannot be implemented by the model with ordinary prompts.
[0099] Motivated by the principle that “thought chain prompts can guide the model to solve problems step by step through explicit reasoning steps”, the present disclosure proposes to construct thought chain prompts to guide the task decision model to perform task decision processing to generate target dialogue intention information and target task decision information. Thought chain prompts not only give the question itself, but also provide intermediate steps in the reasoning process. When input through thought chain prompts, the task decision model is required to perform step-by-step deduction, including: understanding the intention of the question and thinking about the decision point based on the intention. This approach stimulates the reasoning ability of the task decision model, allowing the task decision model to think about: how to identify the dialogue intentions of the task participants, decide how to reply to questions, and even how to deal with multiple possible answers or responses.
[0100] In the disclosed embodiment, the thought chain prompt refers to a prompt used to guide the task decision model to gradually display the question response reasoning process when answering the dialogue question, rather than directly giving the final answer. The thought chain prompt may include thought chain indication information, task context information, task attribute configuration information and task execution strategy information. By setting the thought chain indication information in the thought chain prompt, it is possible to clarify the multiple logical reasoning steps for the task decision model to analyze the dialogue question. The task decision model will simulate the "thinking process" according to these logical reasoning steps, so that it can flexibly respond to the dialogue problems of different task participants, accurately analyze the dialogue intentions of the task participants, that is, the target dialogue intention information, and generate a task decision on how to answer the question according to the dialogue intention, that is, the target task decision information. Among them, the thought chain indication information includes at least task relevance judgment instructions, task advancement direction instructions and task decision instructions.
[0101] The task relevance judgment indicator is used to instruct the task decision model to perform logical reasoning step A: identify the dialogue question information of the task participating role simulated by the role simulation model, and determine the relevance of the dialogue question information to the dialogue task. The task advancement direction indicator is used to instruct the task decision model to perform logical reasoning step B: decide whether to advance the task or continue chatting based on the dialogue status. The task decision indicator is used to instruct the task decision model to perform logical reasoning step C: formulate a specific response strategy, and integrate the execution results of logical reasoning steps A and B into the final output.
[0102] The reason for setting logical reasoning step A, logical reasoning step B, and logical reasoning step C is that, as a task advancement role, in order to advance the task and complete the task goal, it is possible to determine whether the questions or statements uttered by the task participating role are relevant to the dialogue task or how much the relevance is, and then decide whether to advance the task or continue chatting based on whether it is relevant or how much the relevance is. For example, in a dialogue state where the relevance is greater than a preset threshold, the task can be advanced, such as a task for selling game props. The task goal is to sell game props to players. At this time, recommending props to players is more in line with the timing of the dialogue. In a dialogue state where the relevance is irrelevant or the relevance is less than the preset threshold, you can continue chatting, such as discussing some topics related to game strategy with players, to avoid rigidly recommending props to players and destroying the immersion of the game dialogue.
[0103] Task context information at least includes historical dialogue information between task participating roles and task advancing roles, as well as dialogue question information. Task context information can help the task decision model understand the background of dialogue questions, so as to give more relevant answers. Task attribute configuration information at least includes task target information and role attribute information corresponding to the task advancing role, such as the characteristics and background settings of the game NPC. Task attribute configuration information can help the task decision model understand the goal of the dialogue task, as well as some attribute information of itself as a task advancing role, which is helpful for the generation of target task decision information. Task execution strategy information at least includes role matching indicators, dialogue experience indicators, task avoidance indicators, and dialogue time indicators.
[0104] Among them, the role matching indicator is used to indicate that the response strategy given by the task decision model is consistent with the characteristics of the task advancement role to avoid a sense of disharmony. The dialogue experience indicator is used to instruct the task decision model to give priority to the dialogue experience of the simulated task participant role, rather than simply executing the dialogue task. The task avoidance indicator is used to indicate the task decision given by the task decision model, including avoiding frequent responses with the same semantics for advancing the task in order to achieve the task goal in continuous dialogues, so as not to cause "disgust" to the simulated task participant role. The dialogue time indicator is used to instruct the task decision model to avoid giving a response to advance the task too early when the simulated task participant role does not show a clear completion of the task goal.
[0105] The thought chain indication information in the thought chain prompt can guide the task decision model to judge the relevance of the questions or statements of the task participants to the dialogue task, and then decide whether to advance the task or continue chatting. This thought chain strategy of first understanding the dialogue intention through dialogue relevance and then deciding how to reply based on the dialogue intention enables the task decision model to dynamically give questions that meet the dialogue needs of the task participants in complex and changing dialogue scenarios, in response to the questions or statements of the task participants. In this way, while effectively improving the accuracy of the dialogue, it also improves the timeliness of the dialogue, that is, the timing of the question reply is in line with the current dialogue scenario. For example, in a scene where an NPC sells goods to a player, the NPC will only issue sales-related replies when the player shows interest in buying, and will not force recommendations.
[0106] As an implementation method, the computer device can obtain thought chain indication information, task context information, task attribute configuration information, and task execution strategy information. For example, the thought chain indication information, task attribute configuration information, and task execution strategy information can be obtained from a pre-stored template library. Further, the computer device can construct a thought chain prompt based on the thought chain indication information, task context information, task attribute configuration information, task execution strategy information, and dialogue question information, for example, Figure 6 The thought chain prompts shown.
[0107] See also Figure 8 , Figure 8 A schematic diagram showing a thought chain prompt. Figure 8 The thought chain prompt shown is used to guide the task decision model to generate the corresponding target dialogue intention information and target task decision information for the task participating roles simulated by the role simulation model. The thought chain prompt may include instructions, task attribute configuration information, thought chain indication information, task execution strategy information and task context information, wherein the instructions are used to describe the tasks that the task decision model needs to complete, and tell the task decision model what to do, such as telling the task decision model to understand the player's intention and specify a response strategy. The task context information includes dialogue question information. Figure 8 The task planner in refers to the task decision model, and Query refers to the dialogue question information.
[0108] (3) Input the thought chain prompts into the task decision model for task decision processing to obtain the target dialogue intention information and target task decision information.
[0109] The task decision model refers to a large language model used to derive dialogue intentions and task decisions based on dialogue question information. The input of the task decision model is the prompt for question generation, and the output of the role simulation model is the dialogue question information. The input of the task decision model is the thought chain prompt, and the output of the task decision model is the target dialogue intention information and the target task decision information.
[0110] As an implementation method, the thought chain prompt is input into the task decision model for task decision processing. The task decision model can analyze and infer the target dialogue intention information of the task participating role according to each step of the thought chain prompt, combined with the task context information and the task attribute configuration information, and then on the basis of the target dialogue intention information, the target task decision information is structured and generated according to the rules in the task execution strategy information. In this way, the task decision model can flexibly respond to the behaviors and dialogue situations of different task participating roles simulated by the role simulation model, and accurately parse the intentions and decision results of the task participating roles.
[0111] For example, Fig. 9 The reasoning diagram of the task decision model shown in FIG. The input of the task decision model is a thought chain prompt consisting of background information, NPC configurable items and dialogue input in a specific game scene. Among them, the background information includes the game background, the NPC configurable items include NPC task settings and NPC decision ideas, the NPC task settings can refer to task attribute configuration information, that is, the task target information and the role attribute information corresponding to the task promotion role, such as the characteristics of the game NPC, etc., and the NPC decision ideas can refer to task execution strategy information. The dialogue input includes the dialogue context, the output results of the previous dialogue and the natural language understanding (NLU) preliminary intention. The dialogue context and the output results of the previous dialogue can refer to the task context information, and the NLU preliminary intention can refer to the thought chain indication information. The thought chain prompt is input into the task decision model for task decision processing. The task decision model can perform detailed intention judgment, obtain the target dialogue intention information, and output the thinking process of the intention judgment, and generate the target task decision information according to the target dialogue intention information, and output the final decision.
[0112] Taking into account that the target dialogue intention information and target task decision information obtained after the task decision model performs task decision processing may not correspond to the dialogue question information, resulting in the inability to complete the dialogue task. For this reason, question answer information can be generated for the dialogue question information based on the target dialogue intention information and the target task decision information, and then the task status is determined based on the dialogue question information and the corresponding generated question answer information to determine whether the dialogue task is completed. Then, the dialogue question information, target dialogue intention information and target task decision information when the dialogue task is completed are used as training data. When the dialogue task is not completed, the dialogue question information under the dialogue task and its corresponding target dialogue intention information and target task decision information are regenerated, thereby improving the accuracy of the generation of dialogue question information, target dialogue intention information and target task decision information under different dialogue tasks, thereby improving the quality of training data.
[0113] In some embodiments, after obtaining the target dialogue intention information and the target task decision information, the question answering model can be used to perform question answering processing to obtain the question answering information corresponding to the dialogue question information, and the task judgment model can be used to determine the task state based on the dialogue question information and its corresponding question answering information to obtain the task state corresponding to the dialogue task. The generation process of the target dialogue intention information and the target task decision information can also include steps (4) to (7):
[0114] (4) The question answering prompt constructed by the target dialogue intention information and the target task decision information is input into the question answering model for question answering processing to obtain the question answering information corresponding to the dialogue question information.
[0115] The question answering model is a large language model used for question answering processing. The question answering model generates corresponding question answer information for dialogue question information based on the target dialogue intention information and the target task decision information.
[0116] As an implementation method, the computer device may obtain answer requirement information and question answer examples, and construct question answer prompts based on the answer requirement information, question answer examples, dialogue question information, target dialogue intention information, and target task decision information, for example, Figure 6 The question answer prompt is shown. Furthermore, the computer device can input the question answer prompt into the question answering model for question answering processing to obtain question answering information corresponding to the dialogue question information. Among them, the answer requirement information is used to indicate that the question answering model needs to generate question answering information for answering the dialogue question information according to the target dialogue intention information and the target task decision information. The question answering example is an output example of the question answering information for reference to the question answering model. The answer requirement information and the question answering example can be obtained from a template library or manually edited.
[0117] See also Fig.10 , Fig.10 A schematic diagram showing a question answering prompt. Fig.10 The question answering prompt shown may include instructions, task context information including dialogue question information, output of the task decision model (i.e., target dialogue intention information and target task decision information), answer requirement information, and question answering examples. The instructions are used to tell the question answering model what to do, i.e., to perform question answering processing.
[0118] (5) The task status of the dialogue question information and question answer information is determined through the task judgment model to obtain the task status corresponding to the dialogue task.
[0119] The task judgment model may be a large language model after few-shot learning. Specifically, a preset number of task status determination examples are obtained, wherein each task status determination example includes sample dialogue question information, sample question answer information, and target task status, and corresponding task status judgment prompts are constructed for each task status example to obtain a preset number of task status judgment prompts, and then the preset number of task status judgment prompts are input into the task judgment model for fine-tuning to obtain a fine-tuned task judgment model. The task status corresponding to the dialogue task may include completed tasks and uncompleted tasks.
[0120] See also Fig.11 , Fig.11 A schematic diagram of a task status judgment prompt is shown. The task status judgment prompt shows an example of a task status. Fig.12 Five task status examples are shown. Each task status example includes a dialogue context and a judgment result of the task status. The dialogue context includes dialogue question information and corresponding question answer information. Because these task status determination examples cover a variety of possible task completion states and feedback from task participating roles, the task judgment model is fine-tuned based on a preset number of task status determination examples to ensure that the task completion status, that is, the task status, can be flexibly evaluated in different dialogue situations.
[0121] As an implementation method, the computer device may obtain a state determination instruction, and construct a task state determination prompt based on the state determination instruction, the dialogue question information, and the question answer information. Furthermore, the computer device may input the task state determination prompt into the task judgment model to determine the task state, and obtain the task state corresponding to the dialogue task. Fig.13 The schematic diagram of the task status determination prompt is shown. The task status determination prompt includes a status determination instruction, dialogue question information, and question answer information.
[0122] (6) When the task status is completed, save the target dialogue intention information and target task decision information.
[0123] (7) When the task status is an unfinished task, the dialogue question information in the dialogue task generated based on the role simulation model is returned to regenerate the dialogue question information and the corresponding target dialogue intention information and target task decision information, and re-determine the task status until the task status is determined to be a completed task, and the target dialogue intention information and target task decision information when the task is completed are saved.
[0124] For example, see Fig.14 and Fig.15 , Fig.14 A diagram showing a generation architecture of training data is shown. Fig.15 A flow chart of training data generation is shown below. Fig.14 and Fig.15 Introducing the training data generation process, the computer device can perform the following Fig.15 The various steps shown. Among them, the dialogue context refers to the task context information corresponding to the dialogue task, and the rules include dialogue generation requirement information and task execution strategy information. Step a: Based on the task participating role attribute information, dialogue generation requirement information, task context information and dialogue question examples, construct the question generation prompt; Step b: Input the question generation prompt into the role simulation model for question generation processing to obtain dialogue question information; Step c: Based on the thinking chain indication information, task context information, task attribute configuration information, task execution strategy information and dialogue question information, construct the thinking chain prompt; Step d: Input the thinking chain prompt into the task decision model for task decision processing to obtain the target dialogue intention information and target task decision information;
[0125] Step e: Input the question answering prompt constructed by the target dialogue intention information and the target task decision information into the question answering model for question answering processing, and obtain the question answering information corresponding to the dialogue question information; Step f: Construct the task status determination prompt based on the status determination instruction, the dialogue question information and the question answering information; Step g: Input the task status determination prompt into the task judgment model for task status determination, and obtain the task status corresponding to the dialogue task; Step h: Determine whether the task status is a completed task; Step i: When the task status is a completed task, save the target dialogue intention information and the target task decision information; When the task status is an unfinished task, return to step a.
[0126] Through prompt engineering, the task decision model can flexibly respond to the dialogue question information of different players simulated by the role simulation model, accurately analyze the player's dialogue intention, and generate task decisions. The dialogue intention and task decision are then input into the question answering model to generate appropriate question answering information. After that, the task judgment model is used to evaluate whether the dialogue task is completed. In this way, it is ensured that the dialogue question information and its corresponding target dialogue intention information and target task decision information can be effectively used as training data for subsequent model training.
[0127] Since the thought chain prompt can prompt the task decision model to show explicit reasoning ability according to the thought chain indication information to generate target dialogue intention information and target task decision information. However, once the thought chain indication information is no longer provided in the prompt, the task decision model will tend to return to its default way of directly generating answers (i.e., the original state) for this reasoning ability. To this end, the embodiment of the present disclosure proposes to train the task decision model based on the dialogue question information generated as training data in the above steps and its corresponding target dialogue intention information and target task decision information, so that "thought chain" reasoning becomes an inherent ability of the task decision model, rather than relying only on the stimulation of external prompts. The training process is as follows:
[0128] Step 120: Obtain task context information, task attribute configuration information and task execution strategy information, and construct a task decision prompt through dialogue question information, task context information, task attribute configuration information and task execution strategy information.
[0129] As an implementation method, by constructing a task decision prompt that prompts the task decision model to perform task decision processing, the task decision model is allowed to predict the dialogue intention information and task decision information of the dialogue question information, and then the loss can be determined based on the predicted dialogue intention information and task decision information and the real target dialogue intention information and target task decision information, so as to learn the "thinking chain" reasoning. Fig.16 The task decision prompt includes instructions, task attribute configuration information, task execution strategy information, and task context information including dialogue question information. Unlike the thought chain prompt constructed in the training data stage, the task decision prompt does not include thought chain indication information.
[0130] Step 130: Input the task decision prompt into the task decision model for task decision processing to obtain predicted dialogue intention information and predicted task decision information.
[0131] As an implementation method, the computer device may input the task decision prompt into the task decision model, and then the task decision model generates and outputs the predicted dialogue intention information and the predicted task decision information according to the information in the task decision prompt. Fig.17 A schematic diagram of the predicted output of a task decision model is shown. The output of the task decision model includes predicted dialogue intention information (underlined text) and predicted task decision information (non-underlined text) for the dialogue question information "I am still very curious, if the ancients had free time, what kind of food would they choose to enjoy?"
[0132] Optionally, the task decision model in the embodiment of the present disclosure can be a large language model based on the Transformer decoder-only architecture. The architecture is mainly composed of a multi-head self-attention mechanism (Self-Attention), a feed-forward neural network (Feed-Forward Network), residual connections and layer normalization. Fig.18 The Transformer framework diagram of the task decision model shown in Figure 1. The Add&Norm layer consists of two parts: Add and Norm. The Add part adds the residual on the basis of the input. The purpose of adding the residual is to prevent the problem of degradation during the training of the task decision model. The Normalization part is the purpose of normalization, which is used to speed up the training speed and improve the stability of the task decision model training. The normalization method used can be Layer Normalization. The Multi-Head Attention mechanism is an extension of Self-Attention, adding multiple attention heads to capture rich features in parallel. The Masked Multi-Head Attention has the same calculation principle as Multi-HeadAttention, with only one more Mask code added. Mask represents a mask, which is used to mask certain values so that they have no effect when the parameters are updated.
[0133] The Self-Attention mechanism is a self-attention mechanism that enables the task decision model to accurately identify key elements in the conversation when processing long sequence inputs. The core formula of the Self-Attention mechanism is as follows:
[0134]
[0135] Among them, Q, K, and V represent the query vector, key vector, and value vector respectively. lis the vector dimension. The Self-Attention mechanism is the core of the Transformer architecture. By calculating the mutual influence weights between each token in the input sequence, the task decision model can refer to the entire input sequence when generating each output. The role of the softmax(·) function is to normalize the weight (Attention) and convert it into a probability distribution so that it can reflect the importance of different positions in the input sequence. This mechanism enables the task decision model to have a strong context capture capability, effectively understand the dialogue question information of the task participants, and accurately parse the dialogue intent to generate task decisions. Position encoding can use an improved position encoding technology (Rotary Position Embedding, ROPE). Its core idea is to better retain the performance of sequence information in high-dimensional space through the rotation position embedding technology, which is especially suitable for processing complex dialogue scenarios.
[0136] Step 140: Determine the target loss based on the difference between the predicted dialogue intention information and the target dialogue intention information, and the difference between the predicted task decision information and the target task decision information.
[0137] In some embodiments, the output of the task decision model is usually a text including the predicted dialogue intention information and the predicted task decision information. Similarly, the target dialogue intention information and the target task decision information are also a text. To this end, the target loss can be determined based on the difference between the two texts.
[0138] As an implementation method, the target loss between the two texts can be calculated by the cross-entropy loss function. For example, the predicted dialogue intention information and the predicted task decision information are encoded to obtain the corresponding predicted representation, the target dialogue intention information and the target task decision information are encoded to obtain the corresponding target representation, and the cross-entropy loss, that is, the target loss, is calculated based on the predicted representation and the target representation. For another example, based on the word-by-word calculation of the cross-entropy loss, the probability distribution sequence of the predicted dialogue intention information and the predicted task decision information can be obtained. For each word in the target dialogue intention information and the target task decision information, the probability value of each word is found in the probability distribution sequence, the logarithm of the probability value is taken and the negative value is taken to obtain the loss value of each word, and the loss values of all words are summed to obtain the cross-entropy loss, that is, the target loss.
[0139] In order to improve the ability of the question answering model to obey the task decision model, joint training can be performed based on the question answering model and the task decision model. That is, the output data of the task decision model (predicted dialogue intention information and predicted task decision information) is integrated into the input of the question answering model to obtain the predicted question response of the question answering model, and the target loss is constructed based on the predicted question response and the actual question response.
[0140] As another implementation, a target loss for joint training may be constructed: a reply generation prompt is constructed based on dialogue question information, predicted dialogue intent information, and predicted task decision information; the reply generation prompt is input into a question answering model for question answering processing to obtain predicted question answer information; and a target loss is determined based on the difference between the predicted dialogue intent information and the target dialogue intent information, the difference between the predicted task decision information and the target task decision information, and the difference between the predicted question answer information and the target question answer information.
[0141] Step 150: Train the task decision model according to the target loss to obtain a trained task decision model.
[0142] As an implementation mode, when the task decision model is trained separately, the first weight parameter corresponding to the task decision model can be iteratively trained according to the target loss until the training end condition is met to obtain the trained task decision model. Exemplarily, the first weight parameter of the task decision model can be trained by full fine-tuning. Optionally, when the training resources are sufficient, the parameters of all layers of the task decision model can be directly unfrozen, and the optimizer can be used to adjust the parameters of all layers of the task decision model according to the gradient of the target loss. When the training resources are limited, the parameters of the task decision model can be gradually unfrozen, for example, starting from the last few layers and gradually unfreezing to the front layers, and adjusting the unfrozen parameters during unfreezing.
[0143] As another implementation, when the task decision model and the question answering model are jointly trained, the first weight parameter corresponding to the task decision model and the second weight parameter corresponding to the question answering model can be iteratively trained according to the target loss until the training end condition is met to obtain the trained task decision model and question answering model. Exemplarily, the first weight parameter of the task decision model and the second weight parameter of the question answering model can be jointly trained through full fine-tuning.
[0144] Among them, the iterative training can use the full amount of fine-tuning method, and the training end condition can be: the total loss value of the target loss is less than the preset value, the total loss value of the target loss is within the threshold range, or the number of training times reaches the preset number of times, etc. For example, in the embodiment of the present disclosure, optionally, an optimizer can be used to optimize the target loss, and the learning rate (Learning Rate), the batch size (Batch Size) during training, and the training period (Epoch) can be set based on experimental experience. The optimizer can use Adam, AdamW, etc., which are not limited here.
[0145] Through the target loss, the weight parameters of the task decision model and the question answering model are continuously updated during the joint training process, so that the task decision model can learn how to use the idea of thinking chain to analyze and derive the dialogue intention information of the task participants, and accurately give the task decision information on how to reply to the dialogue question information. At the same time, the question answering model can better cooperate with the task decision model to generate question answer information, so that the task decision model and the question answering model have high intelligence and flexibility when dealing with complex dialogue situations.
[0146] This embodiment can obtain the dialogue question information in the dialogue task, and input the thought chain prompts constructed based on the dialogue question information into the task decision model for task decision processing, and obtain the target dialogue intention information and the target task decision information. In this way, by inputting the thought chain prompts constructed based on the prompt engineering into the task decision model, the task decision model can accurately infer and analyze the dialogue intention (that is, the target dialogue intention information) from the questions of the task participating roles (that is, the dialogue question information) through the thought chain strategy, and generate a decision for deciding how to answer the question (that is, the target task decision information), and then, the dialogue question information can be used as a sample of training data, and the target dialogue intention information and the target task decision information corresponding to the dialogue question information can be used as the target output value corresponding to the sample of training data (that is, the Ground Truth), which is used to guide the training of the task decision model in the future. Furthermore, by obtaining dialogue question information, task context information, task attribute configuration information and task execution strategy information, a task decision prompt is constructed, and the task decision prompt is input into the task decision model for task decision processing to obtain predicted dialogue intention information and predicted task decision information, and then based on the difference between the predicted dialogue intention information and the target dialogue intention information, as well as the difference between the predicted task decision information and the target task decision information, the target loss is determined. The task decision model is trained by target loss, so that the task decision model can take the target dialogue intention information and the target task decision information as the learning target, and combine the task context information, task attribute configuration information and task execution strategy information in the task decision prompt, learn to accurately analyze and derive the ability of dialogue intention and task decision from the given dialogue question information. Compared with the related technology that directly generates answers for the questions in the dialogue task, the trained task decision model obtained in this embodiment can first accurately analyze the dialogue intention of the task participant role based on the dialogue question information, and generate reasonable task decisions according to the dialogue intention to guide the subsequent generation of question replies that meet the context understanding of the current dialogue scenario, effectively avoiding the dialogue model from blindly generating question replies without understanding the dialogue intention, thereby effectively improving the dialogue accuracy of the dialogue task model, avoiding the task participant role from repeatedly asking dialogue questions due to the inability to obtain accurate question replies, resulting in a waste of computing resources of the computer device. At the same time, compared with the solution of the related technology that needs to rebuild the data set and retrain when improving the dialogue model, this embodiment can effectively reduce the computing resource overhead of model training by fine-tuning the task decision model during training.
[0147] According to an embodiment of the present disclosure, a method for generating a dialogue is provided. The method for generating a dialogue can be executed by a computer device (such as a desktop computer, a laptop computer, or other terminal device with certain processing capabilities, etc.), and the computer device has at least storage, calculation and communication functions. Fig.19 and Fig. 20 The specific steps of the dialogue generation method are described. Fig.19 A flow chart of the dialog generation method provided in this embodiment is shown. Fig. 20 A diagram showing an example of a conversation between a player and an NPC in a game scenario.
[0148] Fig. 20 The player in the game refers to the task participant role in the game dialogue task, and the NPC refers to the task advancement role in the game dialogue task. The NPC is composed of a task decision model and a question answering model. The task decision model is responsible for NPC intention analysis and task decision-making, and the question answering model is responsible for generating NPC question answers. Fig. 20 In the game dialogue task, the player is a curious, inquisitive, and food-interested character, and is asked to interact with an NPC who is there to guide the player in learning. Therefore, the NPC's task goal is to successfully guide the player to learn.
[0149] Step 210: Obtain target dialogue question information corresponding to the target dialogue role.
[0150] The target dialogue role refers to the task participant role in the dialogue task, such as Fig. 20 For players in the game, the target dialogue question information refers to the dialogue question information sent by the target dialogue character to the task advancement character, such as Fig. 20 A question from a player in "The weather is really nice today. I wonder what the ancients paid attention to in terms of diet? Would they enhance their wisdom through certain eating habits?"
[0151] Step 220: Construct a dialogue decision prompt based on the target dialogue question information.
[0152] The dialogue decision prompt is the input of the task decision model, which is used to guide the task decision model to perform intention analysis and task decision. Fig.21 The diagram shows a dialogue decision prompt, which includes a decision instruction and target dialogue question information.
[0153] Step 230: Input the dialogue decision prompt into the trained task decision model for decision processing to obtain character dialogue intention information and dialogue task decision information.
[0154] For example, Fig. 20As shown in the figure, in response to the question raised by the player, "Today's weather is really nice. I want to know what the ancients paid attention to in terms of diet. Would they enhance their wisdom through certain eating habits?" After intention analysis and task decision-making, the task decision model outputs "The player seems to be interested in the living habits of the ancients, especially their diet. This topic has no direct connection with the content recommended by the NPC, so the NPC can continue to discuss ancient knowledge and try to guide the conversation to the topic of learning and improving wisdom."
[0155] Step 240: Perform answer generation processing based on the character dialogue intention information and the dialogue task decision information to obtain question answer information corresponding to the target dialogue question information.
[0156] As an implementation method, based on the target dialogue question information, the role dialogue intention information and the dialogue task decision information, a question answer prompt can be constructed. Furthermore, the question answer prompt is input into the trained question answer model for question answer processing, and the question answer information corresponding to the target dialogue question information can be obtained. For example, Fig. 22 Schematic diagram of question answering prompts shown. The question answering prompts may include target dialogue question information, character dialogue intention information, dialogue task decision information, and question answering instructions. The question answering model can generate question answer information corresponding to the target dialogue question information based on the question answering prompts, for example Fig. 20 The NPC replied, "In fact, although diet can regulate emotions, the improvement of wisdom still requires more study and thinking. If you are interested, you can study some ancient books, which will be more helpful than simply pursuing diet." In this way, the task decision-making model and the question answering model allow players to have multiple rounds of dialogue with NPCs.
[0157] See also Fig.23 , which shows a structural block diagram of a dialog task model training device 300 provided by an embodiment of the present disclosure. The dialog task model training device 300 may include a data construction module 310, a task construction module 320, a decision processing module 330, a loss determination module 340 and a model training module 350.
[0158] The data construction module 310 is used to obtain the dialogue question information in the dialogue task, input the thought chain prompt words constructed based on the dialogue question information into the task decision model for task decision processing, and obtain the target dialogue intention information and the target task decision information;
[0159] The task construction module 320 is used to obtain task context information, task attribute configuration information and task execution strategy information, and construct a task decision prompt through the dialogue question information, the task context information, the task attribute configuration information and the task execution strategy information;
[0160] A decision processing module 330 is used to input the task decision prompt into the task decision model for task decision processing to obtain predicted dialogue intention information and predicted task decision information;
[0161] A loss determination module 340, configured to determine a target loss based on a difference between the predicted dialogue intention information and the target dialogue intention information, and a difference between the predicted task decision information and the target task decision information;
[0162] The model training module 350 is used to train the task decision model according to the target loss to obtain a trained task decision model.
[0163] In some embodiments, the data construction module 310 may include a question generation submodule, a thought generation submodule, and an information generation submodule.
[0164] The question generation submodule is used to generate dialogue question information in the dialogue task based on the role simulation model;
[0165] A thought generation submodule, used for constructing a thought chain prompt according to the thought chain indication information, the task context information, the task attribute configuration information, the task execution strategy information and the dialogue question information;
[0166] The information generation submodule is used to input the thought chain prompt into the task decision model for task decision processing to obtain target dialogue intention information and target task decision information.
[0167] In some embodiments, the thought generation submodule may be specifically used to:
[0168] Acquire thought chain indication information, wherein the thought chain indication information at least includes task relevance judgment indication words, task advancement direction indication words and task decision indication words;
[0169] Acquire task context information, where the task context information at least includes historical dialogue information between a task participating role and a task promoting role;
[0170] Acquire task attribute configuration information, wherein the task attribute configuration information at least includes task target information and role attribute information corresponding to the task advancement role;
[0171] Acquire task execution strategy information, wherein the task execution strategy information includes at least a role matching indicator, a dialogue experience indicator, a task avoidance indicator, and a dialogue time indicator;
[0172] Based on the thought chain indication information, the task context information, the task attribute configuration information, the task execution strategy information and the dialogue question information, a thought chain prompt is constructed.
[0173] In some embodiments, the question generation submodule may be specifically used to:
[0174] Obtaining task participant role attribute information, dialogue generation requirement information, task context information, and dialogue question examples corresponding to the dialogue task;
[0175] Constructing a question generation prompt based on the task participating role attribute information, the dialogue generation requirement information, the task context information and the dialogue question example;
[0176] The question generation prompt is input into the role simulation model for question generation processing to obtain dialogue question information.
[0177] In some embodiments, the task participating role attribute information includes at least role characteristic information, role preference information and role cooperation information, and the role cooperation information is used to characterize the cooperation of the task participating role in the dialogue interaction with the task promoting role.
[0178] In some embodiments, the data construction module 310 may further include a reply processing submodule, a state determination submodule, an information preservation submodule, and a redetermination submodule.
[0179] A reply processing submodule is used to input the question reply prompt constructed by the target dialogue intention information and the target task decision information into the question reply model for question reply processing to obtain question reply information corresponding to the dialogue question information;
[0180] A state determination submodule, used to determine the task state of the dialogue question information and the question answer information through a task judgment model to obtain the task state corresponding to the dialogue task;
[0181] An information saving submodule, used for saving the target dialogue intention information and the target task decision information when the task status is task completion;
[0182] The redetermining submodule is used to return the dialogue question information in the dialogue task generated based on the role simulation model when the task status is an unfinished task, so as to regenerate the dialogue question information and the corresponding target dialogue intention information and target task decision information, and redetermine the task status until the task status is determined to be a completed task, and the target dialogue intention information and target task decision information when the task is completed will be saved.
[0183] In some embodiments, the state determination submodule may be specifically used to:
[0184] Get status determination instruction;
[0185] Constructing a task status determination prompt based on the status determination instruction, the dialogue question information, and the question answer information;
[0186] The task status determination prompt is input into the task judgment model to determine the task status, and the task status corresponding to the dialogue task is obtained.
[0187] In some embodiments, the data construction module 310 may further include an example acquisition submodule, a judgment prompt submodule, and a model fine-tuning submodule.
[0188] An example acquisition submodule, used to acquire a preset number of task state determination examples, wherein each task state determination example includes sample dialogue question information, sample question answer information, and a target task state;
[0189] A judgment prompt submodule is used to construct a corresponding task status judgment prompt for each task status example, and obtain a preset number of task status judgment prompts;
[0190] The model fine-tuning submodule is used to input the preset number of task status judgment prompts into the task judgment model for fine-tuning.
[0191] In some embodiments, the reply processing submodule may be specifically configured to:
[0192] Get information on response requirements and sample responses to questions;
[0193] A question answer prompt constructed based on the answer requirement information, the question answer example, the dialogue question information, the target dialogue intention information and the target task decision information;
[0194] The question answer prompt is input into the question answer model for question answer processing to obtain question answer information corresponding to the dialogue question information.
[0195] In some embodiments, the model training module 350 may be specifically used to:
[0196] The first weight parameter corresponding to the task decision model and the second weight parameter corresponding to the question answering model are iteratively trained according to the target loss until a training end condition is met, thereby obtaining a trained task decision model and question answering model.
[0197] In some embodiments, the loss determination module 340 may be specifically configured to:
[0198] Constructing a response generation prompt according to the dialogue question information, the predicted dialogue intention information, and the predicted task decision information;
[0199] Inputting the answer generation prompt into the question answering model for question answering processing to obtain predicted question answer information;
[0200] Based on the difference between the predicted dialogue intention information and the target dialogue intention information, the difference between the predicted task decision information and the target task decision information, and the difference between the predicted question answer information and the target question answer information, a target loss is determined.
[0201] This embodiment can obtain the dialogue question information in the dialogue task, input the thought chain prompt constructed based on the dialogue question information into the task decision model for task decision processing, and obtain the target dialogue intention information and the target task decision information. In this way, by inputting the thought chain prompt constructed based on the prompt engineering into the task decision model, the task decision model can accurately infer and analyze the target dialogue intention information of the dialogue question information of the task participating role through the thought chain strategy, and generate the target task decision information to be used to determine the way to answer the dialogue question information. Then, the dialogue question information, and the target dialogue intention information and the target task decision information corresponding to the dialogue question information can be used as training data for training the task decision model. Then, by constructing the task decision prompt through the acquired dialogue question information, task context information, task attribute configuration information and task execution strategy information, and inputting the task decision prompt into the task decision model for task decision processing, the predicted dialogue intention information and the predicted task decision information are obtained, and then the target loss is determined based on the difference between the predicted dialogue intention information and the target dialogue intention information, and the difference between the predicted task decision information and the target task decision information. Therefore, the task decision model is trained through the target loss, so that the task decision model can take the target dialogue intention information and the target task decision information as learning goals, and learn the ability to accurately analyze and derive dialogue intentions and task decisions from given dialogue question information. Compared with the related technology that directly generates answers to questions in the dialogue task, the embodiment of the present disclosure can first accurately analyze the dialogue intentions of the task participants based on the dialogue question information, and generate reasonable task decisions according to the dialogue intentions to guide the model to generate question responses that meet the current dialogue scenario, thereby effectively improving the dialogue task model When facing complex and changeable dialogue needs, the accuracy and timeliness of the dialogue.
[0202] See also Fig.24 , which shows a structural block diagram of a dialogue generation device 400 provided by an embodiment of the present disclosure. The dialogue generation device 400 may include a question acquisition module 410, a prompt construction module 420, a decision processing module 430 and an answer generation module 440.
[0203] The question acquisition module 410 is used to acquire target dialogue question information corresponding to the target dialogue role;
[0204] A prompt construction module 420, configured to construct a dialogue decision prompt based on the target dialogue question information;
[0205] An information generation module 430 is used to input the dialogue decision prompt into the task decision model for decision processing to obtain character dialogue intention information and dialogue task decision information;
[0206] An answer generation module 440 is used to perform answer generation processing according to the character dialogue intention information and the dialogue task decision information to obtain question answer information corresponding to the target dialogue question information;
[0207] Wherein, the task decision model is obtained according to the dialogue task model training method in the above embodiment.
[0208] In some embodiments, the answer generation module 440 may be specifically configured to:
[0209] Constructing a question answer prompt based on the target dialogue question information, the character dialogue intention information, and the dialogue task decision information;
[0210] Inputting the question answer prompt into the trained question answering model for question answering processing to obtain question answer information corresponding to the target dialogue question information;
[0211] The trained question answering model is obtained according to the dialogue task model training method in the above embodiment.
[0212] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules, etc. can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0213] In several embodiments provided in the present disclosure, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0214] In addition, each functional module in each embodiment of the present disclosure may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0215] like Fig.25As shown, the embodiment of the present disclosure also provides a computer device 500, which can be in various forms such as a desktop computer or a laptop computer. The computer device 500 includes a processor 510, a memory 520, a power supply 530 and an input unit 540. The memory 520 stores a computer program. When the computer program is called by the processor 510, the various method steps provided in the above embodiments can be implemented. It can be understood by those skilled in the art that the structure of the computer device shown in the figure does not constitute a limitation on the computer device, and it can include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0216] The processor 510 may include one or more processing cores. The processor 510 uses various interfaces and lines to connect various parts of the entire battery management system, and by running or executing instructions, programs, instruction sets or program sets stored in the memory 520, calls the data stored in the memory 520, executes various functions of the battery management system and processes data, and executes various functions and processes data of the computer device, thereby controlling the computer device as a whole. Optionally, the processor 510 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 510 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, object interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 510, but may be implemented separately through a communication chip.
[0217] The memory 520 may include a random access memory (RAM) or a read-only memory (ROM). The memory 520 may be used to store instructions, programs, instruction sets or program sets. The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data (such as a phone book and audio and video data) created by the computer device during use. Accordingly, the memory 520 may also include a memory controller to provide the processor 510 with access to the memory 520.
[0218] The power supply 530 can be logically connected to the processor 510 through a power management system, so as to manage charging, discharging, power consumption, etc. through the power management system. The power supply 530 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0219] The input unit 540 may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to object setting and function control.
[0220] Although not shown, the computer device 500 may also include an output unit, a display unit, etc., which are not described in detail herein. Specifically, in the embodiment of the present disclosure, the processor 510 of the computer device will load the executable files corresponding to the processes of one or more computer programs into the memory 520 according to the following instructions, and the processor 510 will run the data stored in the memory 520, such as the phone book and audio and video data, so as to implement the various method steps provided in the aforementioned embodiments.
[0221] like Fig.26 As shown, the embodiment of the present disclosure further provides a computer-readable storage medium 600, in which a computer program 610 is stored. The computer program 610 can be called by a processor of a computer device to execute various method steps provided by the embodiment of the present disclosure.
[0222] The computer readable storage medium may be an electronic memory such as a flash memory, an electrically erasable programmable read-only memory (EEPROM), a hard disk or a ROM. Alternatively, the computer readable storage medium may also be a non-transitory computer readable storage medium. The computer readable storage medium 600 has storage space for a computer program that executes any of the method steps in the above embodiments. These computer programs may be read from or written into one or more computer program products. The computer program may be compressed in an appropriate form.
[0223] According to one aspect of the present disclosure, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device performs various method steps provided in the above embodiments.
[0224] The terms "include" and "comprising" in the specification of the present disclosure and the above-mentioned drawings and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. "At least one (item)" means one or more, and "multiple" means two or more. Greater than, less than, exceeding, etc. are understood to exclude the number. Above, below, within, etc. are understood to include the number. The term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that contains the function of the module or unit.
[0225] In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0226] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of software functional units.
[0227] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a program product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present disclosure. It should also be understood that the various implementation methods provided in the embodiments of the present disclosure can be arbitrarily combined to achieve different technical effects.
[0228] The above are only preferred embodiments of the present disclosure, and are not intended to limit the present disclosure in any form. Although the present disclosure has been disclosed as above in the form of preferred embodiments, it is not intended to limit the present disclosure. Any technical personnel in this field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present disclosure. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present disclosure without departing from the content of the technical solution of the present disclosure are still within the scope of the technical solution of the present disclosure.
Claims
1. A method for training a dialogue task model, characterized in that: The method comprises: Acquire dialogue question information in the dialogue task, input the thought chain prompts constructed based on the dialogue question information into the task decision model for task decision processing, and obtain target dialogue intention information and target task decision information; Acquire task context information, task attribute configuration information and task execution strategy information, and construct a task decision prompt through the dialogue question information, the task context information, the task attribute configuration information and the task execution strategy information; Inputting the task decision prompt into the task decision model for task decision processing to obtain predicted dialogue intention information and predicted task decision information; Determining a target loss based on a difference between the predicted conversation intention information and the target conversation intention information, and a difference between the predicted task decision information and the target task decision information; The task decision model is trained according to the target loss to obtain a trained task decision model.
2. The method according to claim 1, characterized in that The step of obtaining the dialogue question information in the dialogue task, inputting the thought chain prompts constructed based on the dialogue question information into the task decision model for task decision processing, and obtaining the target dialogue intention information and the target task decision information includes: Generate dialogue question information in dialogue tasks based on the role simulation model; Constructing a thinking chain prompt according to the thinking chain indication information, the task context information, the task attribute configuration information, the task execution strategy information and the dialogue question information; The thought chain prompt is input into the task decision model for task decision processing to obtain target dialogue intention information and target task decision information.
3. The method according to claim 2, characterized in that The step of constructing a thought chain prompt according to the thought chain indication information, the task context information, the task attribute configuration information, the task execution strategy information and the dialogue question information includes: Acquire thought chain indication information, wherein the thought chain indication information at least includes task relevance judgment indication words, task advancement direction indication words and task decision indication words; Acquire task context information, where the task context information at least includes historical dialogue information between a task participating role and a task promoting role; Acquire task attribute configuration information, wherein the task attribute configuration information at least includes task target information and role attribute information corresponding to the task advancement role; Acquire task execution strategy information, wherein the task execution strategy information includes at least a role matching indicator, a dialogue experience indicator, a task avoidance indicator, and a dialogue time indicator; Based on the thought chain indication information, the task context information, the task attribute configuration information, the task execution strategy information and the dialogue question information, a thought chain prompt is constructed.
4. The method according to claim 2, characterized in that: The step of generating dialogue question information in a dialogue task based on a role simulation model includes: Obtaining task participant role attribute information, dialogue generation requirement information, task context information, and dialogue question examples corresponding to the dialogue task; Constructing a question generation prompt based on the task participating role attribute information, the dialogue generation requirement information, the task context information and the dialogue question example; The question generation prompt is input into the role simulation model for question generation processing to obtain dialogue question information.
5. The method according to claim 4, characterized in that The task participating role attribute information includes at least role characteristic information, role preference information and role cooperation information, and the role cooperation information is used to characterize the cooperation degree of the task participating role in the dialogue interaction with the task promoting role.
6. The method according to claim 2, characterized in that The method further comprises: Inputting the question answering prompt constructed by the target dialogue intention information and the target task decision information into the question answering model for question answering processing to obtain question answering information corresponding to the dialogue question information; Determine the task status of the dialogue question information and the question answer information through a task judgment model to obtain the task status corresponding to the dialogue task; When the task status is task completion, saving the target dialogue intention information and target task decision information; When the task status is an unfinished task, the dialogue question information in the dialogue task generated based on the role simulation model is returned to regenerate the dialogue question information and the corresponding target dialogue intention information and target task decision information, and re-determine the task status until the task status is determined to be a completed task, and the target dialogue intention information and target task decision information when the task is completed will be saved.
7. The method according to claim 6, characterized in that The step of determining the task status of the dialogue question information and the question answer information by using a task judgment model to obtain the task status corresponding to the dialogue task includes: Get status determination instruction; Constructing a task status determination prompt based on the status determination instruction, the dialogue question information, and the question answer information; The task status determination prompt is input into the task judgment model to determine the task status, and the task status corresponding to the dialogue task is obtained.
8. The method according to claim 7, characterized in that Before determining the task status of the dialogue question information and the question answer information by using the task judgment model, the method further includes: Acquire a preset number of task status determination examples, wherein each task status determination example includes sample dialogue question information, sample question answer information, and a target task status; Constructing corresponding task status judgment prompts for each task status example to obtain a preset number of task status judgment prompts; The preset number of task status judgment prompts are input into the task judgment model for fine-tuning.
9. The method according to any one of claims 6 to 8, characterized in that: The question answering prompt constructed by the target dialogue intention information and the target task decision information is input into the question answering model for question answering processing to obtain question answering information corresponding to the dialogue question information, including: Get information on response requirements and sample responses to questions; A question answer prompt constructed based on the answer requirement information, the question answer example, the dialogue question information, the target dialogue intention information and the target task decision information; The question answer prompt is input into the question answer model for question answer processing to obtain question answer information corresponding to the dialogue question information.
10. The method according to claim 1, characterized in that The step of training the task decision model according to the target loss to obtain a trained task decision model includes: The first weight parameter corresponding to the task decision model and the second weight parameter corresponding to the question answering model are iteratively trained according to the target loss until a training end condition is met, thereby obtaining a trained task decision model and question answering model.
11. The method according to claim 10, characterized in that The determining of the target loss based on the difference between the predicted dialogue intention information and the target dialogue intention information, and the difference between the predicted task decision information and the target task decision information, includes: Constructing a response generation prompt according to the dialogue question information, the predicted dialogue intention information, and the predicted task decision information; Inputting the answer generation prompt into the question answering model for question answering processing to obtain predicted question answer information; Based on the difference between the predicted dialogue intention information and the target dialogue intention information, the difference between the predicted task decision information and the target task decision information, and the difference between the predicted question answer information and the target question answer information, a target loss is determined.
12. A method for generating a dialogue, characterized in that: The method comprises: Obtain target dialogue question information corresponding to the target dialogue role; Constructing a dialogue decision prompt based on the target dialogue question information; Inputting the dialogue decision prompt into the trained task decision model for decision processing to obtain character dialogue intention information and dialogue task decision information; Perform answer generation processing according to the character dialogue intention information and the dialogue task decision information to obtain question answer information corresponding to the target dialogue question information; Wherein, the trained task decision model is obtained according to the dialogue task model training method according to any one of claims 1 to 11.
13. The method according to claim 12, characterized in that The answer generation process is performed according to the character dialogue intention information and the dialogue task decision information to obtain the question answer information corresponding to the target dialogue question information, including: Constructing a question answer prompt based on the target dialogue question information, the character dialogue intention information, and the dialogue task decision information; Inputting the question answer prompt into the trained question answering model for question answering processing to obtain question answer information corresponding to the target dialogue question information; Wherein, the trained question answering model is obtained according to the dialogue task model training method according to any one of claims 10 to 11.
14. A model training device for a dialogue task, characterized in that: The device comprises: A data construction module is used to obtain dialogue question information in a dialogue task, input a thought chain prompt constructed based on the dialogue question information into a task decision model for task decision processing, and obtain target dialogue intention information and target task decision information; A task construction module, used to obtain task context information, task attribute configuration information and task execution strategy information, and construct a task decision prompt through the dialogue question information, the task context information, the task attribute configuration information and the task execution strategy information; A decision processing module, used for inputting the task decision prompt into the task decision model for task decision processing to obtain predicted dialogue intention information and predicted task decision information; A loss determination module, configured to determine a target loss based on a difference between the predicted dialogue intention information and the target dialogue intention information, and a difference between the predicted task decision information and the target task decision information; The model training module is used to train the task decision model according to the target loss to obtain a trained task decision model.
15. A dialogue generation device, characterized in that: The device comprises: A question acquisition module is used to obtain target dialogue question information corresponding to the target dialogue role; A prompt construction module, used to construct a dialogue decision prompt based on the target dialogue question information; A decision processing module, used to input the dialogue decision prompt into the task decision model for decision processing, and obtain role dialogue intention information and dialogue task decision information; An answer generation module is used to perform answer generation processing according to the character dialogue intention information and the dialogue task decision information to obtain question answer information corresponding to the target dialogue question information; Wherein, the task decision model is obtained according to the dialogue task model training method according to any one of claims 1 to 11.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the dialogue task model training method according to any one of claims 1 to 11, or the dialogue generation method according to any one of claims 12 to 13 is implemented.
17. A computer device, characterized in that: include: Memory; A processor, wherein a computer program is stored on the memory, and when the computer program is executed by the processor, the dialog task model training method according to any one of claims 1 to 11, or the dialog generation method according to any one of claims 12 to 13 is implemented.
18. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the dialogue task model training method described in any one of claims 1 to 11, or the dialogue generation method described in any one of claims 12 to 13.
Citation Information
Cited By
Task processing model evaluation method, role playing model evaluation method and task processing method
CN120744423A
Evaluation methods for task processing models, evaluation methods for role-playing models, and task processing methods
CN120744423B