Dialogue processing model training method and device and dialogue method and device
By filtering and labeling the dialogue training data, the dialogue processing model is trained, which solves the problem of poor answering effect of the dialogue processing model in the existing technology, and improves the model's answer accuracy and user experience.
Patent Information
- Application Number
- CN202410786158.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-18
AI Technical Summary
In practical applications, existing dialogue processing models have poor answering effects due to various ways of users asking questions and insufficient training data, and there is a lack of technical solutions to improve the accuracy of model answers.
By determining the initial dialogue processing model associated with the target dialogue field, and filtering out the first and second dialogue training data based on the application data, the model is trained using positive and negative labels to enhance the model's answer accuracy and positive and negative judgment capabilities. .
It improves the answer accuracy and application effect of the dialogue processing model in the target dialogue field, enhances the model's ability to process input data, and improves the user experience.
Smart Images

Figure CN118797344A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular to a method for training a dialogue processing model. One or more embodiments of this specification also relate to a dialogue method, a dialogue processing model training device, a dialogue device, a computing device, a computer-readable storage medium, and a computer program product. Background Art
[0002] Typically, a pre-trained dialog processing model is fine-tuned using specific project data so that the pre-trained dialog processing model can have the ability to conduct conversations on a specific project.
[0003] However, in actual applications, due to various practical reasons, such as the variety of user questioning methods and the lack of training data, the model's answer is quite different from the expected answer, and the answer effect is poor.
[0004] Therefore, there is an urgent need for a technical solution to improve the model's answering effect in order to solve the above technical problems. Summary of the invention
[0005] In view of this, an embodiment of this specification provides a method for training a dialogue processing model. One or more embodiments of this specification also relate to a dialogue method, a dialogue processing model training device, a dialogue device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects of poor answering effect in the prior art.
[0006] According to a first aspect of an embodiment of this specification, a method for training a dialog processing model is provided, comprising:
[0007] Determining an initial dialogue processing model associated with the target dialogue domain, wherein the initial dialogue processing model is obtained by training a pre-trained dialogue processing model using initial dialogue training data associated with the target dialogue domain;
[0008] Determine first dialogue training data and second dialogue training data according to application data of the initial dialogue processing model in the target dialogue field, wherein the first dialogue training data includes a first dialogue training sample and a positive label corresponding to the first dialogue training sample, and the second dialogue training data includes a second dialogue training sample and a negative label corresponding to the second dialogue training sample;
[0009] Training the initial dialogue processing model according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model;
[0010] The updated dialogue processing model is trained according to the first dialogue training sample, the positive label, the second dialogue training sample, and the negative label to obtain a target dialogue processing model.
[0011] According to a second aspect of an embodiment of this specification, a conversation method is provided, including:
[0012] determining input dialogue data associated with a target dialogue domain;
[0013] The input dialogue data is input into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, wherein the dialogue processing model is obtained according to the above-mentioned dialogue processing model training method.
[0014] According to a third aspect of an embodiment of this specification, a dialog processing model training device is provided, including:
[0015] An initial model determination module is configured to determine an initial dialogue processing model associated with a target dialogue domain, wherein the initial dialogue processing model is obtained by training a pre-trained dialogue processing model using initial dialogue training data associated with the target dialogue domain;
[0016] a training data determination module, configured to determine first dialogue training data and second dialogue training data according to application data of the initial dialogue processing model in the target dialogue field, wherein the first dialogue training data includes a first dialogue training sample and a positive label corresponding to the first dialogue training sample, and the second dialogue training data includes a second dialogue training sample and a negative label corresponding to the second dialogue training sample;
[0017] an updated model acquisition module, configured to train the initial dialogue processing model according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model;
[0018] The target model acquisition module is configured to train the updated dialogue processing model according to the first dialogue training sample, the positive label, the second dialogue training sample and the negative label to obtain a target dialogue processing model.
[0019] According to a fourth aspect of the embodiments of this specification, a conversation device is provided, including:
[0020] an input determination module configured to determine input dialogue data associated with a target dialogue domain;
[0021] The output acquisition module is configured to input the input dialogue data into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, wherein the dialogue processing model is obtained according to the above-mentioned dialogue processing model training method.
[0022] According to a fifth aspect of an embodiment of this specification, a computing device is provided, including:
[0023] Memory and processor;
[0024] Among them, the memory is used to store computer programs / instructions, and the processor is used to execute computer programs / instructions. When the computer program / instructions are executed by the processor, the above-mentioned dialogue processing model training method or the steps of the above-mentioned dialogue method are implemented.
[0025] According to a sixth aspect of an embodiment of the present specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned dialogue processing model training method or the above-mentioned dialogue method are implemented.
[0026] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned dialogue processing model training method or the above-mentioned dialogue method.
[0027] An embodiment of the present specification provides a method for training a dialogue processing model. The method determines first dialogue training data and second dialogue training data that are more closely related to a target dialogue field based on application data of an initial dialogue processing model associated with the target dialogue field in the target dialogue field. Then, the initial dialogue processing model is trained again using the first dialogue training data corresponding to the positive label and the initial dialogue training data. An updated dialogue processing model is obtained by adding the first dialogue training data with the positive label. Compared with the initial dialogue processing model, the ability of the initial dialogue processing model to answer accurate answers is enhanced. Furthermore, the updated dialogue processing model obtained above is further trained based on the first dialogue training samples, the positive labels, the second dialogue training samples and the negative labels, thereby further improving the ability of the obtained target dialogue processing model to judge the positive and negative of the input data, and further improving the accuracy and effect of the answers of the target dialogue processing model in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a specific application scenario diagram of a conversation method provided by an embodiment of this specification;
[0029] Figure 2 is a flow chart of a method for training a dialogue processing model provided by an embodiment of this specification;
[0030] Figure 3 is a process flow chart of a method for training a dialogue processing model provided by an embodiment of this specification;
[0031] Figure 4 is a flow chart of a conversation method provided by an embodiment of this specification;
[0032] Figure 5 It is a structural diagram of a dialogue processing model training device provided by an embodiment of this specification;
[0033] Figure 6 It is a structural schematic diagram of a dialogue device provided by an embodiment of this specification;
[0034] Figure 7 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0035] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0036] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0037] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0038] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0039] In one or more embodiments of this specification, a large model refers to a deep learning model with large-scale model parameters, which usually contains hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than 10 trillion model parameters. A large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as a large-scale language model (LLM, Large Language Model), a multi-modal pre-training model, etc.
[0040] When the big model is used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. The big model can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image description (IC, Image Caption), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the big model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.
[0041] First, the terms involved in one or more embodiments of this specification are explained.
[0042] Preference Learning: Preference learning is a subfield of machine learning that can learn the quality of data from data. The input of preference learning can be a set of preferences or pairwise comparisons between items without explicit labels or values. In preference learning, the goal of learning is to infer a model or function that can accurately predict the preferences of individuals or entities based on the observed data. For example, preference learning includes but is not limited to the following methods:
[0043] Pairwise Preference Learning: This approach involves learning pairwise comparisons between items. The goal is to learn a ranking or scoring function that accurately predicts one item over another.
[0044] Label ranking: Label ranking involves learning from a set of items ordered by preference. The goal of label ranking is to learn a model that can predict rankings that are consistent with the observed data.
[0045] Implicit feedback: In this approach, preference information is inferred from implicit signals such as user clicks, purchases, or dwell time.
[0046] Kahneman-Tversky Optimization (KTO): A technique for solving the problem of preference learning in machine learning; preference learning involves learning from preferences or paired comparisons rather than from explicit labels or values. Traditional preference learning methods usually solve the problem by converting "preference comparisons" to "equivalent labels or values", and then applying standard supervised learning techniques for training. However, this conversion may result in information loss or inaccurate models; KTO attempts to directly optimize preference comparisons to better preserve and utilize the original preference information. In addition, KTO relaxes the restrictions on data and does not require paired data. It can be just a single piece of data and has a corresponding label indicating whether the output of this data is desired or unwanted; of course, KTO also supports optimization of paired data.
[0047] Supervised Fine-Tuning (SFT): A training technique in machine learning, especially used in the field of deep learning, which improves the performance of a pre-trained model for a specific task by further training it on task-specific data with labeled examples. After pre-training the initial model, the pre-trained model can be fine-tuned on a smaller dataset specific to the required task. The fine-tuning dataset contains labeled examples related to the task the model is intended to perform. For example, if the pre-trained model was trained on a general image classification task, then fine-tuning may involve further training the model on a dataset specific to a specific domain, such as medical imaging or satellite imagery. During the fine-tuning process, the pre-trained model is trained in a supervised learning setting, specifically by making predictions based on the data input and the corresponding labels provided in the dataset. The fine-tuning process adjusts the parameters of the pre-trained model so that the trained model better adapts to the characteristics of the specific task and the dataset corresponding to the task.
[0048] By constructing a data set using specific project data and performing SFT on LLM, LLM can have the ability to have conversations on specific projects. For example, it can act as an AI English conversation assistant and have English conversations with users on specific topics. Another example is an intelligent math teacher who can answer math questions asked by users and have conversations with users on specific math topics. In actual project scenarios, it is inevitable that some answers will not be effective, which needs to be fixed. Usually, SFT or preference learning can achieve this to a certain extent. Alternatively, preference learning can be used to achieve this when you do not want LLM to output certain content.
[0049] For example, KTO preference learning can be used (other preference learning methods are also possible, such as paired preference learning, etc.). KTO does not need such paired data. It only needs an existing conversation history or text prefix, a model output, and a label indicating whether the model output meets the model training expectations (i.e. goodcase data) or does not meet the model training expectations (i.e. badcase data). The model can be trained with this form of data; this form of data is simpler and more convenient in specific use.
[0050] However, in actual project scenarios, the amount of data is very limited, and the accuracy requirement for the data is also very high; KTO does not make full use of the existing data, and needs to make more full use of the existing data to achieve better results.
[0051] To solve the above technical problems, a method for training a dialogue processing model is provided in this specification. One or more embodiments of this specification also involve a dialogue method, a dialogue processing model training device, a dialogue device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0052] Considering the huge number of model parameters of the large model and the limited computing resources of the mobile terminal, the dialogue method or dialogue processing model training provided in the embodiment of the present application can be applied to the following: Figure 1 The application scenarios shown are not limited to these. Figure 1 In the application scenario shown, the big model is deployed in the server 104, and the server 104 can be connected to one or more clients 102 through a local area network connection, a wide area network connection, an Internet connection, or other types of data networks. The client 102 here may include but is not limited to: smart phones, tablet computers, laptops, PDAs, personal computers, smart home devices, car-mounted devices, etc.; the client 102 can interact with the user through a user interaction interface to call the big model, thereby implementing the method provided in the embodiments of this specification.
[0053] In the embodiments of the present specification, the system composed of the client 102 and the server 104 can perform the following steps: the client 102 generates input dialogue data associated with the target dialogue domain in response to the user's interactive behavior on the user interaction interface of the client 102, the server 104 obtains the input dialogue data from the client, inputs the input dialogue data into the dialogue processing model, obtains output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, and sends the output dialogue data to the client 102, and the client 102 displays the output dialogue data in the user interaction interface for the user to view.
[0054] The dialogue processing model can be obtained by pre-training. The specific training method is as follows:
[0055] Determining an initial dialogue processing model associated with the target dialogue domain, wherein the initial dialogue processing model is obtained by training a pre-trained dialogue processing model using initial dialogue training data associated with the target dialogue domain;
[0056] Determine first dialogue training data and second dialogue training data according to application data of the initial dialogue processing model in the target dialogue field, wherein the first dialogue training data includes a first dialogue training sample and a positive label corresponding to the first dialogue training sample, and the second dialogue training data includes a second dialogue training sample and a negative label corresponding to the second dialogue training sample;
[0057] Training the initial dialogue processing model according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model;
[0058] The updated dialogue processing model is trained according to the first dialogue training sample, the positive label, the second dialogue training sample, and the negative label to obtain a target dialogue processing model.
[0059] It should be noted that, when the operating resources of the client device can meet the deployment and operating conditions of the large model, the embodiments of this specification can be carried out in the client.
[0060] An embodiment of the present specification provides a conversation method, in which a server processes input conversation data input by a client by using a pre-trained conversation processing model to obtain relatively accurate output conversation data, and then sends the relatively accurate output conversation data to the client for display through the user interaction interface of the client. The processing accuracy of the conversation processing model improves the accuracy of the output conversation data and improves the user experience.
[0061] See also Figure 2 , Figure 2 A flowchart of a method for training a dialogue processing model according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0062] Step 202: Determine an initial dialog processing model associated with the target dialog domain.
[0063] The initial dialogue processing model is obtained by training a pre-trained dialogue processing model using initial dialogue training data associated with the target dialogue domain.
[0064] Specifically, the pre-trained dialogue processing model can be understood as a pre-trained model (Pretrain, PT) and a continue pre-trained model (Continue Pretrain, CPT). The pre-trained dialogue processing model can be a model obtained by pre-training a basic large model (the basic large model includes but is not limited to a large language model LLM, a multi-modal pre-training model, etc.). The pre-training process of the pre-trained dialogue processing model can be set according to actual needs, and the embodiments of this specification are not limited to this.
[0065] The target dialogue domain can be understood as the dialogue domain for which dialogue processing is to be performed. Dialogue processing includes but is not limited to Chinese-Chinese dialogue, English-English dialogue, Chinese-English dialogue, Chinese-English mixed dialogue, etc. For example, the target dialogue domain can be understood as the English dialogue domain. In this domain, users input Chinese or English or a combination of Chinese and English, and need to answer in English. For another example, the target dialogue domain can be understood as the math question-and-answer domain. In this domain, users input Chinese and need to answer in Chinese.
[0066] In practical applications, the initial dialogue processing model can be determined by training the pre-trained dialogue processing model. The specific implementation method is as follows:
[0067] The determining of an initial dialogue processing model associated with the target dialogue domain includes:
[0068] Determining initial dialogue training data associated with the target dialogue domain and a pre-trained dialogue processing model, wherein the pre-trained dialogue processing model is a machine learning model;
[0069] The pre-trained dialogue processing model is trained according to the initial dialogue training data to obtain an initial dialogue processing model associated with the target dialogue domain.
[0070] The initial dialogue training data may be understood as dialogue data in a data set associated with a target dialogue domain, or may be understood as user dialogue record data in project application data associated with a target dialogue domain obtained online.
[0071] In a specific implementation, initial dialogue training data associated with the target dialogue domain and a pre-trained dialogue processing model that has been pre-trained in advance can be determined, and the pre-trained dialogue processing model can be trained using the initial dialogue training data so that the trained initial dialogue processing model has the data processing capability of the target dialogue domain, that is, the initial dialogue processing model associated with the target dialogue domain is obtained.
[0072] An embodiment of the present specification provides a method for training a dialogue processing model. The method uses initial dialogue training data managed with a target dialogue domain to train a pre-trained dialogue processing model, thereby obtaining an initial dialogue processing model associated with the target dialogue domain. This improves the degree of adaptation between the initial dialogue processing model and the target dialogue domain, improves the target dialogue domain dialogue processing capability of the initial dialogue processing model, and thereby improves the accuracy of subsequent dialogue processing using the initial dialogue processing model.
[0073] Step 204: Determine first dialogue training data and second dialogue training data according to application data of the initial dialogue processing model in the target dialogue domain.
[0074] The first dialogue training data includes a first dialogue training sample and a positive label corresponding to the first dialogue training sample, and the second dialogue training data includes a second dialogue training sample and a negative label corresponding to the second dialogue training sample.
[0075] Specifically, the application data of the initial dialogue processing model in the target dialogue field can be understood as the projects in the target dialogue field that actually apply the initial dialogue processing model, and the application data generated in the actual application process, for example, the user uses the English dialogue application of the initial dialogue processing model, and the user usage data generated by the application, or the test data generated by the staff testing the initial dialogue processing model, etc.
[0076] A positive label can be understood as a label for a certain sample whose corresponding sample label meets the expected dialogue requirements. The expected dialogue requirements are the expected requirements of the target dialogue field. For example, when the target dialogue field is English dialogue, the positive label can be understood as the model providing an all-English answer; or, when the target dialogue field is math question-answering, the positive label can be understood as the model providing answers to math problems, and so on.
[0077] A negative label can be understood as a label for a certain sample whose corresponding sample label does not meet the expected dialogue requirements. For example, when the target dialogue domain is English dialogue, the positive label can be understood as the model providing Chinese answers or mixed Chinese and English answers; or, when the target dialogue domain is math question-answering, the negative label can be understood as the model providing responses with knowledge in non-mathematical fields, etc.
[0078] The first dialogue training data can be understood as dialogue training data that meets the expected dialogue requirements, and the second dialogue training data can be understood as dialogue training data that does not meet the expected dialogue requirements. The first dialogue training data and the second dialogue training data can be obtained by marking the application data of the initial dialogue processing model in the target dialogue field, or by screening the application data of the initial dialogue processing model in the target dialogue field and then marking it, or by marking the application data of the initial dialogue processing model in the target dialogue field and then screening it.
[0079] The specific implementation is as follows:
[0080] Before determining the first dialogue training data and the second dialogue training data according to the application data of the initial dialogue processing model in the target dialogue field, the method further includes:
[0081] Deploy the initial dialogue processing model, perform dialogue processing based on the initial dialogue processing model, and obtain dialogue data;
[0082] Filtering target conversation data associated with the target conversation domain from the conversation data;
[0083] The target dialogue data is determined as application data of the initial dialogue processing model in the target dialogue field.
[0084] Among them, the initial dialogue processing model can be deployed in the server or in the client. Accordingly, when the initial dialogue processing model is deployed in the server, the application data of the initial dialogue processing model in the target dialogue field can be obtained in the server. When the initial dialogue processing model is deployed in the client, the application data of the initial dialogue processing model in the target dialogue field can be determined by calling the initial dialogue processing model by the client.
[0085] Furthermore, after the deployment of the initial dialogue processing model is completed, dialogue processing can be performed based on the initial dialogue processing model, for example, by manually inputting dialogue data or by machine randomly generating input dialogue data, inputting the input dialogue data into the initial dialogue processing model, obtaining output dialogue data output by the model, and using the input dialogue data and the output dialogue data as dialogue data.
[0086] Furthermore, the dialogue data associated with the target dialogue domain is screened out from the dialogue data and determined as the target dialogue data, so that the target dialogue data can be determined as the application data of the initial dialogue processing model in the target dialogue domain.
[0087] An embodiment of the present specification provides a method for training a dialogue processing model. The method utilizes an initial dialogue processing model with dialogue capabilities in a target dialogue domain to perform actual model application and obtain application data of the initial dialogue model in the target dialogue domain. This makes the application data of the initial dialogue model in the target dialogue domain more matched with the target dialogue domain, has higher data quality, and improves the accuracy of subsequent model training.
[0088] In actual applications, when the initial dialog processing model is deployed on the client, the specific implementation of the model call is as follows:
[0089] The deploying the initial dialogue processing model, performing dialogue processing based on the initial dialogue processing model, and obtaining dialogue data includes:
[0090] Deploying the initial dialogue processing model on a client so that the initial dialogue processing model performs dialogue processing on the client to generate dialogue data;
[0091] The session data is obtained from the client.
[0092] Specifically, when the initial conversation model is deployed on the client, the client performs conversation processing on the client based on the initial conversation processing model to generate conversation data. For specific implementation methods, please refer to the specific implementation methods of the above-mentioned server performing conversation processing based on the initial conversation processing model to generate conversation data.
[0093] Furthermore, the server may obtain the conversation data from the client, and subsequently determine application data of the initial conversation model in the target conversation field based on the conversation data. The specific implementation method may refer to the above-mentioned embodiment of the specification, which will not be described in detail here.
[0094] An embodiment of the present specification provides a method for training a conversation processing model, which deploys an initial conversation processing model on a client so that the client can directly interact with a user based on the initial conversation processing model, thereby improving the accuracy of the obtained conversation data. In addition, deploying the initial conversation processing model on the client reduces the resource usage of the server and improves the efficiency of server training.
[0095] In practical applications, in order to balance the accuracy of model training and the resource consumption of model training, the required data volume, that is, the data volume of the first dialogue training data and the second dialogue training data, can be determined according to the model training task. The specific implementation method is as follows:
[0096] Before determining the first dialogue training data and the second dialogue training data according to the application data of the initial dialogue processing model in the target dialogue field, the method further includes:
[0097] Determining a target dialogue processing task, wherein the target dialogue processing task is processed according to the target dialogue processing model;
[0098] The target dialogue processing task is analyzed, and according to the task analysis result, the amount of model training data for training the target dialogue processing model is determined.
[0099] Among them, the target dialogue processing task can be understood as the dialogue processing task that is subsequently performed using the initial dialogue model. The dialogue task that needs to be processed, for example, a Chinese dialogue task, an all-English dialogue task, etc. Different target dialogue processing tasks correspond to different model training complexities.
[0100] During specific implementation, the target dialogue processing task that needs to be processed by the target dialogue processing model obtained subsequently can be determined, and the target dialogue processing task can be analyzed to obtain a task analysis result including the complexity of the target dialogue processing task. According to the complexity of the target dialogue processing task, the amount of model training data for training the target dialogue processing model can be determined, and the amount of model training data is the total amount of data of the first dialogue training data and the second dialogue training data.
[0101] For example, the complexity of the Chinese dialogue task is relatively low, so the amount of model training data for training the target dialogue processing model can be determined to be 150. The complexity of the all-English dialogue task is relatively high, so the amount of model training data for training the target dialogue processing model can be determined to be 200. The complexity of the all-English dialogue task with no repetition in a single dialogue is even higher, so the amount of model training data for training the target dialogue processing model can be determined to be 300, and so on.
[0102] An embodiment of the present specification provides a method for training a dialogue processing model, which determines the appropriate amount of model training data according to the target dialogue processing task that the target dialogue processing model needs to process, thereby ensuring the accuracy of the model training of the target dialogue processing model, ensuring the model effect of the target dialogue processing model, and avoiding high resource consumption caused by the model training of the dialogue processing model.
[0103] In practical applications, after the target dialogue processing task is determined as above, the application data can be screened according to the amount of model training data required for the target dialogue processing task to obtain the first dialogue training data and the second dialogue training data, so as to take into account the accuracy of model training and the resource consumption of model training. The specific implementation method is as follows:
[0104] The determining of the first dialogue training data and the second dialogue training data according to the application data of the initial dialogue processing model in the target dialogue field comprises:
[0105] Determine the total dialogue training data that meets the model training data amount according to the target dialogue processing task and the application data of the initial dialogue processing model in the target dialogue field;
[0106] The first dialogue training data and the second dialogue training data are determined according to the total dialogue training data.
[0107] Specifically, the total dialogue training data that satisfies the model training data volume is determined based on the target dialogue processing task and the application data of the initial dialogue processing model in the target dialogue field. This can be understood as determining the total dialogue training data that satisfies the model training data volume from the application data of the initial dialogue processing model in the target dialogue field based on the model training data volume required for the target dialogue processing task.
[0108] For example, based on the amount of model training data corresponding to the target dialogue processing task, application data that meets the amount of model training data is determined from the application data of the initial dialogue processing model in the target dialogue field as the total dialogue training data, or, for example, based on the target dialogue processing task, the total amount of model training data corresponding to the target dialogue processing task is determined, and a preset percentage (for example, 50%) of the total amount of model training data is used as the model training data amount, and then, from the application data of the initial dialogue processing model in the target dialogue field, application data that meets the amount of model training data is determined as the total dialogue training data, and so on.
[0109] Afterwards, the first dialogue training data and the second dialogue training data may be determined based on the total dialogue training data.
[0110] For example, it is determined that 200 total dialogue training data are obtained, it is determined that 150 first dialogue training data and 50 second dialogue training data are obtained, or 100 first dialogue training data and 100 second dialogue training data are obtained, or 200 first dialogue training data and 0 second dialogue training data, or 0 first dialogue training data and 200 second dialogue training data, and so on.
[0111] An embodiment of the present specification provides a conversation processing model training method, which screens application data according to the amount of model training data, and determines first conversation training data and second conversation training data from the screened total conversation training data, thereby improving the data quality of the first conversation training data and the second conversation training data, avoiding resource consumption caused by subsequent model training based on the first conversation training data and the second conversation training data, and ensuring the stability of the training process of the model training.
[0112] In practical applications, we can first filter the application data in the target dialogue field according to the target dialogue processing task, and then consider the data volume to balance the quality of the total dialogue training data finally obtained and the subsequent labeling workload. The specific implementation method is as follows:
[0113] The determining, based on the target dialogue processing task and the application data of the initial dialogue processing model in the target dialogue field, total dialogue training data that satisfies the model training data amount includes:
[0114] According to the target dialogue processing task, initial dialogue training data is screened out from application data of the initial dialogue processing model in the target dialogue field;
[0115] When it is determined that the data volume of the initial dialogue training data is greater than or equal to the data volume of the model training data, total dialogue training data that satisfies the data volume of the model training data is selected from the initial dialogue training data.
[0116] In a specific implementation, according to the target dialogue processing task, initial dialogue training data is screened out from the application data of the initial dialogue processing model in the target dialogue field. This can be understood as screening out application data associated with the target dialogue processing task from the application data of the initial dialogue processing model in the target dialogue field as the initial dialogue training data based on the amount of model training data corresponding to the target dialogue processing task.
[0117] Furthermore, since the data volume of the application data associated with the target dialogue processing task can be greater than, equal to, or less than the model training data volume, the relationship between the data volume of the initial dialogue training data and the model training data volume can be determined accordingly. When the data volume of the initial dialogue training data is greater than or equal to the model training data volume, it is considered that the data volume of the total dialogue training data obtained by the above screening is large, and therefore the total dialogue training data that meets the model training data volume can be selected from the initial dialogue training data.
[0118] An embodiment of the present specification provides a method for training a dialogue processing model. According to a target dialogue processing task, application data is screened to obtain initial dialogue training data associated with the target dialogue processing task to achieve a preliminary screening of the application data. The accuracy of the first dialogue training data and the second dialogue training data obtained subsequently can be ensured. When the amount of the initial dialogue training data is greater than or equal to the amount of model training data, total dialogue training data that meets the amount of model training data is selected from the initial dialogue training data, thereby ensuring the accuracy of subsequent model training.
[0119] In practical applications, the total dialogue data that meets the model training data volume is determined based on the initial dialogue training data, and can be screened based on data quality to improve the model effect of the target dialogue processing model that is ultimately obtained. The specific implementation method is as follows:
[0120] The selecting, from the initial dialogue training data, total dialogue training data that satisfies the model training data amount comprises:
[0121] Calculating the data quality of the initial dialogue training data;
[0122] The initial dialogue training data is sorted according to the data quality, and total dialogue training data that meets the model training data amount is selected according to the sorting result.
[0123] Among them, data quality includes but is not limited to data integrity, data accuracy, data validity, etc.
[0124] Calculating the data quality of the initial dialogue training data can be understood as evaluating the data quality of the initial dialogue training data. For example, when data quality is understood as data accuracy, the dialogue logic of the initial dialogue training data can be evaluated, and a dialogue logic score of the initial dialogue training data can be obtained, which is the data quality of the initial dialogue training data. For another example, when data quality is understood as data validity, the initial dialogue training data can be compared with expected dialogue data (such as expected data language, data format, etc.), and a validity score of the initial dialogue training data can be obtained, which can be used as the data quality of the initial dialogue training data.
[0125] In a specific implementation, the data quality of the initial dialogue training data can be calculated. When the initial dialogue training data includes at least two data, the data quality of each of the at least two initial dialogue training data can be calculated. After that, the initial dialogue training data are sorted according to the data quality, and according to the sorting result, the initial dialogue training data with the highest sorting that meets the model training data amount is taken as the total dialogue training data. For example, when the model training data amount is 200, the first 200 initial dialogue training data can be used as the total dialogue training data.
[0126] An embodiment of the present specification provides a method for training a dialogue processing model, which further improves the data reliability of the total dialogue training data by sorting and screening the data quality of the initial dialogue training data, thereby further improving the accuracy and model effect of the model training of the target dialogue processing model.
[0127] In practical applications, when the amount of initial dialogue training data is less than the amount of model training data, the amplification method can be used to ensure sufficient total dialogue training data to ensure the accuracy of model training. The specific implementation method is as follows:
[0128] After selecting the initial dialogue training data from the application data of the initial dialogue processing model in the target dialogue field according to the target dialogue processing task, the method further includes:
[0129] When it is determined that the data volume of the initial dialogue training data is less than the data volume of the model training data, the initial dialogue training data is amplified according to the target dialogue processing task to obtain total dialogue training data that meets the data volume of the model training.
[0130] Among them, augmentation includes but is not limited to obtaining data from a new dialogue training data set to process and obtain total dialogue training data, rewriting the initial dialogue training data to obtain total dialogue training data that meets the model training data volume, etc. In practical applications, the source of augmented data can be selected according to actual needs and is not limited to this.
[0131] In specific implementation, when it is determined that the data volume of the initial dialogue training data is smaller than the data volume of the model training data, the augmented data associated with the target dialogue processing task is determined according to the target dialogue processing task, and the augmented data is subjected to the above-mentioned screening and other processing, and the augmented data is augmented to the initial dialogue training data to obtain the total dialogue training data that meets the data volume of the model training.
[0132] For example, if the data volume of the initial dialogue training data is 100, the initial dialogue training data can be rewritten to obtain 100 rewritten initial dialogue training data, and the initial dialogue training data and the rewritten 100 initial dialogue training data are determined as the total dialogue training data that meets the data volume of 200.
[0133] An embodiment of the present specification provides a method for training a dialogue processing model. When it is determined that the data volume of the initial dialogue training data is smaller than the data volume of the model training data, the initial dialogue training data is amplified, thereby ensuring the data volume of the total dialogue training data and thus ensuring the model training effect.
[0134] In practical applications, after obtaining the total dialogue training data, the total dialogue training data can be labeled to obtain the first dialogue training data and the second dialogue training data. The specific implementation method is as follows:
[0135] The determining the first dialogue training data and the second dialogue training data according to the total dialogue training data includes:
[0136] Labeling the total dialogue training data to obtain a positive label or a negative label corresponding to the total dialogue training data;
[0137] In a case where the label corresponding to the total dialogue training data is a positive label, determining the total dialogue training data as the first dialogue training sample;
[0138] In a case where the label corresponding to the total dialogue training data is a negative label, determining the total dialogue training data as the second dialogue training sample;
[0139] determining the first dialogue training data according to the first dialogue training sample and the positive label corresponding to the first dialogue training sample;
[0140] The second dialogue training data is determined according to the second dialogue training sample and the negative label corresponding to the second dialogue training sample.
[0141] Specifically, labeling of the total dialogue training data may be achieved by manual labeling or by utilizing a labeling machine learning model, which is not limited in the embodiments of this specification.
[0142] In specific implementation, by labeling the total dialogue training data, it can be determined whether each total dialogue training data is required (goodcase) or not required (badcase), and a positive label is marked for the goodcase and a negative label is marked for the badcase.
[0143] Furthermore, the total dialogue training data marked with positive labels may be determined as the first dialogue training sample, and the first dialogue training sample and the positive label corresponding to the first dialogue training sample may be determined as the first dialogue training data.
[0144] Furthermore, the total dialogue training data marked with negative labels can be determined as the second dialogue training sample, and the second dialogue training sample and the negative label corresponding to the second dialogue training sample can be determined as the second dialogue training data.
[0145] An embodiment of the present specification provides a method for training a dialogue processing model. When it is determined that the data volume of the initial dialogue training data is smaller than the data volume of the model training data, the initial dialogue training data is amplified, thereby ensuring the data volume of the total dialogue training data and thus ensuring the model training effect.
[0146] In practical applications, the data volume ratio of the first dialogue training data and the second dialogue training data can be set, for example, 1:1, 1.2:1, etc., to improve the model training effect. The specific implementation method is as follows:
[0147] Before determining the first dialogue training data and the second dialogue training data according to the total dialogue training data, the method further includes:
[0148] Determining a first data amount of the first dialogue training data and a second data amount of the second dialogue training data according to the model training data amount, wherein the sum of the first data amount and the second data amount is equal to the model training data amount;
[0149] After determining the total dialogue training data as the second dialogue training sample, the method further includes:
[0150] Determining a first sample quantity of the first conversation training sample, and determining a second sample quantity of the second conversation training sample;
[0151] The first dialogue training data and the second dialogue training data are adjusted according to a matching relationship between the first data amount and the first sample quantity, and a matching relationship between the second data amount and the second sample quantity.
[0152] Among them, the first data amount and the second data amount can be determined by presetting the data amount ratio of the first dialogue training data and the second dialogue training data and the model training data amount. For example, the model training data amount is 200, and the data amount ratio of the first dialogue training data and the second dialogue training data is preset to be 1:1, then the first data amount can be determined to be 100 and the second data amount can be determined to be 100.
[0153] The first sample quantity may be understood as the number of samples included in the first dialogue training sample, and the second sample quantity may be the number of samples included in the second dialogue training sample.
[0154] In a specific implementation, a first data amount of the first conversation training data amount and a second data amount of the second conversation data amount can be determined according to the model training data amount. After obtaining the first conversation training sample and the second conversation training sample, a first sample amount of the first conversation training sample and a second sample amount of the second conversation training sample can be determined according to the first conversation training sample and the second conversation training sample.
[0155] Furthermore, the first dialogue training data and the second dialogue training data may be adjusted according to a size matching relationship between the first data volume and the first sample quantity, and a size matching relationship between the second data volume and the second sample quantity.
[0156] Using the above example, for example, if the number of first samples is 150 and the number of second samples is 50, the first dialogue training data and the second dialogue training data are adjusted so that the data volume of the first dialogue training data reaches 100 and the data volume of the second dialogue training data reaches 100.
[0157] A method for training a dialogue processing model provided by an embodiment of the present specification ensures the diversity of model training by ensuring the data volume relationship between the first dialogue training data and the second dialogue training data, thereby further improving the training accuracy of the model training.
[0158] In practical applications, since data is usually difficult to retrieve, when the data amount of the first dialogue training data and the second dialogue training data does not meet the expected first data amount and second data amount, the first dialogue training data or the second dialogue training data may be rewritten to obtain the first dialogue training data and the second dialogue training data that meet the first data amount and the second data amount. The specific implementation method is as follows:
[0159] The adjusting the first dialogue training data and the second dialogue training data according to the matching relationship between the first data amount and the first sample amount, and the matching relationship between the second data amount and the second sample amount, includes:
[0160] If it is determined that the first data amount is greater than the first sample amount, adjusting the first dialogue training data according to the second dialogue training data; or
[0161] When it is determined that the second data amount is greater than the second sample quantity, the second dialogue training data is adjusted according to the first dialogue training data.
[0162] Specifically, adjusting the first conversation training data according to the second conversation training data can be understood as rewriting a part of the first conversation training sample in the first conversation training data according to the label of the second conversation training data to obtain a rewritten first conversation training sample, the data volume of the rewritten first conversation training sample is the difference between the first data volume and the first sample quantity, and a negative label is assigned to the rewritten first conversation training sample, and the rewritten first conversation training sample and the corresponding negative label are added to the second conversation training data.
[0163] For the specific implementation method of adjusting the second dialogue training data according to the first dialogue training data, reference may be made to the specific implementation method of adjusting the first dialogue training data according to the second dialogue training data, which will not be described in detail.
[0164] An embodiment of the present specification provides a method for training a dialogue processing model, which reduces the data acquisition cost required for acquiring new data by using the first dialogue training data and the second dialogue training data themselves for data adjustment, thereby reducing the data cost required for model training.
[0165] Step 206: Train the initial dialogue processing model according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model.
[0166] Specifically, after the initial dialogue training data and the first dialogue training sample are obtained as described above, the initial dialogue processing model can be trained according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model. This can be understood as taking the initial dialogue training data and the first dialogue training sample as initial dialogue processing model training samples, inputting them into the initial dialogue processing model, and performing unlabeled supervised training on the initial dialogue processing model until the training is completed to obtain an updated dialogue processing model.
[0167] Furthermore, since the first dialogue training sample is added to the training of the initial dialogue processing model, the ability of the initial dialogue processing model to train towards positive labels is increased, thereby improving the model processing capability of the obtained updated dialogue processing model for the target dialogue domain.
[0168] Step 208: Train the updated dialogue processing model according to the first dialogue training sample, the positive label, the second dialogue training sample, and the negative label to obtain a target dialogue processing model.
[0169] Specifically, the updated dialogue processing model is trained according to the first dialogue training sample, the positive label, the second dialogue training sample, and the negative label to obtain the target dialogue processing model. It can be understood that the first dialogue training sample and the second dialogue training sample are used as training samples for the updated dialogue processing model, and the positive label corresponding to the first dialogue training sample and the negative label corresponding to the second dialogue training sample are used as training labels for the updated dialogue processing model, which are input into the updated dialogue processing model, and labeled supervised training of the updated dialogue processing model is performed until the training is completed to obtain the target dialogue processing model, so that the output of the target dialogue processing model is more in line with the expected output (i.e., more inclined to the positive label and further away from the negative label).
[0170] An embodiment of the present specification provides a method for training a dialogue processing model. The method determines first dialogue training data and second dialogue training data that are more closely related to the target dialogue field through an initial dialogue processing model associated with a target dialogue field and application data in the target dialogue field. Afterwards, the initial dialogue processing model is trained again using the first dialogue training data with positive labels and the initial dialogue training data. An updated dialogue processing model is obtained by adding the first dialogue training data with positive labels. Compared with the initial dialogue processing model, the ability of the initial dialogue processing model to answer accurate answers is enhanced. Furthermore, the updated dialogue processing model obtained above is further trained based on the first dialogue training samples, positive labels, second dialogue training samples and negative labels, thereby further improving the ability of the obtained target dialogue processing model to judge the positive and negative of input data, and further improving the accuracy and effect of the target dialogue processing model in actual applications.
[0171] The following combination Figure 3 Taking the application of the dialogue processing model training method provided in this specification in English dialogue as an example, the dialogue processing model training method is further described. Figure 3 A processing flow chart of a dialogue processing model training method provided by an embodiment of the present specification is shown, which specifically includes the following steps.
[0172] Step 302: Determine the CPT model.
[0173] Specifically, the CPT model can be understood as the above-mentioned pre-trained dialogue processing model, which can be obtained by pre-training the LLM model and continuing to pre-train the pre-trained model.
[0174] Step 304: Train to obtain a first SFT model.
[0175] Specifically, the first SFT model can be understood as the above-mentioned initial dialogue processing model. After the CPT model is determined, domain data related to the English dialogue domain can be obtained, and the CPT model can be trained according to the domain data (ie, SFT data) to obtain the first SFT model.
[0176] Step 306: Collect project data.
[0177] Specifically, after obtaining the first SFT model as mentioned above, the first SFT model is deployed on the server, and a first SFT model interface is provided so that the client can call the first SFT model to interact with the user and generate project data. The server collects the project data from the client for subsequent model training.
[0178] Step 308: Determine application data.
[0179] Specifically, the collected project data can be screened and labeled to obtain positively labeled project data (i.e., goodcase data) and negatively labeled project data (i.e., badcase data) related to the English dialogue field.
[0180] Step 310: Train to obtain a second SFT model.
[0181] Specifically, the second SFT model can be understood as the above-mentioned updated dialogue processing model. After obtaining the positive label item data related to the English dialogue domain, the above-mentioned domain data and the positive label item data related to the English dialogue domain are used to train the first SFT model obtained above to obtain the second SFT model, so that the output of the second SFT model is more biased towards the positive label direction.
[0182] Step 312: Train to obtain a KTO model.
[0183] Specifically, the KTO model can be understood as the target dialogue processing model mentioned above. After obtaining the second SFT model, the second SFT model can be trained by using the positive label project data (i.e. goodcase) and negative label project data (i.e. badcase) related to the English dialogue field to perform preference learning on the second SFT model, thereby training the KTO model, further improving the degree of bias of the KTO model output towards positive labels, thereby improving the subsequent model application effect.
[0184] In specific implementation, the specific implementation method of using the positive label project data to perform preference learning training on the second SFT model is to determine multiple positive training samples according to the dialogue data contained in the positive label project data, and input the multiple positive training samples into the second SFT model, the second SFT model performs preference learning and prediction on the positive training samples, and obtains the predicted positive dialogue data predicted by the second SFT model for each positive training sample, and calculates the positive label loss function according to each training sample and the predicted dialogue data corresponding to each training sample; the specific implementation method of using the negative label project data to perform preference learning training on the second SFT model is to determine multiple negative training samples according to the dialogue data contained in the negative label project data, and input the multiple negative training samples into the second SFT model, the second SFT model performs preference learning and prediction on the negative training samples, and obtains the predicted negative dialogue data predicted by the second SFT model for each negative training sample, and calculates the negative label loss function according to each negative training sample and the negative sample dialogue data corresponding to each negative training sample, thereby iteratively updating the second SFT model according to the calculation result of the positive label loss function or the calculation result of the negative label loss function until the KTO model is obtained.
[0185] For example, the positive label loss function can be understood as the following formula (1):
[0186]
[0187] Among them, β can be understood as a preset hyperparameter, such as 0.01;
[0188] x can be understood as the positive training sample mentioned above, and y can be understood as the predicted positive dialogue data mentioned above;
[0189] π θ This can be understood as the second SFT model mentioned above;
[0190] π ref It can be understood as the second SFT model after each iteration update;
[0191] KL div It can be understood as a preset KL divergence to characterize the KL divergence between the second SFT model and the second SFT model after each iterative update;
[0192] The mathematical form of Sigmoid is as follows:
[0193]
[0194] For another example, the negative label loss function can be understood as the following formula (3):
[0195]
[0196] Among them, β can be understood as a preset hyperparameter, such as 0.01;
[0197] x can be understood as the negative training sample mentioned above, and y can be understood as the predicted negative dialogue data mentioned above;
[0198] π θ This can be understood as the second SFT model mentioned above;
[0199] π ref It can be understood as the second SFT model after each iteration update;
[0200] KL div It can be understood as a preset KL divergence, which is used to characterize the KL divergence between the second SFT model and the second SFT model after each iteration update;
[0201] The mathematical form of Sigmoid is as described in the above formula (2).
[0202] An embodiment of the present specification provides a method for training a dialogue processing model. By utilizing domain data related to a specific domain, a CPT model is trained so that the first SFT model obtained by training is better adapted to the specific domain, thereby improving the model output accuracy of the first SFT model. Furthermore, by collecting project data using the first SFT model as an application, the accuracy of the project data is improved, thereby further improving the accuracy of subsequent models trained based on the project data (including a second SFT model and a KTO model); and, since the project data is utilized to increase the training of the first SFT model, the bias of the output of the trained SFT model to positive labels is improved, and there is no need to reacquire data, thereby reducing the cost of data acquisition; in addition, the project data is utilized to perform preference learning on the second SFT model, thereby further improving the model effect of the obtained KTO model.
[0203] See also Figure 4 , Figure 4 A flow chart of a dialogue method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0204] Step 402: Determine input dialog data associated with the target dialog domain.
[0205] Step 404: Input the input dialogue data into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, wherein the dialogue processing model is obtained according to the above-mentioned dialogue processing model training method.
[0206] In one or more embodiments provided in this specification, the determining the input dialogue data associated with the target dialogue domain includes:
[0207] Acquire input dialogue data associated with the target dialogue domain sent by the client, wherein the input dialogue data is generated by the client in response to a user's interaction behavior on a user interaction interface of the client, and the user interaction interface is associated with the target dialogue domain;
[0208] After obtaining the output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, the method further includes:
[0209] The output dialogue data is sent to the client, so that the client displays the output dialogue data in the user interaction interface.
[0210] In one or more embodiments provided in this specification, inputting the input dialogue data into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain includes:
[0211] The dialogue processing model interface is called, and the input dialogue data is input into the dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain.
[0212] Among them, the dialogue processing model interface includes but is not limited to hardware interface, API interface, etc. During specific implementation, the specific implementation method of the embodiments of this specification can be found in the above-mentioned embodiments of the specification, and will not be repeated here.
[0213] An embodiment of the present specification provides a conversation method, in which a server processes input conversation data input by a client by using a pre-trained conversation processing model to obtain relatively accurate output conversation data, and then sends the relatively accurate output conversation data to the client for display through the user interaction interface of the client. The processing accuracy of the conversation processing model improves the accuracy of the output conversation data and improves the user experience.
[0214] Corresponding to the above method embodiment, this specification also provides a dialogue processing model training device embodiment, Figure 5 FIG. 1 is a schematic diagram showing the structure of a dialog processing model training device provided by an embodiment of the present specification. Figure 5 As shown, the device comprises:
[0215] An initial model determination module 502 is configured to determine an initial dialogue processing model associated with a target dialogue domain, wherein the initial dialogue processing model is obtained by training a pre-trained dialogue processing model using initial dialogue training data associated with the target dialogue domain;
[0216] The training data determination module 504 is configured to determine first dialogue training data and second dialogue training data according to the application data of the initial dialogue processing model in the target dialogue field, wherein the first dialogue training data includes a first dialogue training sample and a positive label corresponding to the first dialogue training sample, and the second dialogue training data includes a second dialogue training sample and a negative label corresponding to the second dialogue training sample;
[0217] An updated model acquisition module 506 is configured to train the initial dialogue processing model according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model;
[0218] The target model acquisition module 508 is configured to train the updated dialogue processing model according to the first dialogue training sample, the positive label, the second dialogue training sample and the negative label to obtain a target dialogue processing model.
[0219] Optionally, the device further includes an application data determination module configured to:
[0220] Deploy the initial dialogue processing model, perform dialogue processing based on the initial dialogue processing model, and obtain dialogue data;
[0221] Filtering target conversation data associated with the target conversation domain from the conversation data;
[0222] The target dialogue data is determined as application data of the initial dialogue processing model in the target dialogue field.
[0223] Optionally, the application data determination module is further configured to:
[0224] Deploying the initial dialogue processing model on a client so that the initial dialogue processing model performs dialogue processing on the client to generate dialogue data;
[0225] The session data is obtained from the client.
[0226] Optionally, the device further includes a model training data amount determination module, which is configured to:
[0227] Determining a target dialogue processing task, wherein the target dialogue processing task is processed according to the target dialogue processing model;
[0228] The target dialogue processing task is analyzed, and according to the task analysis result, the amount of model training data for training the target dialogue processing model is determined.
[0229] Optionally, the training data determination module 504 is further configured to:
[0230] Determine the total dialogue training data that meets the model training data amount according to the target dialogue processing task and the application data of the initial dialogue processing model in the target dialogue field;
[0231] The first dialogue training data and the second dialogue training data are determined according to the total dialogue training data.
[0232] Optionally, the training data determination module 504 is further configured to:
[0233] According to the target dialogue processing task, initial dialogue training data is screened out from application data of the initial dialogue processing model in the target dialogue field;
[0234] When it is determined that the data volume of the initial dialogue training data is greater than or equal to the data volume of the model training data, total dialogue training data that satisfies the data volume of the model training data is selected from the initial dialogue training data.
[0235] Optionally, the training data determination module 504 is further configured to:
[0236] Calculating the data quality of the initial dialogue training data;
[0237] The initial dialogue training data is sorted according to the data quality, and total dialogue training data that meets the model training data amount is selected according to the sorting result.
[0238] Optionally, the device further includes a data augmentation module configured to:
[0239] When it is determined that the data volume of the initial dialogue training data is less than the data volume of the model training data, the initial dialogue training data is amplified according to the target dialogue processing task to obtain total dialogue training data that meets the data volume of the model training.
[0240] Optionally, the training data determination module 504 is further configured to:
[0241] Labeling the total dialogue training data to obtain a positive label or a negative label corresponding to the total dialogue training data;
[0242] In a case where the label corresponding to the total dialogue training data is a positive label, determining the total dialogue training data as the first dialogue training sample;
[0243] In a case where the label corresponding to the total dialogue training data is a negative label, determining the total dialogue training data as the second dialogue training sample;
[0244] determining the first dialogue training data according to the first dialogue training sample and the positive label corresponding to the first dialogue training sample;
[0245] The second dialogue training data is determined according to the second dialogue training sample and the negative label corresponding to the second dialogue training sample.
[0246] Optionally, the device further includes a training data adjustment module configured to:
[0247] Determining a first data amount of the first dialogue training data and a second data amount of the second dialogue training data according to the model training data amount, wherein the sum of the first data amount and the second data amount is equal to the model training data amount;
[0248] After determining the total dialogue training data as the second dialogue training sample, the method further includes:
[0249] Determining a first sample quantity of the first conversation training sample, and determining a second sample quantity of the second conversation training sample;
[0250] The first dialogue training data and the second dialogue training data are adjusted according to a matching relationship between the first data amount and the first sample quantity, and a matching relationship between the second data amount and the second sample quantity.
[0251] Optionally, the training data adjustment module is further configured to:
[0252] If it is determined that the first data amount is greater than the first sample amount, adjusting the first dialogue training data according to the second dialogue training data; or
[0253] When it is determined that the second data amount is greater than the second sample quantity, the second dialogue training data is adjusted according to the first dialogue training data.
[0254] Optionally, the initial model determination module 502 is configured to:
[0255] Determining initial dialogue training data associated with the target dialogue domain and a pre-trained dialogue processing model, wherein the pre-trained dialogue processing model is a machine learning model;
[0256] The pre-trained dialogue processing model is trained according to the initial dialogue training data to obtain an initial dialogue processing model associated with the target dialogue domain.
[0257] An embodiment of the present specification provides a conversation processing model training device, which determines first conversation training data and second conversation training data that are more closely related to a target conversation domain through an initial conversation processing model associated with the target conversation domain and application data in the target conversation domain. Thereafter, the initial conversation processing model is trained again using the first conversation training data with positive labels and the initial conversation training data. An updated conversation processing model is obtained by adding the first conversation training data with positive labels. Compared with the initial conversation processing model, the ability of the initial conversation processing model to answer accurate answers is enhanced. Furthermore, the updated conversation processing model obtained above is further trained based on the first conversation training samples, the positive labels, the second conversation training samples and the negative labels, thereby further improving the ability of the obtained target conversation processing model to judge the positive and negative of the input data, and further improving the accuracy and effect of the answers of the target conversation processing model in practical applications.
[0258] The above is a schematic scheme of a dialogue processing model training device of this embodiment. It should be noted that the technical scheme of the dialogue processing model training device and the technical scheme of the dialogue processing model training method described above belong to the same concept, and the details not described in detail in the technical scheme of the dialogue processing model training device can be found in the description of the technical scheme of the dialogue processing model training method described above.
[0259] Corresponding to the above method embodiment, this specification also provides a dialogue device embodiment, Figure 6 FIG. 1 shows a schematic diagram of the structure of a dialogue device provided by an embodiment of the present specification. Figure 6 As shown, the device comprises:
[0260] An input determination module 602, configured to determine input dialogue data associated with a target dialogue domain;
[0261] The output acquisition module 604 is configured to input the input dialogue data into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, wherein the dialogue processing model is obtained according to the above-mentioned dialogue processing model training method.
[0262] Optionally, the output acquisition module 604 is further configured to:
[0263] The dialogue processing model interface is called, and the input dialogue data is input into the dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain.
[0264] Optionally, the input determination module 602 is further configured to:
[0265] Acquire input dialogue data associated with the target dialogue domain sent by the client, wherein the input dialogue data is generated by the client in response to a user's interaction behavior on a user interaction interface of the client, and the user interaction interface is associated with the target dialogue domain;
[0266] The device further includes a data display module configured to:
[0267] The output dialogue data is sent to the client, so that the client displays the output dialogue data in the user interaction interface.
[0268] An embodiment of the present specification provides a conversation device, which processes input conversation data input by a client by utilizing a conversation processing model pre-trained by a server to obtain relatively accurate output conversation data, thereby sending the relatively accurate output conversation data to the client for display through the user interaction interface of the client. The processing accuracy of the conversation processing model improves the accuracy of the output conversation data and improves the user experience.
[0269] The above is a schematic scheme of a dialogue device of this embodiment. It should be noted that the technical scheme of the dialogue device and the technical scheme of the dialogue method described above are of the same concept, and the details not described in detail in the technical scheme of the dialogue device can be referred to the description of the technical scheme of the dialogue method described above.
[0270] Figure 7 The block diagram of a computing device 700 according to an embodiment of the present specification is shown. The components of the computing device 700 include but are not limited to a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and the database 750 is used to store data.
[0271] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0272] In one embodiment of the present specification, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0273] The computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 may also be a mobile or stationary server.
[0274] Among them, the memory 710 is used to store computer programs / instructions, and the processor 720 is used to execute the computer programs / instructions stored in the memory 710. When the computer program / instructions are executed by the processor, the steps of the above-mentioned dialogue processing model training method or dialogue method are implemented.
[0275] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned dialogue processing model training method or dialogue method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned dialogue processing model training method or dialogue method.
[0276] An embodiment of the present specification also provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned dialogue processing model training method or dialogue method when executed by a processor.
[0277] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned dialogue processing model training method or dialogue method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned dialogue processing model training method or dialogue method.
[0278] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned dialogue processing model training method or dialogue method.
[0279] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned dialogue processing model training method or dialogue method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned dialogue processing model training method or dialogue method.
[0280] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0281] The computer program / instruction includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer readable media do not include electric carrier signals and telecommunication signals.
[0282] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0283] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0284] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can understand and use this specification well. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A dialogue processing model training method, It is characterized in that include: Determining an initial dialogue processing model associated with the target dialogue domain, wherein the initial dialogue processing model is obtained by training a pre-trained dialogue processing model using initial dialogue training data associated with the target dialogue domain; Determine first dialogue training data and second dialogue training data according to application data of the initial dialogue processing model in the target dialogue field, wherein the first dialogue training data includes a first dialogue training sample and a positive label corresponding to the first dialogue training sample, and the second dialogue training data includes a second dialogue training sample and a negative label corresponding to the second dialogue training sample; Training the initial dialogue processing model according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model; The updated dialogue processing model is trained according to the first dialogue training sample, the positive label, the second dialogue training sample, and the negative label to obtain a target dialogue processing model.
2. The method for training a dialog processing model according to claim 1, It is characterized in that Before determining the first dialogue training data and the second dialogue training data according to the application data of the initial dialogue processing model in the target dialogue field, the method further includes: Deploy the initial dialogue processing model, perform dialogue processing based on the initial dialogue processing model, and obtain dialogue data; Filtering target conversation data associated with the target conversation domain from the conversation data; The target dialogue data is determined as application data of the initial dialogue processing model in the target dialogue field.
3. The method for training a dialog processing model according to claim 2, It is characterized in that The deploying the initial dialogue processing model, performing dialogue processing based on the initial dialogue processing model, and obtaining dialogue data includes: Deploying the initial dialogue processing model on a client so that the initial dialogue processing model performs dialogue processing on the client to generate dialogue data; The session data is obtained from the client.
4. The method for training a dialog processing model according to any one of claims 1 to 3, It is characterized in that Before determining the first dialogue training data and the second dialogue training data according to the application data of the initial dialogue processing model in the target dialogue field, the method further includes: Determining a target dialogue processing task, wherein the target dialogue processing task is processed according to the target dialogue processing model; The target dialogue processing task is analyzed, and according to the task analysis result, the amount of model training data for training the target dialogue processing model is determined.
5. The method for training a dialog processing model according to claim 4, It is characterized in that The determining of the first dialogue training data and the second dialogue training data according to the application data of the initial dialogue processing model in the target dialogue field comprises: Determine the total dialogue training data that meets the model training data amount according to the target dialogue processing task and the application data of the initial dialogue processing model in the target dialogue field; The first dialogue training data and the second dialogue training data are determined according to the total dialogue training data.
6. The method for training a dialog processing model according to claim 5, It is characterized in that The determining, based on the target dialogue processing task and the application data of the initial dialogue processing model in the target dialogue field, total dialogue training data that satisfies the model training data amount includes: According to the target dialogue processing task, initial dialogue training data is screened out from application data of the initial dialogue processing model in the target dialogue field; When it is determined that the data volume of the initial dialogue training data is greater than or equal to the data volume of the model training data, total dialogue training data that satisfies the data volume of the model training data is selected from the initial dialogue training data.
7. The method for training a dialog processing model according to claim 6, It is characterized in that The selecting, from the initial dialogue training data, total dialogue training data that satisfies the model training data amount comprises: Calculating the data quality of the initial dialogue training data; The initial dialogue training data is sorted according to the data quality, and total dialogue training data that meets the model training data amount is selected according to the sorting result.
8. The method for training a dialog processing model according to claim 6, It is characterized in that After selecting the initial dialogue training data from the application data of the initial dialogue processing model in the target dialogue field according to the target dialogue processing task, the method further includes: When it is determined that the data volume of the initial dialogue training data is less than the data volume of the model training data, the initial dialogue training data is amplified according to the target dialogue processing task to obtain total dialogue training data that meets the data volume of the model training.
9. The method for training a dialog processing model according to claim 5, It is characterized in that The determining the first dialogue training data and the second dialogue training data according to the total dialogue training data includes: Labeling the total dialogue training data to obtain a positive label or a negative label corresponding to the total dialogue training data; In a case where the label corresponding to the total dialogue training data is a positive label, determining the total dialogue training data as the first dialogue training sample; In a case where the label corresponding to the total dialogue training data is a negative label, determining the total dialogue training data as the second dialogue training sample; determining the first dialogue training data according to the first dialogue training sample and the positive label corresponding to the first dialogue training sample; The second dialogue training data is determined according to the second dialogue training sample and the negative label corresponding to the second dialogue training sample.
10. The method for training a dialog processing model according to claim 9, It is characterized in that Before determining the first dialogue training data and the second dialogue training data according to the total dialogue training data, the method further includes: Determining a first data amount of the first dialogue training data and a second data amount of the second dialogue training data according to the model training data amount, wherein the sum of the first data amount and the second data amount is equal to the model training data amount; After determining the total dialogue training data as the second dialogue training sample, the method further includes: Determining a first sample quantity of the first conversation training sample, and determining a second sample quantity of the second conversation training sample; The first dialogue training data and the second dialogue training data are adjusted according to a matching relationship between the first data amount and the first sample quantity, and a matching relationship between the second data amount and the second sample quantity.
11. The method for training a dialog processing model according to claim 10, It is characterized in that The adjusting the first dialogue training data and the second dialogue training data according to the matching relationship between the first data amount and the first sample amount, and the matching relationship between the second data amount and the second sample amount, includes: If it is determined that the first data amount is greater than the first sample amount, adjusting the first dialogue training data according to the second dialogue training data; or When it is determined that the second data amount is greater than the second sample quantity, the second dialogue training data is adjusted according to the first dialogue training data.
12. The method for training a dialog processing model according to claim 1, It is characterized in that The determining of an initial dialogue processing model associated with the target dialogue domain includes: Determining initial dialogue training data associated with the target dialogue domain and a pre-trained dialogue processing model, wherein the pre-trained dialogue processing model is a machine learning model; The pre-trained dialogue processing model is trained according to the initial dialogue training data to obtain an initial dialogue processing model associated with the target dialogue domain.
13. A method of dialogue, It is characterized in that include: determining input dialogue data associated with a target dialogue domain; The input dialogue data is input into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, wherein the dialogue processing model is obtained according to the dialogue processing model training method according to any one of claims 1-12.
14. The conversation method according to claim 13, It is characterized in that The step of inputting the input dialogue data into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain includes: The dialogue processing model interface is called, and the input dialogue data is input into the dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain.
15. The conversation method according to claim 13, It is characterized in that The determining of input dialogue data associated with the target dialogue domain includes: Acquire input dialogue data associated with the target dialogue domain sent by the client, wherein the input dialogue data is generated by the client in response to a user's interaction behavior on a user interaction interface of the client, and the user interaction interface is associated with the target dialogue domain; After obtaining the output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, the method further includes: The output dialogue data is sent to the client, so that the client displays the output dialogue data in the user interaction interface.
16. A dialogue processing model training device, It is characterized in that include: An initial model determination module is configured to determine an initial dialogue processing model associated with a target dialogue domain, wherein the initial dialogue processing model is obtained by training a pre-trained dialogue processing model using initial dialogue training data associated with the target dialogue domain; a training data determination module, configured to determine first dialogue training data and second dialogue training data according to application data of the initial dialogue processing model in the target dialogue field, wherein the first dialogue training data includes a first dialogue training sample and a positive label corresponding to the first dialogue training sample, and the second dialogue training data includes a second dialogue training sample and a negative label corresponding to the second dialogue training sample; an updated model acquisition module, configured to train the initial dialogue processing model according to the initial dialogue training data and the first dialogue training sample to obtain an updated dialogue processing model; The target model acquisition module is configured to train the updated dialogue processing model according to the first dialogue training sample, the positive label, the second dialogue training sample and the negative label to obtain a target dialogue processing model.
17. A conversation device, It is characterized in that include: an input determination module configured to determine input dialogue data associated with a target dialogue domain; The output acquisition module is configured to input the input dialogue data into a dialogue processing model to obtain output dialogue data corresponding to the input dialogue data and associated with the target dialogue domain, wherein the dialogue processing model is obtained according to the dialogue processing model training method according to any one of claims 1-12.
18. A computing device, It is characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the dialogue processing model training method described in any one of claims 1-12 or the dialogue method described in any one of claims 13-15 are implemented.
19. A computer-readable storage medium, It is characterized in that It stores a computer program / instruction, which, when executed by a processor, implements the steps of the dialogue processing model training method described in any one of claims 1-12 or the dialogue method described in any one of claims 13-15.
20. A computer program product, It is characterized in that It includes a computer program / instruction, which, when executed by a processor, implements the steps of the dialogue processing model training method described in any one of claims 1 to 12 or the dialogue method described in any one of claims 13 to 15.
