Dialogue scoring model training method, device, model and dialogue scoring method
By building a dialogue scoring model containing the BERT layer and the recurrent neural network layer, and using the method of loop training and parameter update, the shortcomings of the BERT model in processing timing data and long conversations are solved, and the accuracy of dialogue scoring is significantly improved.
Patent Information
- Application Number
- CN202210423066.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-04-21
AI Technical Summary
The BERT model is not good at processing timing data and long conversations in conversation ratings, resulting in low score accuracy.
A dialogue scoring model is constructed, which includes a BERT layer, a recurrent neural network layer, a first fully connected layer and a second fully connected layer. Through cyclic training and parameter updates, the data timing expression and long dialogue processing capabilities are enhanced.
It significantly improves the accuracy of conversation scores and can more effectively express data timing and contextual relevance in long conversations.
Smart Images

Figure CN114840652B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to a training method, device, model and dialogue scoring method for a dialogue scoring model. Background Art
[0002] With the increasing application of artificial intelligence in recent years, it is becoming increasingly important to give accurate scores to conversations. For example, in a telecommunications call scenario, the score of the call content can be used to determine whether the call content involves financial fraud, etc.
[0003] Therefore, it is particularly important to give accurate scores for dialogues. In the prior art, the BERT model, as a language representation model, has strong natural language processing capabilities and is widely used in dialogue scoring.
[0004] However, the BERT model also has many shortcomings when used for dialogue scoring. For example, the BERT model understands the text order by encoding the data by position and cannot capture temporal information. Therefore, the BERT model is not good at processing temporal data. In addition, the BERT model is not good at processing long dialogue data. On the one hand, if each multi-round dialogue is regarded as a piece of data, the input is likely to exceed the length limit. On the other hand, the BERT model is not good at expressing the logical correlation of the contextual temporal sequence in long dialogues, resulting in the problem of low accuracy of the given scores. Summary of the invention
[0005] In response to the above problems, the embodiments of the present application provide a training method, device, model and dialogue scoring method for a dialogue scoring model to overcome or partially overcome the shortcomings of the prior art.
[0006] In a first aspect, the present application provides a method for training a dialogue scoring model, the method comprising:
[0007] Constructing an initial dialogue scoring model, the initial dialogue scoring model comprising: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer, and the first fully connected layer are connected in sequence, and the output end of the recurrent neural network layer is also connected to the input end of the BERT layer through the second fully connected layer;
[0008] Arrange the multi-round dialogue training corpus into multiple groups of dialogue texts divided according to time sequence, and input the multiple groups of dialogue texts into the dialogue scoring initial model in sequence, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts;
[0009] In each time step, parameters of the dialogue scoring model are updated according to the first score and the label of the training corpus to obtain the dialogue scoring model.
[0010] In a second aspect, an embodiment of the present application further provides a training device for a dialogue scoring model, the device comprising:
[0011] A construction unit, configured to construct an initial dialogue scoring model, wherein the initial dialogue scoring model comprises: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer, and the first fully connected layer are connected in sequence, and an output end of the recurrent neural network layer is further connected to an input end of the BERT layer through the second fully connected layer;
[0012] A training unit, configured to organize the multi-round dialogue training corpus into a plurality of groups of dialogue texts divided in time sequence, and sequentially input the plurality of groups of dialogue texts into the dialogue scoring initial model, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts;
[0013] An updating unit is used to update the parameters of the dialogue scoring model according to the first score and the label of the training corpus in each time step to obtain the dialogue scoring model.
[0014] In a third aspect, an embodiment of the present application further provides a conversation scoring model, comprising: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer and the first fully connected layer are connected in sequence, and the output end of the recurrent neural network layer is also connected to the input end of the BERT layer through the second fully connected layer.
[0015] In a fourth aspect, an embodiment of the present application further provides a conversation scoring method, which is implemented based on the above-mentioned conversation scoring model, and the conversation scoring method includes:
[0016] Inputting the predicted corpus into the dialogue scoring model to obtain a second score for each group of dialogue texts in the predicted corpus;
[0017] A third score of the predicted corpus is determined based on the obtained second scores of each group of dialogue texts.
[0018] In a fifth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform any of the above methods.
[0019] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs, and when the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes any of the above methods.
[0020] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0021] In view of the technical defects of the existing BERT model, which is not good at representing the temporal nature of data and is not good at processing long conversations when applied to conversation scoring, the present application transforms the existing BERT model and constructs a conversation scoring model, which includes a BERT layer, a recurrent neural network layer, a first fully connected layer and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer and the first fully connected layer are connected in sequence, and the recurrent neural network layer is also connected to the BERT layer through the second fully connected layer. When training the model, a multi-round conversation training corpus is sorted into multiple groups of conversation texts divided in time sequence, and each group of conversation files obtained is input into the conversation scoring model in one time step respectively, so as to realize the cyclic training of the conversation scoring model, and determine the score of the multi-round conversation training corpus according to the score of the conversation text corresponding to each time step, and in the training of each time step, the various parameters of the conversation scoring model are continuously updated according to the gap between the predicted score and the true label, so as to obtain the final conversation scoring model. The present application realizes the cyclic processing of data through the setting of the second full connection, performs secondary processing on the output of the BERT layer of the model body, and adds the processing result to the input of the next time step, thereby realizing the transmission of information and greatly enhancing the expression of data temporal sequence. The training method of the present application allows the dialogue texts in the multi-round dialogue training corpus to be input into the BERT model for training as a single group, and realizes the transmission of information with the help of the idea of loop, so that the model can combine the information of the previous dialogue text when processing the current dialogue text, which significantly improves the model's processing ability for long dialogues, and significantly improves the expression of contextual relevance in long dialogues, and improves the accuracy of dialogue scoring. It can be used for both human-computer dialogue and human-to-human dialogue, and has a wide range of applicable scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0023] Figure 1 A flow chart of a method for training a dialogue scoring model according to an embodiment of the present application is shown;
[0024] Figure 2A schematic diagram of the structure of a dialogue scoring model according to an embodiment of the present application is shown;
[0025] Figure 3 A schematic diagram showing the data flow of training corpus in a dialogue scoring model according to an embodiment of the present application;
[0026] Figure 4 A schematic diagram showing the data flow of training corpus in a dialogue scoring model according to another embodiment of the present application;
[0027] Figure 5 A schematic diagram of the structure of a dialogue scoring model according to another embodiment of the present application is shown;
[0028] Figure 6 A schematic diagram of the structure of a training device for a dialogue scoring model according to an embodiment of the present application is shown;
[0029] Figure 7 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0031] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0032] In view of the current situation in which the BERT model is used for dialogue scoring in the prior art, the accuracy is low, the data temporal expression is poor, and it is difficult to handle long dialogues, this application proposes a training method for a dialogue scoring model. Figure 1 A flow chart of a method for training a dialogue scoring model according to an embodiment of the present application is shown, from Figure 1 It can be seen that the present application at least includes steps S110 to S140:
[0033] Step S110: construct an initial model for dialogue scoring, wherein the initial model for dialogue scoring includes: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer, and the first fully connected layer are connected in sequence, and the output end of the recurrent neural network layer is also connected to the input end of the BERT layer through the second fully connected layer.
[0034] This application is mainly applicable to scenarios of dialogue scoring, especially the scoring of multi-round dialogues, such as analyzing dialogue recordings in public security scenarios, and obtaining a tendency score of whether the dialogue is suspected of fraud by analyzing the textualized multi-round dialogue content. Another example is that it can also be applied to customer satisfaction surveys. Customer satisfaction surveys are usually human-computer dialogues, which are usually presented in the form of multi-round questions and answers. Scoring human-computer dialogues can intuitively understand customer satisfaction.
[0035] In the prior art, the BERT model or a model derived from the BERT model is usually used to process dialogue scoring, but these models have many shortcomings. For example, the BERT model is not good at processing time-series data. When each piece of data enters the BERT model, each element is operated at the same time. Therefore, the BERT model cannot capture time-series information when the data is input. Alternatively, the BERT model understands the text order by encoding the data by position. As part of the encoding structure, position encoding can provide certain order information, but does not involve more information expression and transmission. In addition, the BERT model is not good at processing long dialogue data (long dialogue refers to multi-round dialogue, which contains multiple groups of single-discussion dialogues). If each multi-round dialogue is regarded as a piece of data, it is easy to exceed the length limit when input; if each group of dialogue is regarded as a piece of data, the analysis lacks relevance. In this case, the dialogue is analyzed by group input model, which does not involve the multi-round dialogue information and the information of the previous group in the same dialogue. The model essentially becomes a single-discussion dialogue scoring model. Some models derived from the BERT model in the prior art also have the above problems.
[0036] To this end, this application proposes a dialogue scoring model. During training, an initial dialogue scoring model is first constructed. Figure 2 A schematic diagram of the structure of a dialogue scoring model according to an embodiment of the present application is shown. Figure 2 It can be seen that the dialogue scoring initial model 200 of this embodiment includes: a BERT layer 210, a recurrent neural network layer 220, a first fully connected layer 230 and a second fully connected layer 240, wherein the BERT layer 210, the recurrent neural network layer 220 and the first fully connected layer 230 are connected in sequence, and the output end of the recurrent neural network layer 220 is also connected to the input end of the BERT layer 210 through the second fully connected layer 240.
[0037] Among them, the setting of the second fully connected layer 240 can enable the output of the recurrent neural network layer 220 to undergo dimensionality reduction processing by the second fully connected layer 240 and then enter the BERT layer 210 for secondary processing again, thereby realizing the circulation and transmission of information.
[0038] Step S120: Arrange the multi-round dialogue training corpus into multiple groups of dialogue texts divided according to time sequence, and input the multiple groups of dialogue texts into the dialogue scoring initial model in sequence, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts.
[0039] During the training process, the multi-round dialogue training corpus is first organized into multiple groups of dialogue texts divided according to time sequence. The multi-round dialogue training corpus can be voice or text, which is not limited in this application. If it is voice, it is first converted into text. The following takes a multi-round dialogue training corpus as an example to briefly explain the data flow of the corpus in the model.
[0040] The multi-round dialogue training corpus can be understood as a dialogue containing multiple rounds of questions and answers, with one round of questions and answers as a set of dialogue texts. Take the following multi-round dialogue training corpus as an example:
[0041] Q1:What is your name?
[0042] A1: XYZ;
[0043] Q2: Do you have a credit card from a certain bank?
[0044] A2:Yes;
[0045] Q3: Have you been to any place?
[0046] A3:Yes.
[0047] It can be seen from the above examples that a multi-round dialogue training corpus consists of multiple rounds of question-and-answer dialogues, which can be organized into multiple groups of dialogue texts according to the actual order in which they occurred. In the above example, Q1 and A1 form the first group of dialogue texts, Q2 and A2 form the second group of dialogue texts, and Q3 and A3 form the third group of dialogue texts.
[0048] Then, the multiple groups of dialogue texts are sequentially input into the dialogue scoring initial model, and the dialogue scoring model is cyclically trained with each group of dialogue texts as a time step to obtain the first score of each group of dialogue texts. Specifically, the training process of the first group of dialogue texts is recorded as the first time step. In the first time step, the first group of dialogue texts is input into the input layer (Embedding) of the BERT layer 210. The first group of dialogue texts passes through the BERT layer 210 and the recurrent neural network layer 220 in sequence. The output content of the recurrent neural network layer 220 enters the first fully connected layer 230 and the second fully connected layer 240 at the same time. After passing through the first fully connected layer 230, the first score of the first group of dialogue texts is obtained, which is recorded as score 1; after passing through the second fully connected layer 240, a low-dimensional content that meets the input requirements of the BERT layer 210 is obtained as part of the input content of the time step corresponding to the second group of dialogue texts.
[0049] The training process using the second group of dialogue texts is recorded as the second time step. In the second time step, the second group of dialogue texts are input into the input layer (Embedding) of the BERT layer 210, and the output content of the second fully connected layer 240 in the first time step is also used as part of the input content of the second time step, and is input into the BERT layer 210 together with the second group of dialogue texts. Like the first group of dialogue texts, the second group of dialogue texts successively pass through the BERT layer 210 and the recurrent neural network layer 220, and the output content of the recurrent neural network layer 220 enters the first fully connected layer 230 and the second fully connected layer 240 respectively. After passing through the first fully connected layer 230, the first score of the second group of dialogue texts is obtained, which is recorded as score 2; after passing through the second fully connected layer 240, a low-dimensional content that meets the input requirements of the BERT layer 210 is obtained as part of the input content of the time step corresponding to the third group of dialogue texts.
[0050] The training process using the third group of dialogue texts is recorded as the third time step. In the third time step, the third group of dialogue texts are input into the input layer (Embedding) of the BERT layer 210, and the output content of the second fully connected layer 240 in the second time step is also used as part of the input content of the third time step, and is input into the BERT layer 210 together with the third group of dialogue texts. Like the second group of dialogue texts, the third group of dialogue texts successively passes through the BERT layer 210 and the recurrent neural network layer 220, and the output content of the recurrent neural network layer 220 enters the first fully connected layer 230 and the second fully connected layer 240 respectively at the same time, and passes through the first fully connected layer 230 to obtain the first score of the third group of dialogue texts, which is recorded as score 3. For greater clarity, the input and output of the dialogue scoring model in each time step are listed in Table 1.
[0051] Table 1
[0052]
[0053]
[0054] Since the output content of the previous time step is taken into account during the training process of the later time step, the contextual features and temporal features of the long conversation are fully represented.
[0055] Step S140: In each time step, the parameters of the dialogue scoring model are updated according to the first score and the label of the training corpus to obtain the dialogue scoring model.
[0056] The first score can be understood as the score obtained by predicting the data through the dialogue scoring model. Each group of dialogue texts has a first score. The labels of the training corpus are manually annotated. When annotating, each group of dialogue texts is also annotated. This annotation can be understood as the real score. According to the difference between the two, the parameters of the dialogue scoring model can be updated. Specifically, the loss function between the first score of each group of dialogue texts and the labels of each group of dialogue texts in the training corpus is calculated. According to the value of the loss function, the various parameters of the dialogue scoring model are modified and updated so that the first score is closer to the label of the training corpus. This process is carried out continuously throughout the training process, that is, it exists in the training of each time step. After parameter adjustment, the final dialogue scoring model can be obtained. This dialogue scoring model can be used in the dialogue scoring scenario.
[0057] Depend on Figure 1 It can be seen from the method shown that: the present application transforms the existing BERT model to construct a dialogue scoring model in view of the technical defects of the existing BERT model, which is not good at representing the temporal nature of data and is not good at processing long dialogues when applied to dialogue scoring. The model includes a BERT layer, a recurrent neural network layer, a first fully connected layer and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer and the first fully connected layer are connected in sequence, and the recurrent neural network layer is also connected to the BERT layer through the second fully connected layer. When training the model, a multi-round dialogue training corpus is sorted into multiple groups of dialogue texts divided in time sequence, and each group of dialogue files obtained is input into the dialogue scoring model in one time step respectively, so as to realize the cyclic training of the dialogue scoring model, and determine the score of the multi-round dialogue training corpus according to the score of the dialogue text corresponding to each time step obtained, and in this process, continuously update the various parameters of the dialogue scoring model according to the gap between the predicted score and the true label, so as to obtain the final dialogue scoring model. The present application realizes the cyclic processing of data through the setting of the second full connection, performs secondary processing on the output of the BERT layer of the model body, and adds the processing result to the input of the next time step, thereby realizing the transmission of information and greatly enhancing the expression of data temporal sequence. The training method of the present application allows the dialogue texts in the multi-round dialogue training corpus to be input into the BERT model for training as a single group, and realizes the transmission of information with the help of the idea of loop, so that the model can combine the information of the previous dialogue text when processing the current dialogue text, which significantly improves the model's processing ability for long dialogues, and significantly improves the expression of contextual relevance in long dialogues, and improves the accuracy of dialogue scoring. It can be used for both human-computer dialogue and human-to-human dialogue, and has a wide range of applicable scenarios.
[0058] In some embodiments of the present application, in the training method of the above-mentioned dialogue scoring model, the training corpus is organized into multiple groups of dialogue texts divided according to time sequence, including: converting the training corpus into a text corpus; taking adjacent question and answer sentences in the obtained text corpus as a group of dialogue texts; and arranging the obtained multiple groups of dialogue texts in time sequence.
[0059] Still taking the aforementioned long dialogue training text as an example:
[0060] Q1:What is your name?
[0061] A1: XYZ;
[0062] Q2: Do you have a credit card from a certain bank?
[0063] A2:Yes;
[0064] Q3: Have you been to any place?
[0065] A3:Yes.
[0066] Among them, Q1, Q2 and Q3 are the voices of one person, and A1, A2 and A3 are the voices of another person. When dividing, the voice training corpus is first converted into a text corpus. For the conversion method, reference can be made to one of the prior art. In the process of training, a large amount of training corpus is required. These training corpora can be collected and obtained in a variety of ways, such as the corpus generated in the human-computer dialogue, the multi-round dialogue training corpus separated from the general training corpus, and so on. In the process of converting these original corpora into text, there may be some errors or defects, which affect the training effect. In some embodiments of the present application, these corpora can be processed. Specifically, the preprocessing process includes but is not limited to data cleaning, word segmentation processing, text error correction processing, etc.
[0067] After converting the speech training corpus into text corpus, it is divided into multiple groups of dialogue texts. In each group of dialogue texts, it is best to only include related questions and answers, usually with the question in front and the answer in the back. Therefore, the adjacent question and answer sentences in the obtained text corpus can be used as a group of dialogue texts, and the obtained multiple groups of dialogue texts can be arranged in chronological order to obtain multiple groups of dialogue texts.
[0068] In some embodiments of the present application, in the training method of the above-mentioned conversation scoring model, the multiple groups of conversation texts are sequentially input into the conversation scoring initial model, and each group of conversation texts is used as a time step to perform cyclic training on the conversation scoring model to obtain a first score for each group of conversation texts, including: for a time step corresponding to a group of conversation texts, the group of conversation texts is used as the first input of the BERT layer, and the encoding vector or the output of the second full connection in the previous time step is used as the second input of the BERT layer, and input into the BERT layer; the first input and the second input are sequentially subjected to the BERT layer, the recurrent neural network layer and the first fully connected layer to obtain a first score for the group of conversation texts.
[0069] The input content of the BERT layer includes the first input and the second input. Figure 3 A schematic diagram showing the data flow of the training corpus in the dialogue scoring model according to an embodiment of the present application is shown, from Figure 3 It can be seen that, taking the first time step as an example, the first group of dialogue texts is used as the first input of the BERT layer and input into the BERT layer. The first time step is the first time step, so there is no output content of the previous time step. At this time, the second input content can be encoded, and the encoded vector is used as the second input. The first input and the second input are simultaneously input into the BERT layer, and the output of the BERT layer is recorded as Output_0, and Output_0 enters the recurrent network neural network (in this embodiment, the recurrent neural network layer is LSTM). The output of the recurrent network neural network LSTM is recorded as Output_1, and Output_1 enters the first fully connected layer and the second fully connected layer respectively. The function of the first fully connected layer is to score Output_1 and obtain the first score of the first group of dialogue texts. Therefore, the first fully connected layer can be understood as a result module.
[0070] The second fully connected layer is used for dimensionality reduction. Output_1 entering the second fully connected layer is usually high-dimensional data, such as 1024 dimensions, while the input of the BERT layer is usually lower dimensional, such as 256 dimensions. After being processed by the second fully connected layer, Output_1 can be converted into a vector of lower dimensions, which meets the input requirements of the BERT layer. The output of the second fully connected layer is recorded as Output_2, and Output_2 enters the BERT layer as the second input of the second time step.
[0071] Taking the second time step as an example, when the training of the first time step is completed, the training of the second time step begins. In the second time step, the input of the BERT layer also includes the first input and the second input, where the first input is the second set of dialogue texts, and the second input is the output of the second fully connected layer in the first time step, that is, Output_2. The subsequent training is the same as the first time step, and will not be repeated one by one.
[0072] It should be noted that Figure 3 The data flow diagram shown in the figure shows the structure diagram of multiple dialogue scoring models for clarity. In fact, the data just flows back to the BERT layer instead of the series connection of the models.
[0073] It should also be noted that this application omits the description of the use of activation function layers, dropout layers, etc., because their placement is too flexible and their functions are the same as those of the prior art, and they should be specifically set optimally during the training process.
[0074] In some embodiments thereof, in the training method of the above-mentioned dialogue scoring model, the first input includes: a first sentence, a second sentence, and a segmentation marker [SEP]; the second input includes: a state marker [CLS], wherein the segmentation marker [SEP] refers to the segmentation marker between sentences, and also includes the end-of-sentence marker.
[0075] The method of using the group of dialogue texts as the first input of the BERT layer includes: using the question sentence in the dialogue text as the first sentence, using the answer sentence in the dialogue text as the second sentence, and isolating the first sentence from the second sentence using the segmentation identifier.
[0076] The method of using the encoding vector or the output of the second full connection in the previous time step as the second input of the BERT layer includes: if the current time step is the first time step of a training corpus, encoding the state identifier to obtain an encoding vector, and using the encoding vector as the second input; if the current time step is not the first time step of a training corpus, using the output vector of the second full connection in the previous time step as the second input of the BERT layer.
[0077] Please refer to Figure 4 , Figure 4 A schematic diagram showing the data flow of training corpus in a dialogue scoring model according to another embodiment of the present application is shown, from Figure 4 It can be seen that the Embedding of the BERT layer includes the state identifier [CLS], the segmentation identifier [SEP], the first sentence (question 1 in the first time step) and the second sentence (answer 1 in the first time step).
[0078] For the first input content, the question sentence in the group of dialogue texts is taken as the first sentence, the answer sentence in the group of dialogue texts is taken as the second sentence, and the first sentence and the second sentence are separated by a segmentation mark [SEP].
[0079] For the second input content, the state identifier [CLS] is encoded (vectorized) at the first time step of training each multi-round dialogue training corpus to obtain an encoding vector. The formation of the encoding vector can refer to the existing technology, or it can be a vector of each element 1, and the encoding vector is used as the second input; in the remaining time steps, the state identifier [CLS] is represented by the vector output by the second fully connected layer in the previous time step.
[0080] It should be noted that when the training of a multi-round dialogue training corpus is completed, when entering the training of the next multi-round dialogue training corpus, the state identifier [CLS] will be re-encoded, and the state identifier [CLS] of the training output of the previous multi-round dialogue training corpus will not be brought into the current round of training.
[0081] In some embodiments of the present application, in the training method of the above-mentioned conversation scoring model, the conversation scoring initial model also includes: a third fully connected layer, the output end of the third fully connected layer is connected to the input end of the first fully connected layer; the multiple groups of conversation texts are sequentially input into the conversation scoring initial model, each group of conversation texts is a time step, and the conversation scoring model is cyclically trained to obtain a first score for each group of conversation texts, and further includes: for a time step corresponding to a group of conversation texts, the additional features of the training corpus are input into the third fully connected layer, and the output of the third fully connected layer is used as a third input; the output of the recurrent neural network layer is fused with the third input to obtain a fusion vector, and the fusion vector is passed through the first fully connected layer to obtain a first score for the group of conversation texts.
[0082] In the existing technology, the BERT model is not good at combining additional data for analysis. That is, the BERT model is suitable for taking data such as text and images that have strong internal or mutual correlation as input, and analyzing the internal relationship between each element. When the additional data involved in the task contains independent feature data such as age and gender, it cannot be well integrated into the BERT model.
[0083] In this regard, the present application provides Figure 1 Based on the dialogue scoring model shown, a third fully connected layer is added. Figure 5 A schematic diagram showing the structure of a dialogue scoring model according to another embodiment of the present application is shown. Figure 1 and Figure 5 , Figure 5 The dialogue scoring model shown in Figure 1 On the basis of the first fully connected layer 230, a third fully connected layer 250 is added, and the output end of the third fully connected layer 250 is connected to the input end of the first fully connected layer 230. Independent feature data such as age and gender can be input into the third fully connected layer 250 to improve the accuracy of the dialogue scoring model.
[0084] When the dialogue scoring model includes the third fully connected layer, the data flow process of the multi-round dialogue training corpus in the dialogue scoring model is as follows. Taking the first time step of the aforementioned embodiment as an example, the first group of dialogue texts is used as the first input of the BERT layer and input into the BERT layer. The first time step is the first time step, so there is no output content of the previous time step. At this time, the second input content can be encoded, and the encoded vector is used as the second input. The first input and the second input are simultaneously input into the BERT layer, and the output of the BERT layer is recorded as Output_0, and Output_0 enters the recurrent network neural network, and the output of the recurrent network neural network LSTM is recorded as Output_1. At the same time, the additional features of the training corpus are input into the third fully connected layer 250, and the output of the third fully connected layer 250 (recorded as Output_3) is used as the third input, and then Output_1 and Output_3 are vector fused to obtain a fused vector, and the fused vector enters the subsequent first fully connected layer 230 to obtain the first score of the first group of dialogue texts. At the same time, Output_1 also enters the second fully connected layer 240, and after being processed by the second fully connected layer 240, enters the training of the next time step.
[0085] In some embodiments of the present application, Output_1 and Output_3 are usually one-dimensional vectors, and the fusion of the vectors includes: placing each element of Output_3 at a corresponding position after Output_1 according to the original order to obtain a fused vector.
[0086] Assume that Output_1 and Output_3 are multidimensional vectors, Output_1 is represented as [a1, b1], and Output_3 is represented as [A1, B1]. When joining, the elements in Output_3 are "placed" after the last element of Output_1 according to their original order. The fused vector is recorded as vector z, which can be represented as: [a1, b1, A1, B1]. In some embodiments of the present application, for each group of dialogue texts, the first dimension of Output_1 and Output_3 is 1, that is, the dimension changes during the joining process are: Output_1: (1x m) and Output_3: (1x n) to obtain vector z: (1x(m+n)).
[0087] In some embodiments of the present application, in the training method of the above-mentioned dialogue scoring model, the parameter updating of the dialogue scoring model according to the first score and the label of the training corpus includes: determining the value of the loss function of the initial dialogue scoring model according to the first score and the label of the training corpus; and back-propagating each parameter of the initial dialogue scoring model according to the value of the loss function to achieve parameter updating of the dialogue scoring model.
[0088] In each time step, the error (the value of the loss function) is calculated based on the first score predicted by the dialogue scoring model and the label of the training corpus that has been manually annotated in advance (the label is the manually assigned score), and back propagation is performed to achieve parameter update of the dialogue scoring model.
[0089] In some embodiments of the present application, the recurrent neural network layer is a long short-term memory artificial neural network LSTM or a gated recurrent unit network GRU. And the parameters and hyperparameters involved in the dialogue scoring model can be adjusted as needed, for example Figure 1 The dialogue scoring model shown uses three fully connected layers, and more can be stacked as needed, such as adding more fully connected layers.
[0090] An embodiment of the present application also provides a conversation scoring method, which is implemented based on a conversation scoring model obtained through training using the aforementioned conversation scoring model training method, and the conversation scoring method includes: inputting a predicted corpus into the conversation scoring model to obtain a second score for each group of conversation texts in the predicted corpus; and determining a third score for the predicted corpus based on the obtained second scores for each group of conversation texts.
[0091] In other words, the logic of the prediction method is basically the same as that of the training method, but it also includes the process of determining the overall score of the training corpus based on the scores of each group of dialogue texts obtained.
[0092] As can be seen from Table 1, each group of dialogue texts has a first score (recorded as the first score in the training process and recorded as the second score in the prediction process). In this embodiment, after obtaining the second score of each group of dialogue texts, the score of the entire long sentence training corpus is determined according to the second score of each group of dialogue texts, and the score is recorded as the third score. The third score is the prediction result.
[0093] In some embodiments of the present application, in the training method of the above-mentioned dialogue scoring model, determining the third score of the training corpus based on the second scores of the groups of dialogue texts includes: using the second score obtained in the last time step in the prediction process using a training corpus as the third score; or, taking a weighted average of multiple second scores obtained in each time step in the prediction process using a training corpus, and using the obtained score as the third score.
[0094] During the prediction process, the dialogue scoring model outputs a score at each time step, that is, outputs the second score for each group of dialogue texts. The final score of the multi-round dialogue training corpus, that is, the third score, is obtained in multiple ways. The method is flexibly determined according to the specific data and scenario. The score at the last time step can be taken as the final score, or the weighted average score can be taken as the final score based on certain conditions. Other scoring strategies can also be used, and this application does not limit this.
[0095] Figure 6 A schematic diagram of the structure of a training device for a dialogue scoring model according to an embodiment of the present application is shown. Figure 6 It can be seen that the device 600 comprises:
[0096] A construction unit 610 is used to construct an initial dialogue scoring model, wherein the initial dialogue scoring model includes: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer, and the first fully connected layer are connected in sequence, and the recurrent neural network layer is further connected to the BERT layer through the second fully connected layer;
[0097] A training unit 620 is used to organize the training corpus into multiple groups of dialogue texts arranged in time sequence, and input the multiple groups of dialogue texts into the dialogue scoring initial model in sequence, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts;
[0098] The updating unit 630 is used to update the parameters of the dialogue scoring model according to the first score and the label of the training corpus in each time step to obtain the dialogue scoring model.
[0099] In some embodiments of the present application, in the training method of the above-mentioned dialogue scoring model, the training unit 620 is used to convert the training corpus into a text corpus; take the adjacent question and answer sentences in the obtained text corpus as a group of dialogue texts; and arrange the obtained multiple groups of dialogue texts in chronological order.
[0100] In some embodiments of the present application, in the training method of the above-mentioned conversation scoring model, the training unit 620 is used to use, for a time step corresponding to a group of conversation texts, the group of conversation texts as the first input of the BERT layer, and the encoding vector or the output of the second fully connected in the previous time step as the second input of the BERT layer, and input the first input and the second input into the BERT layer; and make the first input and the second input successively go through the BERT layer, the recurrent neural network layer and the first fully connected layer to obtain a first score for the group of conversation texts.
[0101] In some embodiments of the present application, in the training method of the above-mentioned dialogue scoring model, the first input includes: a first sentence, a second sentence, and a segmentation identifier; a training unit 620 is used to take the question sentence in the dialogue text as the first sentence, and the answer sentence in the dialogue text as the second sentence, and isolate the first sentence from the second sentence using the segmentation identifier; the second input includes: a state identifier; a training unit 620 is used to encode the state identifier to obtain an encoding vector if the current time step is the first time step of a training corpus, and use the encoding vector as the second input; if the current time step is not the first time step of a training corpus, the second fully connected output vector in the previous time step is used as the second input of the BERT layer.
[0102] In some embodiments of the present application, in the training method of the above-mentioned dialogue scoring model, the dialogue scoring initial model also includes: a third fully connected layer, the output end of the third fully connected layer is connected to the input end of the first fully connected layer; a training unit 620, which is used to input the additional features of the training corpus into the third fully connected layer in the time step corresponding to a group of dialogue texts, and use the output of the third fully connected layer as the third input; fuse the output of the recurrent neural network layer with the third input to obtain a fused vector, and pass the fused vector through the first fully connected layer to obtain a first score for the group of dialogue texts.
[0103] In some embodiments of the present application, in the above-mentioned conversation scoring model training method, the updating unit 630 is used to determine the value of the loss function of the initial conversation scoring model according to the first score and the label of the training corpus; and back-propagate each parameter of the initial conversation scoring model according to the value of the loss function to achieve parameter update of the conversation scoring model.
[0104] Recurrent neural network layer Recurrent neural network layer Recurrent neural network layer Recurrent neural network layer It can be understood that the training device of the above-mentioned dialogue scoring model can implement the various steps of the training method of the dialogue scoring model provided in the aforementioned embodiments, and the relevant explanations about the training method of the dialogue scoring model are applicable to the training device of the dialogue scoring model, which will not be repeated here.
[0105] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 7 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0106] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0107] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0108] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a training device for the dialogue scoring model at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0109] Constructing an initial dialogue scoring model, the initial dialogue scoring model comprising: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer, and the first fully connected layer are connected in sequence, and the output end of the recurrent neural network layer is also connected to the input end of the BERT layer through the second fully connected layer;
[0110] Arrange the multi-round dialogue training corpus into multiple groups of dialogue texts divided according to time sequence, and input the multiple groups of dialogue texts into the dialogue scoring initial model in sequence, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts;
[0111] According to the first score and the label of the training corpus, the parameters of the dialogue scoring model are updated to obtain the dialogue scoring model.
[0112] The above application Figure 6 The method performed by the training device of the dialogue scoring model disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0113] The electronic device may also perform Figure 6The method for executing the training device of the dialogue scoring model in Figure 6 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0114] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 6 The method executed by the training device of the dialogue scoring model in the illustrated embodiment is specifically used to execute:
[0115] Constructing an initial dialogue scoring model, the initial dialogue scoring model comprising: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer, and the first fully connected layer are connected in sequence, and the output end of the recurrent neural network layer is also connected to the input end of the BERT layer through the second fully connected layer;
[0116] Arrange the multi-round dialogue training corpus into multiple groups of dialogue texts divided according to time sequence, and input the multiple groups of dialogue texts into the dialogue scoring initial model in sequence, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts;
[0117] In each time step, parameters of the dialogue scoring model are updated according to the first score and the label of the training corpus to obtain the dialogue scoring model.
[0118] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0119] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0120] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0121] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0122] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0123] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0124] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0125] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0126] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0127] The above is only the embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for training a dialogue scoring model, characterized in that: The method comprises: Constructing a dialogue scoring model, the dialogue scoring model comprising: a BERT layer, a recurrent neural network, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network, and the first fully connected layer are connected in sequence, and the output end of the recurrent neural network layer is also connected to the input end of the BERT layer through the second fully connected layer; Arrange the multi-round dialogue training corpus into multiple groups of dialogue texts arranged in time sequence, and input the multiple groups of dialogue texts into the dialogue scoring model in sequence, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts; In each time step, parameters of the dialogue scoring model are updated according to the first score and the label of the training corpus to obtain the dialogue scoring model.
2. The method for training a dialogue scoring model according to claim 1, characterized in that: The step of arranging the multi-round dialogue training corpus into multiple groups of dialogue texts arranged in time sequence includes: Converting the training corpus into text corpus; The adjacent question-answer sentences in the obtained text corpus are regarded as a group of dialogue texts; And arrange the obtained multiple groups of dialogue texts in chronological order.
3. The method for training a dialogue scoring model according to claim 1, characterized in that: The step of sequentially inputting the multiple groups of dialogue texts into the dialogue scoring model, taking each group of dialogue texts as a time step, and performing cyclic training on the dialogue scoring model to obtain a first score for each group of dialogue texts includes: For a time step corresponding to a group of dialogue texts, the group of dialogue texts is used as the first input of the BERT layer, and the encoding vector or the output of the second full connection in the previous time step is used as the second input of the BERT layer, and input into the BERT layer; The first input and the second input are sequentially subjected to the BERT layer, the recurrent neural network layer, and the first fully connected layer to obtain a first score for the group of dialogue texts.
4. The method for training a dialogue scoring model according to claim 3, characterized in that: The first input includes: a first sentence, a second sentence, and a segmentation mark; The taking the group of conversation texts as the first input of the BERT layer comprises: Taking the question sentence in the dialogue text as the first sentence, taking the answer sentence in the dialogue text as the second sentence, and isolating the first sentence from the second sentence using the segmentation mark; The second input includes: a state identifier; The step of using the encoding vector or the second fully connected output in the previous time step as the second input of the BERT layer includes: If the current time step is the first time step of a training corpus, the state identifier is encoded to obtain an encoding vector, and the encoding vector is used as the second input; If the current time step is not the first time step of a training corpus, the output vector of the second full connection in the previous time step is used as the second input of the BERT layer.
5. The method for training a dialogue scoring model according to claim 3, characterized in that: The dialogue scoring model further includes: a third fully connected layer, wherein an output end of the third fully connected layer is connected to an input end of the first fully connected layer; The step of sequentially inputting the multiple groups of dialogue texts into the dialogue scoring model, taking each group of dialogue texts as a time step, and performing cyclic training on the dialogue scoring model to obtain a first score for each group of dialogue texts further includes: For a time step corresponding to a group of dialogue texts, the additional features of the training corpus are input into the third fully connected layer, and the output of the third fully connected layer is used as the third input; The output of the recurrent neural network layer is fused with the third input to obtain a fused vector, and the fused vector is passed through the first fully connected layer to obtain a first score for the group of dialogue texts.
6. The method for training a dialogue scoring model according to claim 1, characterized in that: The updating of parameters of the dialogue scoring model according to the first score and the label of the training corpus includes: Determining a value of a loss function of the dialogue scoring model according to the first score and a label of the training corpus; Back-propagation is performed on each parameter of the dialogue scoring model according to the value of the loss function to achieve parameter update of the dialogue scoring model.
7. A training device for a dialogue scoring model, characterized in that: The device comprises: A construction unit, configured to construct a dialogue scoring model, wherein the dialogue scoring model comprises: a BERT layer, a recurrent neural network layer, a first fully connected layer, and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer, and the first fully connected layer are sequentially connected, and the recurrent neural network layer is further connected to the BERT layer through the second fully connected layer; A training unit, used to organize the multi-round dialogue training corpus into multiple groups of dialogue texts arranged in time sequence, and input the multiple groups of dialogue texts into the dialogue scoring model in sequence, and perform cyclic training on the dialogue scoring model with each group of dialogue texts as a time step to obtain a first score for each group of dialogue texts; An updating unit is used to update the parameters of the dialogue scoring model according to the first score and the label of the training corpus in each time step to obtain the dialogue scoring model.
8. A dialogue scoring model obtained by the training method of claim 1, characterized in that: The dialogue scoring model includes: a BERT layer, a recurrent neural network layer, a first fully connected layer and a second fully connected layer, wherein the BERT layer, the recurrent neural network layer and the first fully connected layer are connected in sequence, and the output end of the recurrent neural network layer is also connected to the input end of the BERT layer through the second fully connected layer.
9. The dialogue scoring model according to claim 8, characterized in that: The dialogue scoring model also includes: a third fully connected layer; the output end of the third fully connected layer is connected to the input end of the first fully connected layer.
10. The dialogue scoring model according to claim 8 or 9, characterized in that: The recurrent neural network layer is a long short-term memory artificial neural network LSTM or a gated recurrent unit network GRU.
11. A conversation scoring method, characterized in that: The dialogue scoring method is implemented based on the dialogue scoring model according to claim 9 or 10, and the dialogue scoring method includes: Inputting the predicted corpus into the dialogue scoring model to obtain a second score for each group of dialogue texts in the predicted corpus; A third score of the predicted corpus is determined based on the obtained second scores of each group of dialogue texts.
12. The conversation scoring method according to claim 11, characterized in that: Determining the third score of the predicted corpus according to the second score of each group of dialogue texts includes: The second score obtained in the last time step during the prediction process of a prediction corpus is used as the third score; or, In the prediction process of using a prediction corpus, a plurality of second scores obtained in each time step are weighted averaged, and the obtained score is used as the third score.
Citation Information
Patent Citations
Customer service session scoring level prediction method, system and device and storage medium
CN110309967A
Intelligent man-machine conversation model training method, model training device and electronic equipment
CN111460115A