Dialogue model training method, related method, device, equipment and storage medium
By acquiring and standardizing the text data matched by dialogue tasks, high-quality dialogue content is generated, and dialogue models are trained and tested. This solves the problem of insufficient training data for large language models and improves the dialogue performance and accuracy of task-oriented dialogue systems.
Patent Information
- Application Number
- CN202410544192.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2025-11-04
Smart Images

Figure CN120892514A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and more particularly, to a dialog model training method and related method, device, equipment and storage medium. BACKGROUND
[0002] A task-oriented dialog system is a human-computer interaction system designed to complete specific tasks or provide specific services. This system usually uses natural language understanding and generation technology to enable users to communicate with the system in a natural language manner and obtain the required information or complete specific tasks. Task-oriented dialog systems can be applied to customer service, intelligent assistants, online shopping, etc., to improve service efficiency, convenience and user experience through intelligent means.
[0003] Currently, large language models play a key role in task-oriented dialog systems. Large language models provide powerful language understanding and generation capabilities, accurately identify user intent, generate natural and fluent responses, enrich dialog context understanding, achieve personalized and emotional interaction, and provide accurate answers using knowledge reasoning. Large language models in task-oriented dialog systems are pre-processed, trained and optimized to improve their dialog understanding and generation capabilities.
[0004] However, although the application of task-oriented dialog systems developed based on large language models is powerful, due to poor quality of training data, for example, errors or biases in training data, it is difficult for large language models to fully learn and master complex patterns and user intent in the task-oriented dialog process, which leads to poor dialog performance and low accuracy of answers in the actual application of task-oriented dialog systems developed based on large language models. SUMMARY
[0005] The embodiments of the present application provide a dialog model training method and related method, device, equipment and storage medium. The quality of the training data can be improved to solve the problem of poor dialog performance and low accuracy of answers in the actual application of task-oriented dialog systems developed based on large language models in related technologies.
[0006] According to an aspect of the present application, a training method of a dialogue model is provided, which comprises: obtaining target text data matched with a dialogue task; performing topic classification on the target text data to obtain topic factual content corresponding to each dialogue topic under the dialogue task; generating corresponding prompt information according to each topic factual content, and inputting the prompt information into a trained generation model to generate dialogue, thereby obtaining multiple initial dialogue contents; performing content specification processing on each initial dialogue content to obtain multiple target dialogue contents after content specification processing; generating multiple target dialogue prompt information based on the multiple target dialogue contents, and inputting each target dialogue prompt information into a dialogue model to perform dialogue task training, thereby obtaining a trained dialogue model.
[0007] According to an aspect of the present application, a testing method of a dialogue model is provided, which comprises: obtaining multiple target dialogue contents and multiple out-of-domain dialogue contents matched with a dialogue task; performing random sampling on the multiple target dialogue contents and the multiple out-of-domain dialogue contents to obtain multiple sampling dialogue contents, and generating sampling prompt information corresponding to each sampling dialogue content; inputting each sampling prompt information into a trained dialogue model to perform task dialogue, thereby obtaining testing dialogue contents; testing the trained dialogue model according to the testing dialogue contents and evaluation indexes, thereby obtaining a testing result, which indicates dialogue performance of the trained dialogue model under the dialogue task; wherein the trained dialogue model is obtained by the training method of the dialogue model described above.
[0008] According to an aspect of the present application, a training device of a dialogue model is provided, which comprises:
[0009] a data obtaining module configured to obtain target text data matched with a dialogue task;
[0010] a topic classification module configured to perform topic classification on the target text data to obtain topic factual content corresponding to each dialogue topic under the dialogue task;
[0011] a dialogue generation module configured to generate corresponding prompt information according to each topic factual content, and input the prompt information into a trained generation model to generate dialogue, thereby obtaining multiple initial dialogue contents;
[0012] a content specification module configured to perform content specification processing on each initial dialogue content to obtain multiple target dialogue contents after content specification processing;
[0013] a model training module configured to generate multiple target dialogue prompt information based on the multiple target dialogue contents, and input each target dialogue prompt information into a dialogue model to perform dialogue task training, thereby obtaining a trained dialogue model.
[0014] Optionally, the trained generation model comprises a first dialogue generator and a second dialogue generator, and the dialogue generation module can comprise a template acquisition unit, a prompt generation unit, a weight acquisition unit, and a first generation unit. The template acquisition unit is configured to acquire a preset prompt template; the prompt generation unit is configured to generate prompts based on the preset prompt template for each topic fact content to obtain a plurality of prompt information; the weight acquisition unit is configured to acquire a rate weight value corresponding to a dialogue generation rate and a quality weight value corresponding to a dialogue generation quality in the dialogue task; and the first generation unit is configured to control the first dialogue generator and the second dialogue generator to generate dialogue based on the plurality of prompt information when the rate weight value is less than the quality weight value to obtain a plurality of initial dialogue contents.
[0015] Optionally, the first generation unit can comprise a state acquisition subunit and a dialogue generation subunit. The state acquisition subunit is configured to acquire a plurality of dialogue states, the dialogue states being used to indicate dialogue in different states by the first dialogue generator and the second dialogue generator; and the dialogue generation subunit is configured to control the first dialogue generator and the second dialogue generator to generate dialogue based on the plurality of prompt information and the plurality of dialogue states to obtain a plurality of initial dialogue contents.
[0016] Optionally, the dialogue generation subunit can comprise: a first sub-subunit configured to send a start dialogue instruction to the first dialogue generator to enable the first dialogue generator to generate dialogue based on first prompt information determined from the plurality of prompt information to obtain start dialogue content; a second sub-subunit configured to send a first dialogue instruction to the second dialogue generator to enable the second dialogue generator to generate dialogue based on the start dialogue content and a first dialogue state randomly determined from the plurality of dialogue states to obtain first dialogue content; a third sub-subunit configured to send a second dialogue instruction to the first dialogue generator to enable the first dialogue generator to generate dialogue based on the first dialogue content and a second dialogue state randomly determined from the plurality of dialogue states to obtain second dialogue content; and a fourth sub-subunit configured to return to execute the start dialogue instruction to the first dialogue generator to repeatedly execute dialogue generation operations for a preset number of rounds, collect start dialogue content, first dialogue content, and second dialogue content corresponding to each round of dialogue generation operation, and obtain a plurality of initial dialogue contents.
[0017] Optionally, the dialogue generation subunit can further include a fifth subunit configured to count the number of states corresponding to each dialogue state in the plurality of dialogue states in each round of dialogue generation operation; and a fourth subunit configured to: save the plurality of initial dialogue contents when it is detected that the number of states corresponding to each dialogue state in the plurality of dialogue states is greater than a preset threshold; and return to execute the sending of the start dialogue instruction to the first dialogue generator to repeat the dialogue generation operation for a preset number of rounds until the number of states corresponding to each dialogue state in the plurality of dialogue states is greater than the preset threshold, thereby obtaining the plurality of initial dialogue contents.
[0018] Optionally, the dialogue generation module can further include a second generation unit configured to input the plurality of prompt information to the first dialogue generator for dialogue generation for multiple rounds when the rate weight value is not less than the quality weight value, thereby obtaining the plurality of initial dialogue contents.
[0019] Optionally, the content specification module can include a specification unit and an optimization unit. The content specification unit is configured to perform content specification processing on each initial dialogue content to obtain a plurality of specification dialogue contents after content specification processing; and the content optimization unit is configured to perform content optimization processing on each specification dialogue content through a plurality of statistical indicators to obtain a plurality of target dialogue contents after content optimization processing.
[0020] Optionally, the content specification unit can be specifically configured to: perform data cleaning on the each initial dialogue content to obtain a plurality of intermediate dialogue contents; perform data structuring on each intermediate dialogue content to obtain a plurality of structured dialogue contents, wherein the data structuring is at least configured to add a content label to the intermediate dialogue content; and perform data augmentation on each structured dialogue content to obtain a plurality of specification dialogue contents.
[0021] Optionally, the content label includes at least a dialogue topic label and a dialogue round label, and the plurality of statistical indicators includes at least a topic distribution and a round proportion, and the content optimization unit can include a topic subunit, a round subunit, an analysis subunit, and an adjustment subunit. The topic subunit is configured to count the dialogue topic label of each specification dialogue content to obtain the topic distribution; the round subunit is configured to count the dialogue round label of each specification dialogue content to obtain the round proportion; the analysis subunit is configured to statistically analyze the topic distribution and the round proportion to obtain corresponding topic analysis results and round analysis results; and the adjustment subunit is configured to adjust the dialogue content of each specification dialogue content based on the topic analysis results and the round analysis results to obtain the plurality of target dialogue contents.
[0022] Optionally, the adjusting subunit can be specifically configured to: when the topic analysis result indicates that the topic distribution is unqualified and the round number analysis result indicates that the round number proportion is qualified, determine an abnormal topic from each standard dialogue content, and perform dialogue content supplement processing on the abnormal topic to obtain a plurality of target dialogue contents after dialogue content supplement processing; when the topic analysis result indicates that the topic distribution is qualified and the round number analysis result indicates that the round number proportion is unqualified, determine an abnormal round from each standard dialogue content, and perform dialogue content supplement processing on the abnormal round to obtain a plurality of target dialogue contents after dialogue content supplement processing; and when the topic analysis result indicates that the topic distribution is unqualified and the round number analysis result indicates that the round number proportion is unqualified, determine an abnormal topic and an abnormal round from each standard dialogue content, and perform dialogue content supplement processing on the abnormal round and dialogue content supplement processing on the abnormal round to obtain a plurality of target dialogue contents after dialogue content supplement processing.
[0023] Optionally, the topic classification module can be specifically configured to: perform data segmentation on the target text data to obtain a plurality of text data units; perform topic classification on the plurality of text data units to obtain a text data unit corresponding to each dialogue topic under the dialogue task, and take each text unit as topic fact content.
[0024] According to an aspect of the present application, a dialogue model testing device is provided, which comprises:
[0025] A dialogue obtaining module is configured to obtain a plurality of target dialogue contents and a plurality of out-of-domain dialogue contents matched with the dialogue task.
[0026] A prompt generating module is configured to randomly sample the plurality of target dialogue contents and the plurality of out-of-domain dialogue contents to obtain a plurality of sampled dialogue contents, and generate sampled prompt information corresponding to each sampled dialogue content.
[0027] A content generating module is configured to input each sampled prompt information into the trained dialogue model to perform task dialogue, and obtain test dialogue content.
[0028] A model testing module is configured to test the trained dialogue model according to the test dialogue content and the evaluation index to obtain a test result, wherein the test result indicates the dialogue performance of the trained dialogue model under the dialogue task.
[0029] The trained dialogue model is obtained by the dialogue model training method described above.
[0030] According to an aspect of the present application, a computer readable storage medium is provided, which stores a computer program, wherein the computer program, when executed by a processor, performs the training method of the dialogue model and the related method.
[0031] According to an aspect of the present application, a computer device is provided, which comprises a processor and a memory, the memory storing a computer program, the computer program being invoked by the processor to perform the training method of the dialogue model and the related method.
[0032] According to an aspect of the present application, a computer program product is provided, which comprises 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 performs the training method of the dialogue model and the related method.
[0033] The embodiments of the present application can obtain target text data matched with a dialogue task, perform topic classification on the target text data, obtain topic fact content corresponding to each dialogue topic under the dialogue task, further generate corresponding prompt information according to each topic fact content, input the prompt information into a trained generation model to generate dialogue, obtain multiple initial dialogue contents, and thus generate initial dialogue contents for training a dialogue model corresponding to the dialogue task based on the text data matched with the dialogue task.
[0034] Further, the initial dialogue contents are subjected to content specification processing to obtain multiple target dialogue contents subjected to content specification processing, so as to optimize the initial dialogue contents generated by the generation model in terms of quality, effectively guarantee the diversity and comprehensiveness of the target dialogue contents, and provide high-quality training data for training of the dialogue model. Further, multiple target dialogue prompt information is generated based on the multiple target dialogue contents, and each target dialogue prompt information is input into the dialogue model to perform dialogue task training, so as to obtain a trained dialogue model. In this way, the dialogue model is trained based on the high-quality target dialogue contents, which can improve the generalization ability and robustness of the dialogue model in the dialogue task, so that the dialogue performance of the task-oriented dialogue system based on the trained dialogue model is improved, and the accuracy of subsequent dialogue is enhanced.
[0035] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent to those skilled in the art from the description, or can be learned by practice of the present application. The objects and other advantages of the present application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0037] Figure 1 A system architecture diagram provided by an embodiment of the present application is shown.
[0038] Figure 2 A system deployment diagram provided by an embodiment of the present application is shown.
[0039] Figure 3 An application scenario diagram of a dialogue model training method provided by an embodiment of the present application is shown.
[0040] Figure 4 An application scenario diagram of another dialogue model training method provided by an embodiment of the present application is shown.
[0041] Figure 5 A flowchart of a dialogue model training method provided by an embodiment of the present application is shown.
[0042] Figure 6 An example diagram of a topic fact content provided by an embodiment of the present application is shown.
[0043] Figure 7 An example diagram of a prompt information provided by an embodiment of the present application is shown.
[0044] Figure 8 A flowchart of a multi-turn dialogue provided by an embodiment of the present application is shown.
[0045] Figure 9 A data structure diagram of a dialogue content provided by an embodiment of the present application is shown.
[0046] Figure 10 A flowchart of another dialogue model training method provided by an embodiment of the present application is shown.
[0047] Figure 11 A flowchart of a dialogue model training method provided by an embodiment of the present application is shown.
[0048] Figure 12 A flowchart of data acquisition and classification provided by an embodiment of the present application is shown.
[0049] Figure 13 A flowchart of dialogue generation provided by an embodiment of the present application is shown.
[0050] Figure 14A flowchart of generating a dialogue content based on a dialogue state is shown.
[0051] Figure 15 An example diagram of dialogue content of maintaining a theme is shown.
[0052] Figure 16 An example diagram of dialogue content of converting a theme is shown.
[0053] Figure 17 An example diagram of dialogue content of deepening a theme is shown.
[0054] Figure 18 An example diagram of dialogue content of no theme is shown.
[0055] Figure 19 A flowchart of data quality detection is shown.
[0056] Figure 20 A flowchart of prompt information optimization is shown.
[0057] Figure 21 A test flowchart of model testing is shown.
[0058] Figure 22 A performance evaluation capability diagram of a dialogue model is shown.
[0059] Figure 23 A module block diagram of a training device of a dialogue model is shown.
[0060] Figure 24 A module block diagram of a testing device of a dialogue model is shown.
[0061] Figure 25 A module block diagram of a computer device is shown.
[0062] Figure 26 A module block diagram of a computer readable storage medium is shown. DETAILED DESCRIPTION
[0063] In order for those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. The described embodiments are exemplary and are only used to explain the present application, and cannot be understood as a limitation on the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0064] In some processes described in the specification, claims and the above drawings, a plurality of steps are included, which appear in a specific order, but it should be clear that these steps can be executed or executed in parallel without the order in which they appear in this text, and the step number is only used to distinguish different steps, and the number itself does not represent any execution order. In addition, the descriptions such as "first", "second" and "target" in this text are used to distinguish similar objects, and do not necessarily describe a specific order, sequence or quantity.
[0065] It is worth noting that in the specific embodiments of the present application, the target text data and the domain outside the dialogue content and other data related to the privacy of the object. When the above embodiments of the present application are applied to specific products or technologies, the permission or consent of the object needs to be obtained, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards. For example, when the embodiments of the present application need to obtain target text data, the separate permission or separate consent of the relevant data such as target text data can be obtained through a pop-up window or jumping to a confirmation page, and after obtaining the separate permission or separate consent, the necessary related data for the normal operation of the embodiments of the present application is obtained.
[0066] Before further detailing the embodiments of the present application, the terms and terms related to the embodiments of the present application are explained, and the terms and terms related to the embodiments of the present application are explained as follows:
[0067] The training method of the dialogue model in the present application involves artificial intelligence (AI) technology. Artificial intelligence is the use of digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0068] Artificial intelligence technology is a comprehensive discipline involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include, for example, sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, pre-training model technologies, operation / interaction systems, mechatronics, etc. Among them, the pre-training model, also known as the large model or the base model, can be widely applied to downstream tasks in various directions of artificial intelligence after fine-tuning. Artificial intelligence software technologies mainly include computer vision technologies, speech processing technologies, natural language processing technologies, and machine learning / deep learning, etc.
[0069] Natural language processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can enable effective communication between people and computers using natural language. Natural language processing involves natural language, i.e., the language used in daily life, and is closely related to linguistic studies; at the same time, it involves computer science and mathematics. Pre-training models, an important technology in artificial intelligence model training, are developed from large models / large language models (LLM) in the field of NLP. After fine-tuning, large language models can be widely applied to downstream tasks. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robot question answering, knowledge graph, etc. For example, the prediction model used for disease prediction in the embodiments of the present application is a network architecture based on a large language model.
[0070] Pre-training models (PTM), also known as cornerstone models or large models, refer to deep neural networks (DNN) with large parameters. They are trained on a large amount of unlabeled data, and the function approximation capability of large parameter DNNs enables PTM to extract common features from the data. Through fine-tuning, prompt tuning, and other techniques, PTM is suitable for downstream tasks. Therefore, pre-training models can achieve ideal results in few-shot or zero-shot scenarios. PTM can be divided into language models, visual models, speech models, and multi-modal models according to the data modality they process. PTM is an important tool for outputting artificial intelligence generated content (AIGC) and can also serve as a general interface connecting multiple specific task models. For example, in the embodiments of the present application, a language model is used to generate disease prediction results.
[0071] Task-oriented dialogue systems are intelligent dialogue systems designed to assist users in completing specific tasks. These systems use natural language processing techniques to interact with users, understand their needs, and provide appropriate solutions. Task-oriented dialogue systems typically consist of several key components: speech recognition, which converts spoken input into text; natural language understanding, which analyzes and interprets user input; dialogue management, which maintains the context of the conversation and responds appropriately based on user input and system state; and speech synthesis, which converts system responses into natural language or speech output. Task-oriented dialogue systems can be applied in various fields such as customer service, information retrieval, and smart home control. They help users efficiently complete specific tasks, improve user experience, and their functionality and performance continue to improve with advancements in artificial intelligence technology.
[0072] Large language model technology plays an important role in task-oriented dialogue systems. This technology uses deep learning algorithms trained on massive amounts of text data, enabling the system to more accurately understand user input and generate natural and fluent responses. First, large language models have learned rich language knowledge and grammar rules through learning vast amounts of text data, enabling them to accurately understand user intent and expression. Second, the model can generate coherent responses based on contextual information, as it can analyze the history of the conversation and context to better understand user needs. In addition, large language models can help dialogue systems handle complex tasks such as information retrieval, recommendation, and decision-making. Through continuous self-learning and optimization, large language models can continuously improve the performance and intelligence of dialogue systems, providing users with more personalized and efficient service experiences. In task-oriented dialogue systems, the application of large language models has become one of the important means to improve dialogue quality and user satisfaction.
[0073] Currently, the training method of large language models used in task-oriented dialogue systems is usually based on fine-tuning for specific dialogue tasks. First, collect a large amount of dialogue data related to the task, such as user-system dialogue records. Then, select a suitable large language model as the base model and initialize its parameters. Next, fine-tune the model using task-related data to adjust the model parameters to adapt to the language characteristics and needs of the specific task. During fine-tuning, the model is trained on data related to the target dialogue task, gradually improving its performance on that task. Finally, the optimized large language model can be deployed in the task-oriented dialogue system for actual dialogue interaction. However, the training of large language models for task-oriented dialogue systems lacks rich and reliable training data, which leads to the trained large language models being unable to accurately communicate in dialogue tasks and having low dialogue performance.
[0074] To solve the above problems, the inventors have conducted research and proposed the method for training a dialogue model provided in the embodiments of the present application. The system architecture of the above method and related application scenarios involved in the present application will be described below.
[0075] Please refer to Figure 1 , Figure 1 A system architecture diagram is shown. As Figure 1 indicated, the above method provided in the embodiments of the present application can be applied in system 100. Data acquisition device 110 is used to acquire text data, which is text data matched for different dialogue tasks, for example, text data related to tourist attractions, travel strategies, etc. in a travel consultation dialogue task. After acquiring the text data, data acquisition device 110 can store the text data in original data pool 140, and then generation device 130 can use the trained generation model to generate dialogue based on the text data in original data pool 140, obtain a large amount of dialogue content, and store these dialogue contents in database 120.
[0076] Training device 150 can train dialogue model based on a large amount of dialogue content in database 120 to obtain trained dialogue model 101. The generation model and dialogue model of generation device 130 are agents based on a large language model framework, which can include ChatGPT (Conversational Generative Pre-trained Transformer), T5 (Text-To-Text Transfer Transformer), RoBERTa (Robustly optimized BERT approach), etc., which are not limited here. Optionally, the text data maintained in original data pool 140 does not necessarily come from data acquisition device 110, but can also be received from other devices, for example, execution device 160 can also act as a data acquisition end, acquire data of a dialogue process as new text data, and store it in original data pool 140.
[0077] The processing module 161 of the execution device 160 performs computing tasks, for example, the dialogue model 101 in the processing module 161 performs dialogue tasks. The processing module 161 can call data, programs, etc. in the data storage system 162 for corresponding computing processing when performing computing tasks, and store the processing results, etc. data and instructions obtained by computing processing in the data storage system 162. For example, the execution device 160 can store the dialogue generated by the dialogue model 101 in the data storage system 162.
[0078] The training device 150 and the execution device 160 described above can be computer devices such as servers or terminals. The server can be a stand-alone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), blockchains, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can be a smartphone, a tablet computer, a desktop computer, a vehicle terminal, and the like.
[0079] It should be noted that, Figure 1 The system architecture and application scenarios described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. For example, Figure 1 The data storage system 162 in the server 210 is an internal memory relative to the execution device 160, and in other cases, the data storage system 162 can be placed outside the execution device 160.
[0080] Please refer to Figure 2 , Figure 2 A system deployment schematic diagram is shown. Illustratively, the training method of the dialogue model and the related method provided by the embodiments of the present application can also be deployed in the system 200 as shown in Figure 2 The system includes a terminal 240, an Internet 230, a gateway 220, a server 210, and the like.
[0081] The terminal 240 can include desktop computers, notebook computers, personal digital assistants (PDAs), smartphones, medical dedicated terminals, intelligent customer service terminals, and the like. In addition, it can be a single device or a collection of multiple devices. The terminal 240 can communicate with the Internet 230 in a wired or wireless manner to exchange data. For example, the terminal 240 can communicate with the Internet 230 through a wireless router 250.
[0082] The server 210 refers to a computer system that can provide certain services to the terminal 240. Compared with the ordinary terminal 240, the server 210 has higher requirements in stability, security, performance, and the like. The server 210 can be a high-performance computer in a network platform, a cluster of multiple high-performance computers, a part of a high-performance computer (for example, a virtual machine), a combination of parts of multiple high-performance computers (for example, virtual machines), and the like.
[0083] The gateway 220 is also called an internetwork connector or a protocol converter. The gateway implements network interconnection at the transport layer and is a computer system or device that acts as a conversion device. The gateway is a translator between two systems that use different communication protocols, data formats or languages, or even have completely different architectures. At the same time, the gateway can also provide filtering and security functions. The messages sent by the terminal 240 to the server 210 can be transmitted to the corresponding server 210 through the gateway 220. The messages sent by the server 210 to the terminal 240 can also be transmitted to the corresponding terminal 240 through the gateway 220.
[0084] The training method of the dialogue model and the related method of the embodiments of the present application can be completely implemented on the terminal 240, can be completely implemented on the server 210, or can be partially implemented on the terminal 240 and partially implemented on the server 210.
[0085] As an implementation manner, the training method of the dialogue model and the related method can be completely implemented on the terminal 240. Illustratively, the terminal 240 can locally train the dialogue model as a generation device and a training device. Specifically, the terminal 240 can perform topic classification on the target text data after obtaining the target text data, obtain the topic fact content corresponding to each dialogue topic under the dialogue task, input the prompt information generated based on each topic fact content into the trained generation model for dialogue generation, obtain a plurality of initial dialogue contents, further, the terminal 240 can generate a plurality of target dialogue prompt information based on the plurality of target dialogue contents obtained by content specification processing on each initial dialogue content, and input each target dialogue prompt information into the dialogue model for dialogue task training, obtain the trained dialogue model, and perform performance testing on the trained dialogue model. Then, the terminal 240 can also execute the dialogue task locally using the trained dialogue model as an execution device.
[0086] As another implementation manner, the training method of the dialogue model and the related method can be completely implemented on the server 210. Illustratively, the server 210 can perform dialogue task training on the dialogue model based on the target text data as a generation device and a training device, obtain the trained dialogue model, and perform performance testing on the trained dialogue model. The server 210 can also execute the dialogue task using the trained dialogue model as an execution device. For example, the medical intelligent dialogue system deployed on the terminal 240 can obtain a medical question input by a user. At this time, the terminal 240 can send the medical question to the server 210, and then the server 210 uses the dialogue model to generate a dialogue for the medical question, obtains a reply content, and returns the reply content to the terminal 240, so that the medical intelligent dialogue system of the terminal 240 displays the reply content to the user.
[0087] As yet another implementation, the training method of the dialogue model and the related method can be partially implemented in the terminal 240 and partially implemented in the server 210. Illustratively, the server 210 can train the dialogue model as a generation device and a training device, and perform performance testing on the trained dialogue model, and the terminal 240 can serve as an execution device to locally deploy the dialogue model, and then directly use the dialogue model to perform a dialogue task.
[0088] It should be noted that, Figure 2 This is only a system deployment schematic diagram provided by the embodiments of the present application. The system deployment scheme described in the embodiments of the present application is only for more clearly illustrating the technical solutions of the embodiments of the present application, and does not constitute a limitation on the technical solutions provided by the embodiments of the present application. For example, the terminal 240 can generally refer to one of a plurality of terminals, and the embodiments of the present application only take three terminals shown in FIG. 2 as an example for illustration. Those skilled in the art can know that, as the system deployment scheme evolves, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. Figure 2 The technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0089] The embodiments of the present application can be applied in various scenarios, such as Figure 3 the AI-assisted diagnosis scenario shown in FIG. 1, Figure 4 the intelligent medical assistant scenario shown in FIG. 2, and the like.
[0090] (1) Intelligent customer service application scenario
[0091] Intelligent customer service can be a task-oriented dialogue system based on a large language model, which provides a solution for automatic customer service through a dialogue interface. It can interact with users through voice or text, answer user questions, and provide related services. The emergence of intelligent customer service can greatly improve the efficiency of customer service, reduce costs, and also improve customer experience and enhance customer loyalty. Therefore, more and more enterprises begin to use intelligent customer service to provide customer service. At present, intelligent customer service is supported by a large language model technology provided by a task-oriented dialogue system, which can meet users with clear purposes, such as checking traffic, checking phone bills, ordering meals, booking tickets, and consulting, etc.
[0092] Because the needs of users are relatively complex, usually multiple rounds of human-computer interaction can be performed, and users can continuously modify and improve their needs during the dialogue process. Intelligent customer service can help users clarify their purposes through inquiry, clarification, and confirmation. The training method of the dialogue model and the related method provided by the embodiments of the present application can obtain a trained dialogue model, and then a task-oriented dialogue system developed based on the dialogue model can provide customer service for users and realize dialogue communication between users and intelligent customer service.
[0093] As shown in Figure 3As shown, the user installs and logs in to the client: travel platform 241 on the computer terminal 240. The user can use the intelligent customer function of the travel platform 241 to conduct travel consultation, and the intelligent customer function can complete human-computer interaction. The cloud background 210 as a server can obtain the question or reply content input by the user on the travel platform 241, and generate a dialogue based on the question or reply content. Specifically, the cloud background 210 can include a resource server 211, a training server 212 and a customer service server 213. Among them, the resource server 211 is used to obtain target text data for training of a dialogue model, and generate dialogue content used for model training according to the target text data, the dialogue model is used for an intelligent customer service dialogue task of a travel platform, the target text data matches the intelligent customer service dialogue task, for example, information of popular scenic spots in a city, information of travel strategies, etc. The training server 212 is used to train the dialogue model based on the dialogue content generated by the resource server 211, to obtain a trained dialogue model. The customer service server 213 deploys the trained dialogue model, and is used to execute a dialogue task related to travel consultation.
[0094] The computer terminal 240 obtains the dialogue "I want to go to Huangshan from Hangzhou on May 1st" input by the user A, and then the customer service server 213 can generate the question "What is your travel mode?" for the dialogue input by the user A by using the dialogue model. The computer terminal 240 obtains the dialogue "high-speed rail" input by the user A again, and can generate corresponding other questions for the dialogue input by the user A by using the dialogue model. In this way, through multiple rounds of dialogue, corresponding travel strategies and suggestions are provided for the user's travel plan. Thus, the travel consultation service is completed for the user.
[0095] (2) Intelligent medical assistant
[0096] Medical assistant application (Application, APP) as a task-based dialogue system based on large language model, aims to provide convenient medical services and support for users. These applications usually have multiple functions to meet the needs of users in the field of medical health. Common functions of medical assistant APP include online consultation: users can communicate with doctors in real time through the APP to consult their condition and suggest treatment plans. Appointment registration: users can make appointments with doctors to save time waiting in line at the hospital. Health management: such as heart rate detection, blood pressure measurement, etc., to help users understand their physical condition in a timely manner.
[0097] The dialogue provided in the present application can be applied to the medical assistant 241. Specifically, the medical assistant 241 can be developed based on the encoder and prediction model in the present application. As shown in FIG. 2B, the medical assistant 241 can include a dialogue generation module 242 and a dialogue management module 243. Figure 4As shown, the user can input the question "Can I take fever-reducing medicine if the fever is 38.5?" on the medical assistant 241, and the medical assistant 241 replies to the question. Specifically, when the medical assistant 241 receives the question, it can send the question to the server in the background, and the server can further use the dialogue model to perform the relevant dialogue task. Specifically, the server can input the question input by the user into the dialogue model 101 to perform the dialogue task, obtain the reply content "Adults with a fever above 38.5 can take oral fever-reducing medicine according to the drug instructions", and return the reply content to the medical assistant 241 for display.
[0098] It should be noted that, Figure 3 and Figure 4 are only two application scenario diagrams provided by the embodiments of the present application. The application scenarios described in the embodiments of the present application are only for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. For example, in addition to the above application scenarios, the training method of the dialogue model proposed in the present application can also be used in the application scenarios of task-oriented dialogue such as intelligent homework tutoring and bank customer service. Those skilled in the art can know that with the evolution of application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0099] According to an embodiment of the present application, a training method of a dialogue model is provided. The training method of the dialogue model can be executed by a computer device (the computer device can be a server, an edge computing device, or other terminal devices with certain processing capabilities, etc.), which at least has the functions of storage, calculation and communication. Figure 5 A flowchart of the training method of the dialogue model provided by the embodiment is shown. As shown in the figure, Figure 5 the training method of the dialogue model can specifically include:
[0100] S110: Obtain target text data matched with the dialogue task.
[0101] Considering that in a task-oriented dialogue system (hereinafter referred to as dialogue system) developed based on a large language model, the large language model is the core component of the dialogue system, which is used to understand user input, generate dialogue response and maintain the coherence and context of the dialogue. For this purpose, the present application proposes to obtain text data matched with a specific dialogue task for training a large language model, i.e. a dialogue model, in order to improve the dialogue performance of the dialogue model on the specific dialogue task.
[0102] wherein the dialogue task refers to a specific task that the dialogue system needs to perform, and the user completes the task by having a dialogue with the dialogue system. The dialogue system is usually designed to perform a specific task, such as booking a restaurant, querying the weather, planning a trip, etc. The dialogue task can include elements such as task goal, requirement information, dialogue flow, and task completion condition. The task goal refers to the specific task or goal that the dialogue system needs to complete, the requirement information refers to the information that the dialogue system needs to obtain from the user to complete the task, the dialogue flow defines the interaction process between the dialogue system and the user, including how the dialogue system asks questions and how it processes the user's answers, etc., and the task completion condition refers to the condition for the dialogue system to judge whether the task is completed.
[0103] For example, a dialogue task of booking a restaurant can include the following elements: task goal: booking a restaurant. Requirement information: booking date, booking time, number of diners, restaurant type (such as Chinese or Western), special requirements (such as allergenic food), etc. Dialogue flow, i.e. the dialogue exchange between the booking dialogue system and the person booking. Task completion condition: the person booking successfully books a restaurant and receives confirmation information. By defining a clear dialogue task, developers can better design the interaction process of the dialogue system, improving the efficiency and user experience of the dialogue system. Therefore, by obtaining dialogue task matching text data, i.e. target text data, the dialogue system based on a large language model can be trained on specific task matching target text data, improving the performance of the dialogue model for specific dialogue tasks.
[0104] As an implementation, the training method of the dialogue model and the related method of the embodiments of the present application can be completely implemented on the terminal 240, or completely implemented on the server 210, or partially implemented on the terminal 240 and partially implemented on the server 210. Regardless of which implementation, the server or the terminal can obtain dialogue task matching target text data through various means, including but not limited to:
[0105] Network data collection: collect text data related to the dialogue task from the Internet, for example, by targeted collection on specific websites, forums, social media platforms, etc. in the field of the dialogue task, or by using search engines to search for keywords related to the dialogue task to obtain related text data. Data set: search and use existing task-based dialogue data sets, which are usually sorted and annotated and can be used directly. For example, some research institutions or academic dialogue text data sets in specific fields are published, such as restaurant booking dialogue, travel query dialogue, etc. Open data sources can also be included: obtaining text data related to the dialogue task from websites such as encyclopedias, news websites, blogs, etc. Third-party service cooperation; such as obtaining dialogue data on platforms related to the dialogue task. For example, restaurant booking platforms, travel query platforms, etc.
[0106] It should be noted that in the process of obtaining target text data in the present application, the data collection technology and other scheme implementation involved should comply with the relevant legal and regulatory requirements, meet the principles of legality, legitimacy and necessity, and not involve obtaining data types prohibited or restricted by laws and regulations, and will not hinder the normal operation of the target website.
[0107] S120: classifying the target text data by topics to obtain topic factual content corresponding to each dialogue topic under the dialogue task.
[0108] Generally, people will discuss or state a series of information related to a specific topic (or topic) in the process of dialogue, and these related information, i.e. factual content, constitutes the basis for people to discuss and understand the topic. For example, in the process of drinking tea, the tea varieties including green tea, black tea, white tea, and the making method of black tea are discussed under the dialogue topic of "tea", and the tea varieties and making method are the factual content corresponding to the dialogue topic "tea". Therefore, in order to enable the dialogue model to have the dialogue ability under a specific dialogue task, it is necessary to train the dialogue model based on the factual content under the specific dialogue task, so that the dialogue model can understand the semantic information of the relevant dialogue topic in the dialogue task. Therefore, the present application can obtain the topic factual content corresponding to each dialogue topic in the dialogue task from the target text data to generate training data for training the dialogue model.
[0109] In some embodiments, the target text data can be segmented into multiple text data units, and further, the multiple text data units can be classified by topics to obtain text data units corresponding to each dialogue topic under the dialogue task, and each text unit can be used as topic factual content. The text data unit refers to a paragraph or a sentence describing the topic factual content. Topic classification refers to the process of classifying text data units according to their corresponding dialogue topics.
[0110] Illustratively, the target text data can be segmented according to the format of sentences or paragraphs, i.e. the target text data is segmented into multiple sentences or paragraphs, and each sentence or paragraph is used as a text data unit, because the factual content is usually a sentence or a paragraph of text. Further, the multiple text data units can be classified, and optionally, according to different dialogue topics, the text data units corresponding to each dialogue topic can be clustered as topic factual content.
[0111] Specifically, each topic fact content is classified by topic, so that each topic fact content has a corresponding label, and the topic fact content after the label is stored. Optionally, the topic fact content is stored in a text data pool. As shown in the example of the topic fact content. Figure 6 As shown in the example of the topic fact content. There are n (0 < n & n ∈ N*) topic fact contents, each of which has a corresponding plurality of labels, including id: content number, class: category, topic: dialogue topic, sub_topic: sub-dialogue topic, mess: fact content, topic_id: topic number. Optionally, each topic fact content after the label can be stored in the database of the text data pool based on the content number for subsequent generation of dialogues.
[0112] S130: generating corresponding prompt information according to each topic fact content, and inputting the prompt information into the trained generation model for dialogue generation to obtain a plurality of initial dialogue contents.
[0113] When training a large language model, prompts in text format are provided as input to the model. These prompts can be single sentences, paragraphs, or even longer text sequences. The purpose of the prompt is to guide the model to generate related text and influence the output of the model during the generation process. In the dialogue task, the prompt can guide the model to generate text related to a specific topic, field or context, i.e. dialogue content. To generate such dialogue content related to a specific topic or context, a specific prompt template, i.e. a preset prompt template, needs to be set.
[0114] The preset prompt template is a predefined text structure or format used to provide input to the model when training the large language model. It is a way to standardize prompts, providing input according to a specific template format and expecting the model to generate corresponding text output according to the template. The prompt template usually includes placeholders or keywords that can be filled with custom content to guide the model to generate text of a specific topic or content.
[0115] For example, the prompt template in a question and answer task can be "Question: [question content]?\nAnswer:". In this template, "Question:" is a fixed text that needs to be filled with specific question content; while "Answer:" is a fixed text that the model will generate an answer at this position. Such a template can provide a question and guide the model to generate a corresponding answer.
[0116] In some embodiments, the prompt template for the dialogue task can be predefined in advance, and the corresponding prompt, i.e. prompt information, for each topic fact content can be generated based on the prompt template. Specifically, it can include the following steps:
[0117] (1) Obtain a preset prompt template.
[0118] As an implementation, a preset prompt template can be set according to different dialog tasks. Specifically, according to the goal of the dialog task, it can be determined what type of text the dialog task generates, and then the structure and content of the template can be determined according to the task goal. Further, the key information or parameters that need to be provided in the prompt template are determined. Further, the fixed text part in the template, that is, the content that remains unchanged in each generated text instance, is determined. These parts are usually the description or indicative words of the task.
[0119] For example, a preset prompt template for a dialog task about travel consultation is designed to guide the model to generate a description of the travel destination, so the task goal is to generate an attractive and vivid travel description. Further, the key information in the preset prompt template can include the destination name, the introduction of the scenic spot, the recommended activities, etc. These information will affect the final generated text content. Further, the fixed text can be the task description or guiding words, such as "Please describe the charm of the following destination", "The following is the travel destination we recommend for you". The design of the prompt template can help standardize the input and guide the model to generate text on a specific dialog topic.
[0120] (2) Generate prompt information for each topic fact content based on the preset prompt template.
[0121] As an implementation, in order to make the dialog content of the model more accurate, the corresponding prompt information can be generated for the topic fact content through the prompt version with examples. For example, please refer to the example diagram of the prompt information as shown in Figure 7 The prompt information includes examples and questions. Among them, the example is to let the model make a specific format output according to the reference of the example. For example, as shown in the example Figure 7 mentioned "exclude air travel", so the model will follow the requirements in the example and reply to the travel trip without involving information about air travel during the dialog process.
[0122] By using a large amount of dialog content matched under the dialog task for dialog model training, the dialog model can learn the semantic information such as the context, mode and strategy of the dialog, so as to improve the understanding ability of the user input and generate more natural language responses that meet the task requirements.
[0123] In some embodiments, the prompt information corresponding to each topic fact content under the dialog task can be input into the trained generation model for dialog generation to obtain multiple initial dialog contents, which can specifically include steps (1) to (3):
[0124] The trained generative model refers to an intelligent model capable of natural language dialogue with a user. The intelligent model can be an intelligent agent (Agent) that can provide convenient and intelligent interactive experience for users in various task-oriented dialogue application scenarios, including intelligent assistants, customer service systems, smart homes, educational applications, and the like, and help solve various problems and needs. The trained generative model can include a first dialogue generator and a second dialogue generator, that is, two Agents.
[0125] Considering that actual business scenarios have different requirements for dialogue content generation, specifically in terms of dialogue content generation rate and generation quality, the present application provides two dialogue content generation methods, for example, one is to generate dialogue content using a single Agent in the case of requiring a larger generation rate, and the other is to generate dialogue content using two Agents in the case of requiring a larger generation quality.
[0126] (1) Obtain a rate weight value corresponding to the dialogue generation rate in the dialogue task, and a quality weight value corresponding to the dialogue generation quality.
[0127] The rate weight value and the quality weight value are used to quantify the degree of demand for the rate and quality of generating dialogue content by the business scenario of the dialogue task. When the rate weight value is less than the quality weight value, two Agents can be used to generate dialogue content. When the rate weight value is not less than the quality weight value, a single Agent can be used to generate dialogue content. The rate weight value and the quality weight value can be set by technical personnel through experimental experience, for example, the rate weight value and the quality weight value are decimals greater than zero and less than one, and the sum of the two is one.
[0128] Alternatively, the rate weight value and the quality weight value can also be determined by the performance state of the device performing dialogue content generation. The performance state is an indicator for measuring the performance of the device system. The performance state can include indicators such as system computing power, response time, central processing unit (CPU), graphics processing unit (GPU) operation time, memory utilization, and the like, which can be used to judge the performance of the system. Here, no limitation is made. For example, a PC computer can evaluate the performance state by querying the memory utilization of the computer at the current time. When the memory utilization exceeds 80%, it means that the CPU load is large, and the rate weight value is set to be greater than the quality weight value, that is, only a single Agent is used to generate dialogue content to reduce the computational burden.
[0129] (2) When the rate weight value is less than the quality weight value, the first dialogue generator and the second dialogue generator are controlled to generate dialogue based on the plurality of prompt information to obtain a plurality of initial dialogue contents.
[0130] When it is detected that the rate weight value is less than the quality weight value, it indicates that the business scenario needs relatively high generation quality of the dialogue content compared to the generation rate. To this end, the present application proposes to perform multi-round dialogue generation of the two dialogue generators in different dialogue states to improve the diversity and authenticity of the dialogue content, thereby improving the overall quality of the dialogue content. The specific steps are as follows:
[0131] (2.1) Obtain a plurality of dialogue states, which are used to indicate different states of dialogue of the first dialogue generator and the second dialogue generator.
[0132] (2.2) Control the first dialogue generator and the second dialogue generator to perform dialogue generation based on the plurality of prompt information and the plurality of dialogue states, and obtain a plurality of initial dialogue contents.
[0133] In real life, the dialogue process between people is not only for a certain topic. With the passage of time, the dialogue topic may change, deepen, or even be in a topicless situation. In order to make the dialogue content more in line with the natural language communication habits of people in real-life scenarios, the present application sets different dialogue states to control the two dialogue generators to perform multi-round dialogue in different dialogue topic situations, thereby improving the diversity and authenticity of the dialogue content.
[0134] The dialogue states at least include maintaining a topic, changing a topic, deepening a topic, and having no topic. Specifically, maintaining a topic: controlling the dialogue generator to continue dialogue generation of the last dialogue topic. Changing a topic: controlling the dialogue generator to change dialogue generation from the last dialogue topic to a new dialogue topic. Deepening a topic: controlling the dialogue generator to ask deepening questions based on the last dialogue topic, including dialogue generation of a sub-dialogue topic thereof. Having no topic: controlling the dialogue generator to perform dialogue generation without a topic.
[0135] When the plurality of dialogue states are obtained, the first dialogue generator and the second dialogue generator can be controlled to perform dialogue generation according to the plurality of prompt information in the plurality of dialogue states, and obtain a plurality of initial dialogue contents, which specifically include:
[0136] (2.2.1) sending a starting dialogue instruction to the first dialogue generator, so that the first dialogue generator performs dialogue generation operation based on the first prompt information determined from the plurality of prompt information, and obtains starting dialogue content;
[0137] Generally, a dialogue is a process initiated by one party and answered by another party. One prompt information is selected from the plurality of prompt information as input data input to the first dialogue generator, and a starting dialogue instruction is sent to the first dialogue generator. When the first dialogue generator receives the starting dialogue instruction, it can perform dialogue generation based on the input prompt information and output a text content, i.e., starting dialogue content.
[0138] (2.2.2) sending the first dialogue instruction to the second dialogue generator to make the second dialogue generator perform a dialogue generation operation based on the starting dialogue content and a first dialogue state randomly determined from the plurality of dialogue states, to obtain the first dialogue content;
[0139] For example, a dialogue instruction that replies to the starting dialogue content, i.e., the first dialogue instruction, is sent to the second dialogue generator. When the first dialogue generator receives the first dialogue instruction, it can select dialogue content from the text data pool to generate an answer that replies to the starting dialogue content, i.e., the first dialogue content, based on a first dialogue state randomly determined from the plurality of dialogue states.
[0140] (2.2.3) sending the second dialogue instruction to the first dialogue generator to make the first dialogue generator perform a dialogue generation operation based on the first dialogue content and a second dialogue state randomly determined from the plurality of dialogue states, to obtain the second dialogue content;
[0141] For example, a dialogue instruction that replies to the first dialogue content, i.e., the second dialogue instruction, is sent to the first dialogue generator. When the first dialogue generator receives the second dialogue instruction, it can select dialogue content from the text data pool to generate an answer that replies to the first dialogue content, i.e., the second dialogue content, based on a second dialogue state randomly determined from the plurality of dialogue states.
[0142] (2.2.4) returning to perform sending the starting dialogue instruction to the first dialogue generator to repeat the dialogue generation operation of the preset number of rounds, and collecting the starting dialogue content, the first dialogue content and the second dialogue content corresponding to each round of dialogue generation operation to obtain a plurality of initial dialogue contents.
[0143] For example, by performing the steps (2.2.1) to (2.2.3) of the preset number of rounds and collecting the starting dialogue content, the first dialogue content and the second dialogue content corresponding to each round of dialogue generation operation, a plurality of initial dialogue contents can be obtained. The preset number of rounds can be set by experimental experience, which is not limited herein.
[0144] Generating dialogue content with diversity by randomly determining dialogue states is to fully cover different dialogue contexts and language expressions when training large language models. However, considering that the number of dialogue contents generated under each dialogue state may be unevenly distributed, for example, the number of contents under the same topic is much higher than that under the in-depth topic, therefore, a corresponding preset threshold can be set for the number of states of each dialogue state to ensure that each dialogue state is fully covered. The preset threshold can be set by experimental experience, which is not limited herein.
[0145] As an implementation manner, the number of states corresponding to each of the plurality of dialogue states in each round of dialogue generation operation can be counted. When it is detected that the number of states corresponding to each of the plurality of dialogue states is greater than a preset threshold, the plurality of initial dialogue contents are saved. When it is detected that any one of the number of states corresponding to each of the plurality of dialogue states is not greater than the preset threshold, the execution of sending the starting dialogue instruction to the first dialogue generator is returned to repeat the dialogue generation operation of the preset number of rounds, that is, to repeat steps (2.2.1) to (2.2.3) of the preset number of rounds until the number of states corresponding to each of the plurality of dialogue states counted again is greater than the preset threshold, and the plurality of initial dialogue contents are obtained.
[0146] Referring to Figure 8 , Figure 8 A flowchart of a multi-round dialogue is shown. First, a plurality of dialogue states are obtained, which are used to indicate the first dialogue generator and the second dialogue generator to carry out dialogues in different states. Further, the first dialogue generator and the second dialogue generator are controlled to generate dialogues based on the plurality of prompt information and the plurality of dialogue states.
[0147] Specifically, a starting dialogue instruction is sent to the first dialogue generator to make the first dialogue generator generate dialogues based on the first prompt information determined from the plurality of prompt information to obtain starting dialogue content; a first dialogue instruction is sent to the second dialogue generator to make the second dialogue generator generate dialogues based on the starting dialogue content and the first dialogue state randomly determined from the plurality of dialogue states to obtain first dialogue content; and a second dialogue instruction is sent to the first dialogue generator to make the first dialogue generator generate dialogues based on the first dialogue content and the second dialogue state randomly determined from the plurality of dialogue states to obtain second dialogue content.
[0148] Further, the number of states corresponding to each of the plurality of dialogue states in each round of dialogue generation operation is counted. When it is detected that the number of states corresponding to each of the plurality of dialogue states is greater than a preset threshold, the plurality of initial dialogue contents are saved. When it is detected that any one of the number of states corresponding to each of the plurality of dialogue states is not greater than the preset threshold, the execution of controlling the first dialogue generator and the second dialogue generator to generate dialogues based on the plurality of prompt information and the plurality of dialogue states is returned until the number of states corresponding to each of the plurality of dialogue states counted again is greater than the preset threshold, and the plurality of initial dialogue contents are obtained.
[0149] Thus, the two dialogue generators are controlled to generate multi-round dialogue content through randomly determined dialogue states, so that the dialogue generators can generate dialogue content in different dialogue contexts, improve the diversity of the dialogue content, and by setting a corresponding preset threshold for the number of states of each dialogue state, the dialogue context corresponding to each dialogue state is fully covered while improving the diversity of the dialogue content, ensuring the comprehensiveness of the generated dialogue content in different dialogue contexts. Thus, in order to train the dialogue model to cover various different dialogue scenarios and contexts, thereby improving the applicability and generalization ability of the dialogue model.
[0150] (3) When the rate weight value is not less than the quality weight value, inputting the plurality of prompt information to the first dialogue generator for multi-round dialogue generation to obtain a plurality of initial dialogue content.
[0151] When it is detected that the rate weight value is not less than the quality weight value, it means that a relatively high generation rate is more needed than the generation quality of the dialogue content. Therefore, multi-round dialogue generation can be performed based on one dialogue generator. Specifically, the second dialogue generator can be disabled, and the plurality of prompt information can be input to the first dialogue generator to generate the entire dialogue content based on the plurality of prompt information by the first dialogue generator. Since this scheme only needs one dialogue generator to participate in dialogue generation, it can effectively reduce the consumption of computing resources and improve the rate of dialogue generation.
[0152] S140: performing content specification processing on each initial dialogue content to obtain a plurality of target dialogue content after content specification processing.
[0153] Considering that the generation model may make errors or deviations in the dialogue generation process, which is due to some defects of the large language model itself, for example, hallucination and bias problems. Specifically, the generation model produces errors when learning language patterns, resulting in hallucination of the generated target dialogue content, i.e., the target dialogue content that does not conform to the natural language description specification. In addition, the generation model has bias for different dialogue states, resulting in uneven distribution of the dialogue state corresponding to the generated dialogue content. Therefore, it is necessary to detect and adjust the quality of the initial dialogue content generated by the generation model, i.e., content specification processing. The content specification processing can detect and adjust the data structure, data size, and content quality of each initial dialogue content.
[0154] The data structure refers to the structure of the text description of the dialogue content. Since the dialogue content needs to be used for large language model training, the data structure of the dialogue content must have a correct natural language description structure. The data size refers to the number of dialogue contents. Since the initial dialogue content is adjusted in the data structure, some dialogue contents are deleted due to structural errors. In order to ensure that the number of initial dialogue contents is not affected, when the number of initial dialogue contents is detected to be reduced, the number of initial dialogue contents can be adjusted to ensure that the data size of the initial dialogue contents is not affected. The content quality refers to the condition that multiple different dialogue contents are presented under statistical indicators such as topic distribution and turn ratio. Content diversity can affect the quality of dialogue content.
[0155] Through content specification processing, on the one hand, the reliability of the target dialogue content can be optimized, so that the dialogue content has a correct natural language description specification, avoiding the illusion problem of the large language model, and on the other hand, the target dialogue content can be balanced and optimized under different statistical indicators, avoiding the bias problem of the large language model, thereby providing high-quality training data for the training of the dialogue model.
[0156] In some embodiments, content specification processing and content optimization processing can be performed respectively. The content specification processing mainly processes the initial dialogue content in the data structure to ensure that the dialogue content is computable. The content optimization processing mainly further optimizes the quality of the dialogue content after the content specification processing, including optimization of dialogue content diversity, etc. The specific steps can include:
[0157] (1) performing content specification processing on each initial dialogue content to obtain multiple standardized dialogue contents after content specification processing.
[0158] The content specification processing can include data cleaning, data structuring, and data augmentation. Data cleaning is used to identify and repair errors, missing values, duplicate records, and other problems in the data, thereby improving the accuracy, completeness, and consistency of the data. Data structuring is used to label the dialogue content, facilitating subsequent content optimization processing. Data augmentation takes into account that the number of dialogue contents may be reduced during data cleaning, so data augmentation is used to increase the number of dialogue contents. Step (1) specifically includes:
[0159] (1.1) performing data cleaning on each initial dialogue content to obtain multiple intermediate dialogue contents;
[0160] (1.2) performing data structuring on each intermediate dialogue content to obtain multiple structured dialogue contents, and the data structuring at least adds content labels to the intermediate dialogue content;
[0161] (1.3) Data augmentation is performed on each structured dialogue content to obtain a plurality of standardized dialogue contents.
[0162] Exemplarily, after data cleaning is performed on each initial dialogue content, a plurality of intermediate dialogue contents can be labeled. Please refer to Figure 9 , Figure 9 A data structure diagram of dialogue content is shown. As Figure 9 A structured dialogue content is shown, which has a plurality of labels, including {role, content, current_topics, next_topics, dialog_end, interrupt, interrupt_plus, topic_id}. Optionally, based on the classification of the topic into three levels in step S120, the labels are ["coffee", "coffee-overview", "coffee-overview-overview"], wherein each element represents a first-level label, a second-level label, and a third-level label, respectively. If the topic classification has more than three levels or less than three levels, labels after topic classification can be added. In addition, data structuring can also include translation, format adjustment, etc. of dialogue content, which are not limited herein.
[0163] Further, data augmentation techniques of natural language processing can be used to perform data augmentation on each structured dialogue content, including synonym replacement, random insertion, random swap, semantic equivalent replacement, and text reordering, etc. which are not limited herein. For example, synonym replacement can replace some words in the structured dialogue content with their synonyms to increase the diversity of data. A dictionary or a pre-trained word vector can also be used to obtain synonyms.
[0164] (2) Content optimization processing is performed on each standardized dialogue content through a plurality of statistical indicators to obtain a plurality of target dialogue contents after content optimization processing.
[0165] In order to accurately understand the quality of the dialogue content, the present application proposes to quantify the quality of the dialogue content from a plurality of different statistical indicators. Among them, the content label at least includes dialogue topic label and dialogue round label, and the plurality of statistical indicators at least includes topic distribution and round proportion, and for the method of generating dialogue content by using two dialogue generators, state proportion can also be set. Step (2) specifically includes:
[0166] (2.1) Statistics is performed on the dialogue topic label of each standardized dialogue content to obtain a topic distribution;
[0167] (2.2) Count the dialogue round labels of each specification dialogue content according to the specification dialogue content, to obtain a round proportion;
[0168] (2.3) Perform statistical analysis on the topic distribution and the round proportion respectively, to obtain corresponding topic analysis results and round analysis results;
[0169] (2.4) Based on the topic analysis results and the round analysis results, adjust the dialogue content of each specification dialogue content, to obtain a plurality of target dialogue contents.
[0170] As an implementation manner, the dialogue topic labels of each specification dialogue content can be counted to obtain a topic distribution, which can reflect the proportion of specification dialogue content under different dialogue topics. The dialogue round labels of each specification dialogue content can also be counted to obtain a round proportion, which can reflect the proportion of dialogue content corresponding to various rounds in the dialogue process, for example, dialogue content generated by two rounds of dialogue, dialogue content generated by five rounds of dialogue, etc.
[0171] Further, the statistical indicators such as the topic distribution, the round proportion and the state proportion are respectively data-visualized. For example, for the topic distribution, a pie chart or a bar chart can be used to show the proportion and relative size of different dialogue topics. The pie chart can divide the dialogue topics into different sectors according to the proportion, facilitating comparison of the importance of each dialogue topic. The bar chart can arrange the dialogue topics from high to low according to the frequency, facilitating viewing of the ranking and difference of each dialogue topic. For the round proportion, a column chart or a line chart can be used to show the proportion and trend of different rounds. The column chart can divide the rounds into different columns according to the proportion, facilitating comparison of the importance of each round. The line chart can connect the rounds in time sequence, facilitating observation of the change trend and periodicity of the rounds.
[0172] Through the visualized statistical analysis results, the quality of the generated dialogue content can be better understood. Further, each specification dialogue content can be adjusted in dialogue content according to different statistical analysis results, to obtain a plurality of target dialogue contents with higher quality. For example, based on the topic analysis results and the round analysis results, the dialogue content is adjusted, for example, dialogue content supplement processing, specifically, the generation of dialogue content is performed pertinently for abnormal topics or abnormal rounds. The specific dialogue content generation process can refer to the introduction part of the dialogue content generation in the above embodiments, which will not be described here.
[0173] When the topic analysis results indicate that the topic distribution is unqualified and the round analysis results indicate that the round proportion is qualified, an abnormal topic is determined from each specification dialogue content, and dialogue content supplement processing is performed on the abnormal topic, to obtain a plurality of target dialogue contents after dialogue content supplement processing;
[0174] When the topic analysis result indicates that the topic distribution is qualified and the round analysis result indicates that the round proportion is unqualified, an abnormal round is determined from each specification dialogue content, and the abnormal round is subjected to dialogue content supplement processing, to obtain the plurality of target dialogue contents after dialogue content supplement processing.
[0175] When the topic analysis result indicates that the topic distribution is unqualified and the round analysis result indicates that the round proportion is unqualified, an abnormal topic and an abnormal round are determined from each specification dialogue content, and the abnormal round is subjected to dialogue content supplement processing and the abnormal round is subjected to dialogue content supplement processing, to obtain the plurality of target dialogue contents after dialogue content supplement processing.
[0176] In this way, by performing content specification processing and content optimization processing on each generated dialogue content, the problems in the generated target dialogue content caused by the bias and illusion that cannot be avoided by the large language model can be effectively solved, including optimizing the target dialogue content in terms of data structure, so that the dialogue content has correct natural language description specifications, and by adjusting the target dialogue content in different statistical indicators in terms of different dialogue topics, dialogue rounds or dialogue states, etc., the diversity and comprehensiveness of the target dialogue content are effectively improved, thereby improving the quality of the dialogue content and providing high-quality training data for subsequent training of the dialogue model. Thus, training the dialogue model based on the high-quality target dialogue content can improve the generalization ability and robustness of the dialogue model in the dialogue task.
[0177] S150: generating a plurality of target dialogue prompt information based on the plurality of target dialogue contents, and inputting each target dialogue prompt information into the dialogue model for dialogue task training to obtain a trained dialogue model.
[0178] Generally, a pre-trained large language model needs to be trained for a dialogue task under the dialogue task. To this end, a training set can be constructed based on the target prompt information to train the dialogue model. Illustratively, the plurality of target dialogue contents can be converted into a plurality of target dialogue prompt information according to a preset prompt template.
[0179] Further, the pre-trained large language model is used as the dialogue model. Then, the dialogue model is fine-tuned on the training set of the dialogue task, i.e., the model parameters are adjusted by learning on the training set of the dialogue task to adapt to the dialogue task, and finally a trained dialogue model is obtained for the task-oriented dialogue system. Optionally, a test set can also be constructed to test the trained dialogue model to evaluate the model performance.
[0180] This embodiment can acquire target text data matched by a dialogue task, classify the target text data by topic, obtain the topic fact content corresponding to each dialogue topic under the dialogue task, generate corresponding prompt information based on each topic fact content, and input the prompt information into the trained generative model to generate dialogue, thereby obtaining multiple initial dialogue contents. Thus, based on the text data matched under the dialogue task, initial dialogue content is specifically generated for training the dialogue model corresponding to the dialogue task.
[0181] Furthermore, each initial dialogue content undergoes content normalization processing to obtain multiple target dialogue contents after normalization. This optimizes the quality of the initial dialogue content generated by the generative model, effectively ensuring the diversity and comprehensiveness of the target dialogue content and providing high-quality training data for the dialogue model. Then, multiple target dialogue prompts are generated based on these target dialogue contents, and each prompt is input into the dialogue model for dialogue task training, resulting in a trained dialogue model. Therefore, training the dialogue model based on this high-quality target dialogue content improves its generalization ability and robustness in dialogue tasks, thereby enhancing the dialogue performance of the task-oriented dialogue system containing the trained model and improving the accuracy of subsequent dialogues.
[0182] According to one embodiment of this application, another method for training a dialogue model is provided. This method can be executed by a computer device (which may be a server, edge computing device, or other terminal device with certain processing capabilities), the computer device having at least storage, computing, and communication functions. Figure 10 A flowchart illustrating the training method for the dialogue model provided in this embodiment is shown. Figure 11 A flowchart illustrating the training method for the dialogue model provided in this embodiment is shown.
[0183] like Figure 11 The flowchart shown includes data acquisition and topic classification, dialogue generation, normalization processing, model training, and model testing. Data acquisition and topic classification are used to acquire target text data; normalization processing uses rules from a rule base to normalize the generated dialogue content; model training is used to train a dialogue model based on the normalized dialogue content; and model testing is used to test the performance of the trained dialogue model. In this embodiment, a role agent based on a large language model can be used to generate dialogue content. A super agent controls the entire dialogue content generation process. The specific processes of model training and testing are described in the following steps:
[0184] S210: The computer device obtains target text data matched with the dialogue task, and classifies the target text data by topic to obtain topic fact content corresponding to each dialogue topic under the dialogue task.
[0185] Referring to Figure 12 , Figure 12 A flowchart of data acquisition and classification is shown, as Figure 12 indicated, the computer device can obtain target text data through network data collection, task-based dialogue data set, open data source, etc. Further, the target text data can be segmented, for example, segmented according to sentence size or segmented according to paragraph size, to obtain multiple text data units. Further, since the text data units do not have topic labels, i.e. supervision information, the computer device can cluster the multiple text data in a clustering manner through a Super agent to obtain text data units corresponding to each dialogue topic under the dialogue task, and each text unit is taken as topic fact content.
[0186] S220: The computer device generates corresponding prompt information according to each topic fact content, and inputs the prompt information into the trained generation model for dialogue generation to obtain multiple initial dialogue contents.
[0187] Considering that actual business scenarios have different needs for dialogue content generation, this embodiment provides two dialogue content generation methods, for example, one is to generate dialogue content using a single Role agent in the case of requiring a large generation rate, and the other is to generate dialogue content using two Role agents in the case of requiring a large generation quality.
[0188] In some embodiments, the computer device can obtain a preset prompt template, and generate prompt information based on the preset prompt template for each topic fact content. Further, a rate weight value corresponding to the dialogue generation rate and a quality weight value corresponding to the dialogue generation quality in the dialogue task are obtained.
[0189] As an implementation, when the rate weight value is less than the quality weight value, as Figure 13 indicated in the flowchart of dialogue generation, the Role agent 1 and the Role agent 2 can be controlled by the Super agent to generate dialogue based on the prompt information in different dialogue states to obtain multiple initial dialogue contents. Referring to Figure 14 , Figure 14 A flowchart of generating dialogue content based on dialogue state is shown. As Figure 14As shown, the Super agent sends a starting dialogue instruction to the Role agent 1 to make the Role agent 1 generate a starting dialogue content based on the first prompt information determined from the plurality of prompt information; the Super agent sends a first dialogue instruction to the Role agent 2 to make the Role agent 2 select a dialogue content from the text data pool based on the starting dialogue content and a first dialogue state (e.g., maintaining the theme) randomly determined from the plurality of dialogue states to generate a first dialogue content.
[0190] Further, the Super agent sends a second dialogue instruction to the Role agent 1 to make the Role agent 1 select a dialogue content from the text data pool based on the first dialogue content and a second dialogue state (e.g., switching the theme) randomly determined from the plurality of dialogue states to generate a second dialogue content. In this way, the Super agent controls the Role agent 1 and the Role agent 2 to generate dialogue contents of a preset round to obtain a plurality of initial dialogue contents. The dialogue states include maintaining the theme, switching the theme, deepening the theme, and no theme, and the selection of each dialogue state can be based on a certain random probability.
[0191] Specifically, as shown in the dialogue content example diagram of maintaining the theme, Figure 15 when the dialogue state interrupt is maintaining the theme, the generated dialogue content content is dialogue generation maintaining the last dialogue theme. As shown in the dialogue content example diagram of switching the theme, Figure 16 when the dialogue state interrupt is switching the theme, the generated dialogue content content is dialogue generation switching to a new dialogue theme. As shown in the dialogue content example diagram of deepening the theme, Figure 17 when the dialogue state interrupt is deepening the theme, the generated dialogue content content is dialogue generation of its sub-dialogue theme. As shown in the dialogue content example diagram of no theme, Figure 18 when the dialogue state interrupt is no theme, the generated dialogue content content is dialogue generation of no theme.
[0192] As another implementation, when the rate weight value is not less than the quality weight value, the plurality of prompt information is respectively input to the first dialogue generator to generate a plurality of rounds of dialogue to obtain a plurality of initial dialogue contents.
[0193] S230: The computer device performs content specification processing on each initial dialogue content to obtain a plurality of target dialogue contents after content specification processing.
[0194] In some embodiments, the computer device can perform data quality detection on each initial dialogue content, and perform content specification processing and content optimization processing respectively. As shown in the flowchart of data quality detection. Figure 19 The data cleaning is performed based on rules in a rule library, so as to remove the initial dialogue content that does not meet the rules, such as repeated data, illegal symbols, and too short text, and the rule library can be created based on business requirements. Further, the dialogue content after data cleaning is translated, meaningless symbols are deleted, labels are added to the dialogue content, and the like, to ensure the accuracy and reliability of subsequent analysis, and the dialogue content after adding labels is data augmented to obtain multiple standardized dialogue contents.
[0195] Further, the content optimization processing is performed on each standardized dialogue content through multiple statistical indicators to obtain multiple target dialogue contents after content optimization processing. The statistical indicators can include theme distribution, round proportion, and state proportion. By counting the distribution of different dialogue themes in the entire dialogue themes, i.e., theme distribution, the coverage of the dialogue content of different dialogue themes is understood, so that the theme coverage ability of the dialogue content generated by the generation model is obtained. By counting the proportion of different dialogue rounds in the entire dialogue rounds, i.e., round proportion, the dialogue generation ability of the generation model in multi-round dialogue is obtained. By counting the proportion of different state types in the entire dialogue state, i.e., state proportion, the dialogue generation ability of the generation model in various dialogue states is obtained.
[0196] Exemplarily, the theme distribution, round proportion, and state proportion can be visualized. For example, for the theme distribution, a pie chart or a bar chart can be used to show the proportion of different dialogue themes. The pie chart can divide different dialogue themes into different sectors according to the proportion; the bar chart can arrange different dialogue themes according to the frequency from high to low, so as to facilitate the viewing of the ranking and difference of each theme. For the round proportion, a column chart or a line chart can be used to show the proportion and trend of different dialogue rounds. The column chart can divide the dialogue rounds into different columns according to the proportion, so as to facilitate the comparison of the importance of each dialogue round; the line chart can connect different dialogue rounds in time sequence, so as to facilitate the observation of the change trend and periodicity of the dialogue rounds.
[0197] By statistically analyzing and visualizing the results, timely adjustments can be made to the generated dialogue when problems arise, thus ensuring the quality of the generated dialogue. For example, if a certain dialogue topic appears infrequently across all dialogue topics, dialogue content can be generated specifically for that topic to supplement the dialogue content under that topic, thereby ensuring the comprehensiveness of the dialogue content across different dialogue topics. Similarly, if a certain dialogue state appears infrequently across all dialogue states, dialogue content can be generated specifically for that state to supplement the dialogue content under that state, thereby ensuring the comprehensiveness of the dialogue content across different dialogue states.
[0198] S240: The computer device generates multiple target dialogue prompts based on multiple target dialogue contents, and inputs each target dialogue prompt into the dialogue model for dialogue task training, thereby obtaining the trained dialogue model.
[0199] For example, a computer device can convert multiple target dialogue contents into multiple target dialogue prompts based on a preset prompt template. To ensure the quality of the prompts, these multiple target dialogue prompts can be optimized. Specifically, a dialogue test can be performed on these multiple target dialogue prompts beforehand using an intelligent agent. Figure 20 The flowchart shown illustrates the optimization of prompt information. The target dialogue prompt information is input into the test agent (A-Agent). The test agent conducts dialogue based on the test facts in the test fact content set. Then, the optimization agent (B-Agent) can optimize the dialogue result generated by the test agent. For example, it can determine whether the dialogue result is incorrect. If it is incorrect, it outputs the defect of the prompt information corresponding to the incorrect answer. The adjustment agent (C-Agent) adjusts the prompt information based on the defect of the prompt information to obtain the correct prompt information after adjustment.
[0200] Furthermore, the computer device uses a pre-trained large language model as the dialogue model. Then, the dialogue model is fine-tuned on the training set of the dialogue task, that is, the model parameters are adjusted by learning on the training set of the dialogue task to adapt it to the dialogue task, and finally the trained dialogue model is obtained for developing task-oriented dialogue systems.
[0201] S250: The computer device acquires multiple target dialogue contents and multiple out-of-domain dialogue contents that match the dialogue task.
[0202] In order to ensure the accuracy and reliability of the performance of the trained dialogue model, the present application proposes to test the performance of the trained dialogue model. Specifically, by combining in-domain data and out-of-domain data, the generalization ability, robustness, versatility and reliability of the model can be comprehensively evaluated, which helps to find the problems of the model and provides improvement direction. Please refer to Figure 21 , Figure 21 The test flowchart of the model test is shown.
[0203] Among them, the in-domain data is the training data used to train the dialogue model, that is, the target dialogue content. The out-of-domain data, that is, the out-of-domain dialogue content, is data that the dialogue model has not seen in the training process, representing new situations and new fields that the dialogue model may encounter in real application.
[0204] Exemplarily, the computer device can obtain the stored target dialogue content from the text data pool as in-domain data, and obtain a plurality of out-of-domain dialogue contents from data sources such as the Internet as out-of-domain data.
[0205] S260: The computer device randomly samples a plurality of target dialogue contents and a plurality of out-of-domain dialogue contents to obtain a plurality of sampled dialogue contents, and generates a sampled prompt information corresponding to each sampled dialogue content.
[0206] Exemplarily, the computer device can randomly sample a plurality of dialogue contents, that is, sampled dialogue contents, from the plurality of target dialogue contents and the plurality of out-of-domain dialogue contents. Further, a sampled prompt information corresponding to each sampled dialogue content is generated based on a pre-prompt template.
[0207] S270: The computer device inputs each sampled prompt information to the trained dialogue model to perform task dialogue, and obtains a test dialogue content.
[0208] Exemplarily, a test agent for performing dialogue tasks can be developed based on the trained dialogue model. The computer device can control the test agent to perform multi-round dialogue or single-round dialogue based on each sampled prompt information through the Super agent, and then the test agent performs dialogue reply to obtain the reply content as the test dialogue content.
[0209] S280: The computer device tests the trained dialogue model according to the test dialogue content and the evaluation index to obtain a test result, which indicates the dialogue performance of the trained dialogue model under the dialogue task.
[0210] For example, computer devices can perform statistical analysis on test dialogue content using evaluation metrics, and determine the dialogue performance of the trained dialogue model under the dialogue task based on the results of the statistical analysis, i.e., the test results. The evaluation metrics can include at least the standardization of dialogue content, the authenticity of dialogue content, and the correctness of dialogue states. The standardization of dialogue content refers to the presence of duplicate content, illegal symbols, or excessively short content in the test dialogue, violating the rules in the rule base used during model training. The authenticity of dialogue content refers to whether the test dialogue content conforms to the norms of natural language description. The correctness of dialogue states refers to whether the test dialogue content conforms to the target dialogue state in the current dialogue process. For example, if the previous dialogue content corresponded to a deeper topic state, the current response might incorrectly have a topic shift state.
[0211] Furthermore, computer equipment can visualize the evaluation indicators corresponding to the test results. Specifically, based on the levels achievable in terms of the standardization, authenticity, and correctness of the dialogue content, the dialogue model's performance is comprehensively determined, including correctness, authenticity, generalization, robustness, and reliability. For example, when the standardization and authenticity of the dialogue content both reach preset standard thresholds, the correctness of the dialogue model can be determined to be at a qualified level. Further, these dialogue performance metrics can be visualized using polygon capability graphs, such as... Figure 22 The diagram shows the performance evaluation capability of the dialogue model. Furthermore, the visualization of the capability diagram can reveal which dialogue performance aspects the model is deficient in, allowing for targeted training to address these weaknesses. For example, Figure 22 The dialogue model shown has relatively low robustness. This can be improved by training the model with extra-domain data, thereby enhancing its adaptability to variations and uncertainties in dialogue content. If the dialogue model performs similarly on extra-domain data as it does on in-domain data, then it demonstrates good robustness.
[0212] The embodiment can obtain target text data matched with the dialogue task, perform topic classification on the target text data, obtain topic fact content corresponding to each dialogue topic under the dialogue task, and then generate corresponding prompt information according to each topic fact content, and input the prompt information into the trained generation model to generate dialogue, to obtain multiple initial dialogue contents. Further, the initial dialogue contents are processed for content specification to obtain multiple target dialogue contents processed for content specification, so as to detect and optimize the initial dialogue contents generated by the generation model in quality, effectively guarantee the diversity and comprehensiveness of the target dialogue contents, and provide high-quality training data for training of the dialogue model. Further, multiple target dialogue prompt information is generated based on the multiple target dialogue contents, and each target dialogue prompt information is input into the dialogue model for dialogue task training to obtain the trained dialogue model. In this way, the dialogue model is trained based on the high-quality target dialogue contents, effectively improving the generalization ability and robustness of the dialogue model in the dialogue task, so that the dialogue performance of the trained dialogue model in the task-oriented dialogue system is improved, and the accuracy of the dialogue is enhanced.
[0213] Further, multiple target dialogue contents and multiple out-of-domain dialogue contents matched with the dialogue task are obtained; the multiple target dialogue contents and the multiple out-of-domain dialogue contents are randomly sampled to obtain multiple sampling dialogue contents, and sampling prompt information corresponding to each sampling dialogue content is generated, and then each sampling prompt information is input into the trained dialogue model for task dialogue to obtain test dialogue contents, and the trained dialogue model is tested according to the test dialogue contents and evaluation indexes to obtain a test result, which indicates the dialogue performance of the trained dialogue model under the dialogue task. Therefore, by testing the performance of the trained dialogue model based on the target dialogue contents used in the training process as in-domain data and out-of-domain data, the performance of the dialogue model can be more comprehensively evaluated, and more reliable evaluation results can be provided, which helps to find problems in the dialogue model and provide improvement directions, so as to guarantee the dialogue performance of the dialogue model, so that it can perform accurate and reliable task-oriented dialogue in the application of the task-oriented dialogue system, and improve the dialogue quality.
[0214] Please refer to Figure 23 which shows a structural block diagram of a training device 300 of a prediction model provided by an embodiment of the present application. The device 300 can include:
[0215] The data acquisition module 310 is configured to acquire target text data matched with the dialogue task.
[0216] The subject classification module 320 is configured to perform subject classification on the target text data, to obtain subject fact content corresponding to each dialogue subject under the dialogue task.
[0217] The dialogue generation module 330 is configured to generate corresponding prompt information according to each subject fact content, and input the prompt information into the trained generation model to generate a dialogue, to obtain a plurality of initial dialogue contents.
[0218] The content specification module 340 is configured to perform content specification processing on each initial dialogue content, to obtain a plurality of target dialogue contents after content specification processing.
[0219] The model training module 350 is configured to generate a plurality of target dialogue prompt information based on the plurality of target dialogue contents, and input each target dialogue prompt information into a dialogue model to perform dialogue task training, to obtain a trained dialogue model.
[0220] In some embodiments, the trained generation model includes a first dialogue generator and a second dialogue generator, and the dialogue generation module 330 can include a template acquisition unit, a prompt generation unit, a weight acquisition unit, and a first generation unit.
[0221] The template acquisition unit is configured to acquire a preset prompt template.
[0222] The prompt generation unit is configured to generate prompt information based on the preset prompt template and the subject fact content, to obtain a plurality of prompt information.
[0223] The weight acquisition unit is configured to acquire a rate weight value corresponding to a dialogue generation rate and a quality weight value corresponding to a dialogue generation quality in the dialogue task.
[0224] The first generation unit is configured to control the first dialogue generator and the second dialogue generator to generate a dialogue based on the plurality of prompt information when the rate weight value is less than the quality weight value, to obtain a plurality of initial dialogue contents.
[0225] In some embodiments, the first generation unit can include a state acquisition subunit and a dialogue generation subunit.
[0226] The state acquisition subunit is configured to acquire a plurality of dialogue states, the dialogue states being used to indicate different states of dialogue generated by the first dialogue generator and the second dialogue generator.
[0227] The dialogue generation subunit is configured to control the first dialogue generator and the second dialogue generator to generate a dialogue based on the plurality of prompt information and the plurality of dialogue states, to obtain a plurality of initial dialogue contents.
[0228] In some embodiments, the dialogue generation subunit can include: a first sub-subunit configured to send a starting dialogue instruction to the first dialogue generator to cause the first dialogue generator to perform a dialogue generation operation based on the first prompt information determined from the plurality of prompt information to obtain starting dialogue content; a second sub-subunit configured to send a first dialogue instruction to the second dialogue generator to cause the second dialogue generator to perform a dialogue generation operation based on the starting dialogue content and a first dialogue state randomly determined from the plurality of dialogue states to obtain first dialogue content; a third sub-subunit configured to send a second dialogue instruction to the first dialogue generator to cause the first dialogue generator to perform a dialogue generation operation based on the first dialogue content and a second dialogue state randomly determined from the plurality of dialogue states to obtain second dialogue content; and a fourth sub-subunit configured to return to perform the sending of the starting dialogue instruction to the first dialogue generator to repeatedly perform a preset number of rounds of dialogue generation operations to collect the starting dialogue content, the first dialogue content, and the second dialogue content corresponding to each round of dialogue generation operation to obtain a plurality of initial dialogue contents.
[0229] In some embodiments, the dialogue generation subunit can further include a fifth sub-subunit configured to count the number of states corresponding to each dialogue state in the plurality of dialogue states in each round of dialogue generation operation; and the fourth sub-subunit can be configured to: when it is detected that the number of states corresponding to each dialogue state in the plurality of dialogue states is greater than a preset threshold, save the plurality of initial dialogue contents; and when it is detected that the number of states corresponding to any one of the dialogue states in the plurality of dialogue states is not greater than the preset threshold, return to perform the sending of the starting dialogue instruction to the first dialogue generator to repeatedly perform the dialogue generation operation for a preset number of rounds until the number of states corresponding to each dialogue state in the plurality of dialogue states is greater than the preset threshold to obtain the plurality of initial dialogue contents.
[0230] In some embodiments, the dialogue generation module 330 can further include a second generation unit configured to, when the rate weight value is not less than the quality weight value, input the plurality of prompt information to the first dialogue generator to perform a plurality of rounds of dialogue generation to obtain a plurality of initial dialogue contents.
[0231] In some embodiments, the content specification module 340 can include a specification unit and an optimization unit.
[0232] The content specification unit is configured to perform content specification processing on each initial dialogue content to obtain a plurality of specification dialogue contents after content specification processing.
[0233] The content optimization unit is configured to perform content optimization processing on each specification dialogue content through a plurality of statistical indicators to obtain a plurality of target dialogue contents after content optimization processing.
[0234] In some embodiments, the content specification unit can be specifically configured to: perform data cleaning on the each initial dialogue content to obtain a plurality of intermediate dialogue contents; perform data structuring on each intermediate dialogue content to obtain a plurality of structured dialogue contents, the data structuring being at least for adding a content label to the intermediate dialogue content; and perform data augmentation on each structured dialogue content to obtain a plurality of specification dialogue contents.
[0235] In some embodiments, the content label at least includes a dialogue topic label and a dialogue round label, and the plurality of statistical indicators at least includes a topic distribution and a round proportion, and the content optimization unit can include a topic subunit, a round subunit, an analysis subunit, and an adjustment subunit.
[0236] The topic subunit is configured to perform statistics based on the dialogue topic label of each specification dialogue content to obtain a topic distribution.
[0237] The round subunit is configured to perform statistics according to the dialogue round label of each specification dialogue content to obtain a round proportion.
[0238] The analysis subunit is configured to perform statistical analysis on the topic distribution and the round proportion respectively to obtain corresponding topic analysis results and round analysis results.
[0239] The adjustment subunit is configured to perform dialogue content adjustment on each specification dialogue content based on the topic analysis results and the round analysis results to obtain a plurality of target dialogue contents.
[0240] In some embodiments, the adjustment subunit can be specifically configured to: when the topic analysis results indicate that the topic distribution is unqualified and the round analysis results indicate that the round proportion is qualified, determine an abnormal topic from each specification dialogue content and perform dialogue content supplement processing on the abnormal topic to obtain a plurality of target dialogue contents after dialogue content supplement processing; when the topic analysis results indicate that the topic distribution is qualified and the round analysis results indicate that the round proportion is unqualified, determine an abnormal round from each specification dialogue content and perform dialogue content supplement processing on the abnormal round to obtain a plurality of target dialogue contents after dialogue content supplement processing; and when the topic analysis results indicate that the topic distribution is unqualified and the round analysis results indicate that the round proportion is unqualified, determine an abnormal topic and an abnormal round from each specification dialogue content and perform dialogue content supplement processing on the abnormal round and perform dialogue content supplement processing on the abnormal round to obtain a plurality of target dialogue contents after dialogue content supplement processing.
[0241] In some embodiments, the topic classification module 320 can be specifically configured to: perform data segmentation on the target text data to obtain a plurality of text data units; perform topic classification on the plurality of text data units to obtain text data units corresponding to each dialogue topic under the dialogue task, and take each text unit as topic factual content.
[0242] In an embodiment, target text data matched with the dialogue task can be obtained, and topic classification is performed on the target text data to obtain topic factual content corresponding to each dialogue topic under the dialogue task. Then, corresponding prompt information is generated according to each topic factual content, and the prompt information is input into the trained generation model to generate dialogue, thereby obtaining a plurality of initial dialogue contents. Thus, initial dialogue contents for training the dialogue model corresponding to the dialogue task are generated based on the text data matched with the dialogue task. Further, each initial dialogue content is subjected to content specification processing to obtain a plurality of target dialogue contents subjected to content specification processing. Thus, the initial dialogue contents generated by the generation model are optimized in quality, effectively ensuring the diversity and comprehensiveness of the target dialogue contents, and providing high-quality training data for training of the dialogue model. Then, a plurality of target dialogue prompt information is generated based on the plurality of target dialogue contents, and each target dialogue prompt information is input into the dialogue model for dialogue task training to obtain a trained dialogue model. Thus, the dialogue model is trained based on the high-quality target dialogue contents, which can improve the generalization ability and robustness of the dialogue model in the dialogue task, and improve the dialogue performance of the task-oriented dialogue system in which the trained dialogue model is located, thereby enhancing the accuracy of subsequent dialogue.
[0243] Please refer to Figure 24 which shows a structural block diagram of a training device 400 of a prediction model provided by an embodiment of the present application. The device 400 can include:
[0244] A dialogue obtaining module 410 is configured to obtain a plurality of target dialogue contents and a plurality of out-of-domain dialogue contents matched with the dialogue task;
[0245] A prompt generating module 420 is configured to randomly sample the plurality of target dialogue contents and the plurality of out-of-domain dialogue contents to obtain a plurality of sampled dialogue contents, and generate sampled prompt information corresponding to each sampled dialogue content;
[0246] A content generating module 430 is configured to input each sampled prompt information into the trained dialogue model to perform task dialogue, and obtain test dialogue contents;
[0247] A model testing module 440 is configured to test the trained dialogue model according to the test dialogue contents and evaluation indexes to obtain a test result, the test result indicating the dialogue performance of the trained dialogue model under the dialogue task.
[0248] The trained dialogue model is obtained by training the dialogue model according to the training method.
[0249] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device, module and the like can refer to the corresponding process in the foregoing method embodiments, which will not be described herein.
[0250] In several embodiments provided in the present application, the coupling between the modules can be electrical, mechanical or other forms of coupling.
[0251] In addition, each functional module in each embodiment of the present application can be integrated in one processing module, or each module can exist physically independently, or two or more modules can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software functional module.
[0252] As shown in Figure 25 The embodiments of the present application also provide a content computer device 500, which 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, various method steps provided in the above embodiments can be executed. Those skilled in the art can understand that the structure of the computer device shown in the figure does not constitute a limitation on the computer device, and can include more or fewer components than those shown in the figure, or combine certain components, or different component arrangements. Among them:
[0253] The processor 510 can include one or more processing cores. The processor 510 utilizes various interfaces and lines to connect various parts within the entire battery management system, invokes data stored in the memory 520, performs various functions and processes data of the battery management system, and performs various functions and processes data of the computer device by running or executing instructions, programs, instruction sets, or program sets stored in the memory 520, thereby performing overall control of the computer device. Alternatively, the processor 510 can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), a programmable logic array (PLA). The processor 510 can integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes operating systems, user interfaces, and application programs, etc.; the GPU is responsible for rendering and drawing display content; and the modem is used for processing wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 510, but can be realized by a separate communication chip.
[0254] The memory 520 can include a random access memory (RAM) and can also include a read-only memory (ROM). The memory 520 can be used to store instructions, programs, instruction sets, or program sets. The memory 520 can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described above, etc. The data storage area can also store data created by the computer device in use (such as a phone book and audio / video data), etc. Accordingly, the memory 520 can also include a memory controller to provide access for the processor 510 to the memory 520.
[0255] The power supply 530 can be logically connected to the processor 510 through a power management system, so as to realize functions of managing charging, discharging, and power consumption management, etc. through the power management system. The power supply 530 can also include one or more than one direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power state indicator, etc. any component.
[0256] The input unit 540 can be used to receive inputted digital or character information, and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0257] Although not shown, the content computer device 500 can further include a display unit, etc., which will not be described herein. In particular in the present embodiment, the processor 510 in the computer device will load one or more computer programs' processes' corresponding executable files into the memory 520 according to the following instructions, and run the stored in the memory 520 such as phonebook and audio / video data by the processor 510, thereby implementing the various method steps provided by the foregoing embodiments.
[0258] As shown in Figure 26 The present embodiment further provides a computer readable storage medium 600, which stores a computer program 610. The computer program 610 can be invoked by a processor to execute the various method steps provided by the present embodiment.
[0259] The computer readable storage medium can be an electronic storage such as a flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk or ROM. Alternatively, the computer readable storage medium includes a non-volatile computer readable storage medium. The computer readable storage medium 600 has storage space for computer programs that execute any of the method steps in the above embodiments. These computer programs can be read from or written to one or more computer program products. The computer programs can be compressed in a suitable form.
[0260] According to an aspect of the present application, a computer program product is provided, which includes a computer program stored in a computer readable storage medium. A processor of a computer device reads the computer program from the computer readable storage medium. The processor executes the computer program, so that the computer device executes the various method steps provided by the above embodiments.
[0261] The terms "include", "comprise" and "have" in the specification and the above-mentioned drawings are intended to cover non-exclusive inclusion, for example, a process, a method, a system, a product or an apparatus that includes a list of steps or units is not necessarily limited to those clearly listed steps or units, but can include other steps or units that are not clearly listed or inherent to such processes, methods, products or apparatuses. The term "module" or "unit" refers to a computer program or a part of a computer program with predetermined functions, and works together with other related parts to achieve predetermined goals, and can be implemented entirely or partially by using software, hardware (such as processing circuit or memory) or combination thereof. Similarly, one 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 integral module or unit that includes the functions of the module or unit.
[0262] It should be understood that in the present application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases of only A, only B and A and B existing at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the front and rear associated objects. "At least one of the following" or similar expressions means any combination of these items, including any combination of single item or multiple items. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0263] It should be understood that in the description of the embodiments of the present application, the meaning of multiple (or multiple items) is two or more, greater than, less than, more than, etc. are not included in the number, above, below, etc. are included in the number.
[0264] In several embodiments provided by the present application, it should be understood that the disclosed system, device and method 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, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed mutual ones can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0265] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed to multiple network units. Part or all of the units may be selected according to actual needs to achieve the purpose of the embodiment scheme. In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0266] If the integrated unit is realized 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 solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the embodiments of the present application. It should be understood that the various embodiments provided by the embodiments of the present application can be combined in any way to achieve different technical effects.
[0267] The above is only the preferred embodiment of the present application, and does not limit the present application in any form. Although the present application has been disclosed as the above preferred embodiment, it is not intended to limit the present application. Any person skilled in the art can make slight changes or modifications to the above disclosed technical content without departing from the scope of the technical solutions of the present application, and any equivalent embodiments with equivalent changes are equivalent to the above embodiments. Any modification, equivalent change and modification of the above embodiments according to the technical essence of the present application, as long as it does not deviate from the technical solutions of the present application, is still within the scope of the technical solutions of the present application.
Claims
1. A method for training a dialogue model, characterized in that, The method includes: Obtain the target text data matched for the dialogue task; The target text data is classified into topics to obtain the topic fact content corresponding to each dialogue topic under the dialogue task. Based on the factual content of each topic, corresponding prompts are generated, and the prompts are input into the trained generative model to generate dialogue, resulting in multiple initial dialogue contents; Each initial dialogue content is processed for content standardization to obtain multiple target dialogue contents after content standardization. Based on the multiple target dialogue contents, multiple target dialogue prompts are generated, and each target dialogue prompt is input into the dialogue model for dialogue task training to obtain the trained dialogue model.
2. The method according to claim 1, characterized in that, The trained generative model includes a first dialogue generator and a second dialogue generator. It generates corresponding prompts based on the factual content of each topic and inputs these prompts into the trained generative model to generate dialogue, resulting in multiple initial dialogue contents, including: Get the preset prompt template; Based on the preset prompt template, prompts are generated for each topic's factual content to obtain multiple prompt messages; Obtain the rate weight value corresponding to the dialogue generation rate and the quality weight value corresponding to the dialogue generation quality in the dialogue task. When the rate weight value is less than the quality weight value, the first dialogue generator and the second dialogue generator are controlled to generate dialogue based on the multiple prompts to obtain multiple initial dialogue contents.
3. The method according to claim 2, characterized in that, The control of the first dialogue generator and the second dialogue generator to generate dialogue based on the multiple prompts results in multiple initial dialogue contents, including: Multiple dialogue states are obtained, and the dialogue states are used to instruct the first dialogue generator and the second dialogue generator to conduct dialogues in different states. Control the first dialogue generator and the second dialogue generator to generate dialogues based on the multiple prompts and the multiple dialogue states, and obtain multiple initial dialogue contents.
4. The method according to claim 3, characterized in that, The control of the first dialogue generator and the second dialogue generator generates dialogue based on the multiple prompts and multiple dialogue states, resulting in multiple initial dialogue contents, including: Send a start dialogue instruction to the first dialogue generator so that the first dialogue generator performs a dialogue generation operation based on a first prompt information determined from the plurality of prompt information to obtain the start dialogue content. Send a first dialogue instruction to the second dialogue generator so that the second dialogue generator performs a dialogue generation operation based on the initial dialogue content and a first dialogue state randomly determined from the plurality of dialogue states to obtain the first dialogue content. Send a second dialogue instruction to the first dialogue generator so that the first dialogue generator performs a dialogue generation operation based on the first dialogue content and a second dialogue state randomly determined from the plurality of dialogue states to obtain the second dialogue content. Return to the execution of sending the start dialogue instruction to the first dialogue generator to repeatedly execute the dialogue generation operation for a preset number of rounds, collect the start dialogue content, first dialogue content and second dialogue content corresponding to each round of dialogue generation operation, and obtain multiple initial dialogue contents.
5. The method according to claim 4, characterized in that, The method further includes: Count the number of states corresponding to each dialogue state in each round of dialogue generation operation; The obtained initial dialogue content includes: When it is detected that the number of states corresponding to each of the multiple dialogue states is greater than a preset threshold, the multiple initial dialogue contents are saved. When it is detected that the number of states corresponding to each of the multiple dialogue states is not greater than a preset threshold, the process returns to sending the start dialogue instruction to the first dialogue generator to repeatedly execute the dialogue generation operation for a preset number of rounds until the number of states corresponding to each of the multiple dialogue states that are recounted is greater than the preset threshold, thereby obtaining multiple initial dialogue contents.
6. The method according to claim 2, characterized in that, The method further includes: When the rate weight value is not less than the quality weight value, the multiple prompts are respectively input into the first dialogue generator to generate multiple rounds of dialogue and obtain multiple initial dialogue contents.
7. The method according to any one of claims 1 to 6, characterized in that, The process of performing content normalization on each initial dialogue content to obtain multiple target dialogue contents after content normalization includes: Each initial dialogue content is processed for content standardization, resulting in multiple standardized dialogue contents after content standardization. By using multiple statistical indicators, each standardized dialogue content is optimized to obtain multiple target dialogue contents after content optimization.
8. The method according to claim 7, characterized in that, The process of performing content normalization on each initial dialogue content results in multiple normalized dialogue contents, including: Each initial dialogue content is cleaned to obtain multiple intermediate dialogue contents; Each intermediate dialogue content is data-structured to obtain multiple structured dialogue contents. The data structuring is at least used to add content tags to the intermediate dialogue contents. Data augmentation is performed on the content of each structured dialogue to obtain multiple standardized dialogue contents.
9. The method according to claim 8, characterized in that, The content tags include at least dialogue topic tags and dialogue round tags, and the multiple statistical indicators include at least topic distribution and round percentage. The content optimization process is performed on each standardized dialogue content using multiple statistical indicators to obtain multiple target dialogue contents after content optimization, including: The topic distribution is obtained by statistically analyzing the topic tags of each standardized dialogue content; The percentage of rounds is obtained by statistically analyzing the dialogue round tags for each standardized dialogue content. Statistical analysis was performed on the topic distribution and the round number ratio to obtain the corresponding topic analysis results and round number analysis results. Based on the topic analysis results and the round number analysis results, the dialogue content of each standard dialogue content is adjusted to obtain multiple target dialogue contents.
10. The method according to claim 9, characterized in that, The dialogue content is adjusted for each standardized dialogue content based on the topic analysis results and the round-count analysis results, resulting in multiple target dialogue contents, including: When the topic analysis result indicates that the topic distribution is unqualified and the round number analysis result indicates that the round number ratio is qualified, abnormal topics are identified from each standard dialogue content, and dialogue content supplementation processing is performed on the abnormal topics to obtain multiple target dialogue contents after dialogue content supplementation processing. When the topic analysis result indicates that the topic distribution is qualified and the round number analysis result indicates that the round number ratio is unqualified, abnormal rounds are identified from each standard dialogue content, and dialogue content supplementation processing is performed on the abnormal rounds to obtain multiple target dialogue contents after dialogue content supplementation processing. When the topic analysis results indicate that the topic distribution is unqualified and the round analysis results indicate that the round ratio is unqualified, abnormal topics and abnormal rounds are determined from each standard dialogue content, and dialogue content supplementation processing is performed on the abnormal rounds to obtain multiple target dialogue contents after dialogue content supplementation processing.
11. The method according to any one of claims 1 to 10, characterized in that, The step of classifying the target text data into topics to obtain the topic fact content corresponding to each dialogue topic under the dialogue task includes: The target text data is segmented to obtain multiple text data units; The multiple text data units are classified by topic to obtain the text data units corresponding to each dialogue topic under the dialogue task, and each text unit is used as the topic fact content.
12. A testing method for a dialogue model, characterized in that, The method includes: Acquire multiple target dialogue contents and multiple out-of-domain dialogue contents that match the dialogue task; Randomly sample the multiple target dialogue contents and the multiple extra-domain dialogue contents to obtain multiple sampled dialogue contents, and generate sampling prompt information corresponding to each sampled dialogue content; Each sampled prompt is input into the trained dialogue model to perform task dialogue and obtain test dialogue content. The trained dialogue model is tested based on the test dialogue content and evaluation metrics to obtain test results, which indicate the dialogue performance of the trained dialogue model under the dialogue task. The trained dialogue model is obtained by training the dialogue model according to any one of claims 1 to 11.
13. A training device for a dialogue model, characterized in that, The device includes: The data acquisition module is used to acquire the target text data matched for the dialogue task; The topic classification module is used to classify the target text data into topics to obtain the topic fact content corresponding to each dialogue topic under the dialogue task. The dialogue generation module is used to generate corresponding prompts based on the factual content of each topic, and input the prompts into the trained generation model to generate dialogue, thus obtaining multiple initial dialogue contents. The content specification module is used to perform content specification processing on each initial dialogue content to obtain multiple target dialogue contents after content specification processing. The model training module is used to generate multiple target dialogue prompts based on the multiple target dialogue contents, and input each target dialogue prompt into the dialogue model for dialogue task training to obtain the trained dialogue model.
14. A testing device for a dialogue model, characterized in that, The device includes: The dialogue acquisition module is used to acquire multiple target dialogue contents and multiple out-of-domain dialogue contents matched with the dialogue task; The prompt generation module is used to randomly sample the multiple target dialogue contents and the multiple extra-domain dialogue contents to obtain multiple sampled dialogue contents, and generate sampled prompt information corresponding to each sampled dialogue content; The content generation module is used to input each sampled prompt into the trained dialogue model to perform task dialogue and obtain test dialogue content; The model testing module is used to test the trained dialogue model according to the test dialogue content and evaluation indicators, and obtain test results. The test results indicate the dialogue performance of the trained dialogue model under the dialogue task. The trained dialogue model is obtained by training the dialogue model according to any one of claims 1 to 11.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the training method for the dialogue model as described in any one of claims 1 to 11 or the testing method for the dialogue model as described in claim 12.
16. A computer device, characterized in that, include: Memory; The processor, wherein the memory stores a computer program, which, when executed by the processor, implements the training method for the dialogue model as described in any one of claims 1 to 11 or the testing method for the dialogue model as described in claim 12.
17. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the training method of the dialogue model as described in any one of claims 1 to 11 or the testing method of the dialogue model as described in claim 12.
Citation Information
Cited By
Collaborative dialogue type interaction method, system and equipment based on multiple models
CN121434395A