Data augmentation method and device, electronic equipment and storage medium

CN117787417BActive Publication Date: 2026-09-18HEFEI IFLY DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311869487.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2026-09-18
Estimated Expiration
2043-12-28

AI Technical Summary

Technical Problem

[0004]本发明提供一种数据增强方法、装置、电子设备和存储介质,用以解决现有技术中多轮对话效果低的缺陷

Benefits of technology

[0043] The data augmentation method, apparatus, electronic device, and storage medium provided by this invention determine the target question-answer pair to be augmented in the original multi-turn dialogue data, generate multiple similar questions corresponding to the original questions in the target question-answer pair, and generate similar answers corresponding to the multiple similar questions. Based on this, the original multi-turn dialogue data is augmented in multiple stages to increase the diversity of samples, thereby improving the training effect of the model, improving the generalization ability of the model, and ultimately improving the multi-turn dialogue effect. At least one answer corresponding to the previous round question-answer pair of the target question-answer pair is obtained. Based on the fluency measurement results of at least one answer with multiple similar questions, the augmented answer corresponding to the previous round question-answer pair is determined from the at least one answer, and the augmented question corresponding to the target question-answer pair is determined from the multiple similar questions. The best augmented answer and augmented question are determined by evaluating the fluency of the transition between rounds, thereby improving the data quality of the augmented similar multi-turn dialogue data, thereby improving the training effect of the model, and ultimately improving the multi-turn dialogue effect, i.e., reducing the noise problem in the data after similarity augmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117787417B_ABST
    Figure CN117787417B_ABST
Patent Text Reader

Abstract

This invention provides a data augmentation method, apparatus, electronic device, and storage medium, relating to the field of natural language processing technology. The method includes: generating multiple similar questions corresponding to the original question in a target question-answer pair, and similar answers corresponding to the multiple similar questions; determining an augmented answer corresponding to the previous question-answer pair from the at least one answer and from the multiple similar questions, based on fluency measurement results between at least one answer of the previous question-answer pair and the multiple similar questions; determining an augmented question corresponding to the target question-answer pair from the multiple similar questions; using the similar answers corresponding to the multiple similar questions as multiple similar answers corresponding to the target question-answer pair to determine the augmented answer corresponding to the target question-answer pair; and determining similar question-answer pairs corresponding to the target question-answer pair based on the augmented question and the augmented answer corresponding to the target question-answer pair. This invention can ensure data fluency, thereby improving data quality and ultimately enhancing the effectiveness of multi-turn dialogues.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a data augmentation method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the rapid development of natural language processing, multi-turn dialogue is finding increasingly widespread applications. Multi-turn dialogue refers to a series of consecutive conversations between a human and a model to complete a specific task or obtain necessary information. In multi-turn dialogue, the model needs to progressively advance the conversation based on the user's input, providing useful feedback and responses at each step. Furthermore, the average number of dialogue turns is often used as an evaluation metric for the effectiveness of multi-turn dialogue; therefore, it is necessary to enable models to engage in fluent, multi-turn conversations with humans.

[0003] Currently, data augmentation is performed on raw multi-turn dialogue data to introduce more multi-turn dialogue data for model training, thereby better stimulating the model's multi-turn dialogue capabilities. Specifically, the original question in the raw multi-turn dialogue data is used as a seed, and a Large Language Model (LLM) is used to generate a similar question. Then, a similar answer is generated based on this similar question, and finally, new multi-turn dialogue data is constructed based on this similar question and similar answer. However, since the similar question is generated from the original question, and the similar answer is generated from the same similar question, the sources of similar questions and answers are different. This can lead to inconsistencies between the similar answer and the next round's question, resulting in disjointedness. Furthermore, the similar answer in the current round may not even be related to the topic of the next round's question, thus reducing the model's training effectiveness and consequently, the overall multi-turn dialogue performance. Summary of the Invention

[0004] This invention provides a data augmentation method, apparatus, electronic device, and storage medium to address the shortcomings of low effectiveness in multi-turn dialogue in the prior art.

[0005] This invention provides a data augmentation method, comprising:

[0006] Identify the target question-answer pairs to be enhanced in the original multi-turn dialogue data, wherein the original multi-turn dialogue data includes multi-turn question-answer pairs;

[0007] Generate multiple similar questions corresponding to the original question in the target question-answer pair, and generate similar answers corresponding to each of the multiple similar questions;

[0008] Obtain at least one answer corresponding to the previous round question-answer pair of the target question-answer pair, wherein the at least one answer includes the original answer corresponding to the previous round question-answer pair in the original multi-round dialogue data and / or multiple similar answers corresponding to the previous round question-answer pair;

[0009] Based on the fluency measurement results of the at least one answer and the plurality of similar questions, the enhanced answer corresponding to the previous round of question-answering pair is determined from the at least one answer, and the enhanced question corresponding to the target question-answering pair is determined from the plurality of similar questions, wherein any of the fluency measurement results is the fluency measurement value of any answer in the at least one answer and any similar question in the plurality of similar questions;

[0010] The similar answers corresponding to the multiple similar questions are used as multiple similar answers corresponding to the target question-answer pair, so as to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the multiple similar answers corresponding to the target question-answer pair;

[0011] Based on the enhanced question and the enhanced answer corresponding to the target question-answer pair, similar question-answer pairs corresponding to the target question-answer pair are determined, and enhanced similar multi-turn dialogue data are generated based on the similar question-answer pairs corresponding to the target question-answer pair.

[0012] According to a data augmentation method provided by the present invention, obtaining at least one answer corresponding to the previous round of question-answer pairs of the target question-answer pair includes:

[0013] If the previous question-and-answer pair has been enhanced, obtain the original answer corresponding to the previous question-and-answer pair and multiple similar answers corresponding to the previous question-and-answer pair from the original multi-turn dialogue data;

[0014] If the previous question-and-answer pair is not enhanced, obtain the original answer corresponding to the previous question-and-answer pair in the original multi-turn dialogue data;

[0015] In the case that the previous question-and-answer pair has been enhanced, the method further includes obtaining the original answer corresponding to the previous question-and-answer pair and multiple similar answers corresponding to the previous question-and-answer pair from the original multi-turn dialogue data, and then including:

[0016] Based on the enhanced question and the enhanced answer corresponding to the previous question-answer pair, similar question-answer pairs corresponding to the previous question-answer pair are determined, so as to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair and the similar question-answer pairs corresponding to the previous question-answer pair.

[0017] According to a data augmentation method provided by the present invention, any of the fluency measurement results is determined based on the following steps:

[0018] The text of any one of the at least one answers is concatenated with the text of any one of the multiple similar questions to obtain the target text;

[0019] The fluency metric result is determined based on the perplexity of the target text.

[0020] A data augmentation method provided by the present invention further includes:

[0021] The original multi-turn dialogue data is extracted to obtain multiple target multi-turn dialogue data, and each of the target multi-turn dialogue data includes at least two consecutive question-answer pairs;

[0022] Based on the multiple target multi-turn dialogue data, the enhanced multi-turn dialogue data is determined.

[0023] According to a data augmentation method provided by the present invention, determining augmented multi-turn dialogue data based on the plurality of target multi-turn dialogue data includes:

[0024] Determine the target dialogue rounds for each of the multiple target multi-turn dialogue data;

[0025] Based on the mean of the number of dialogue turns for each target, a Poisson distribution with respect to the number of dialogue turns is constructed;

[0026] Based on the Poisson distribution, the multi-turn dialogue data of the multiple targets are sampled to obtain enhanced multi-turn dialogue data.

[0027] According to a data augmentation method provided by the present invention, the step of sampling the multiple target multi-turn dialogue data based on the Poisson distribution to obtain augmented multi-turn dialogue data includes:

[0028] Based on the Poisson distribution, the probabilities corresponding to the multiple dialogue turns are determined respectively;

[0029] Based on the probabilities and the preset number of samples, the multi-turn dialogue data of the multiple targets are sampled to obtain the enhanced multi-turn dialogue data with the preset number of samples.

[0030] A data augmentation method provided by the present invention further includes:

[0031] Based on a preset total number of samples, multiple sample sets corresponding to sample quantity ratios are obtained, where any of the sample quantity ratios is the ratio of the number of samples of the original multi-turn dialogue data to the number of samples of the similar multi-turn dialogue data in the sample set.

[0032] Based on the comprehensive loss value corresponding to each of the sample sets, the target sample set with the smallest comprehensive loss value is determined from each of the sample sets;

[0033] The proportion of the number of samples corresponding to the target sample set is determined as the target sample proportion, and the model is trained based on the training sample set corresponding to the target sample proportion.

[0034] The present invention also provides a data augmentation device, comprising:

[0035] The first determining module is used to determine the target question-answer pairs to be enhanced in the original multi-turn dialogue data, wherein the original multi-turn dialogue data includes multi-turn question-answer pairs.

[0036] The question generation module is used to generate multiple similar questions corresponding to the original question in the target question-answer pair, and to generate similar answers corresponding to the multiple similar questions respectively;

[0037] The answer acquisition module is used to acquire at least one answer corresponding to the previous round question-and-answer pair of the target question-and-answer pair, wherein the at least one answer includes the original answer corresponding to the previous round question-and-answer pair in the original multi-round dialogue data and / or multiple similar answers corresponding to the previous round question-and-answer pair;

[0038] The second determining module is used to determine, based on the fluency measurement results of the at least one answer and the plurality of similar questions, the enhanced answer corresponding to the previous round of question-answer pair from the at least one answer, and the enhanced question corresponding to the target question-answer pair from the plurality of similar questions, wherein any of the fluency measurement results is the fluency measurement value of any answer in the at least one answer and any similar question in the plurality of similar questions;

[0039] The third determining module is used to take the similar answers corresponding to the multiple similar questions as multiple similar answers corresponding to the target question-answer pair, so as to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the multiple similar answers corresponding to the target question-answer pair;

[0040] The fourth determining module is used to determine similar question-answer pairs corresponding to the target question-answer pair based on the enhanced question and the enhanced answer corresponding to the target question-answer pair, so as to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair.

[0041] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the data augmentation method as described above.

[0042] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data augmentation method as described above.

[0043] The data augmentation method, apparatus, electronic device, and storage medium provided by this invention determine the target question-answer pair to be augmented in the original multi-turn dialogue data, generate multiple similar questions corresponding to the original questions in the target question-answer pair, and generate similar answers corresponding to the multiple similar questions. Based on this, the original multi-turn dialogue data is augmented in multiple stages to increase the diversity of samples, thereby improving the training effect of the model, improving the generalization ability of the model, and ultimately improving the multi-turn dialogue effect. At least one answer corresponding to the previous round question-answer pair of the target question-answer pair is obtained. Based on the fluency measurement results of at least one answer with multiple similar questions, the augmented answer corresponding to the previous round question-answer pair is determined from the at least one answer, and the augmented question corresponding to the target question-answer pair is determined from the multiple similar questions. The best augmented answer and augmented question are determined by evaluating the fluency of the transition between rounds, thereby improving the data quality of the augmented similar multi-turn dialogue data, thereby improving the training effect of the model, and ultimately improving the multi-turn dialogue effect, i.e., reducing the noise problem in the data after similarity augmentation. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0045] Figure 1 A schematic diagram illustrating the similarity extension of multi-turn dialogue data provided by the present invention;

[0046] Figure 2 A flowchart illustrating the data augmentation method provided by this invention;

[0047] Figure 3 A schematic diagram of the data enhancement device provided by the present invention;

[0048] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0050] With the rapid development of artificial intelligence, large-scale models possess massive parameters and powerful learning capabilities, enabling their applications to become increasingly widespread, such as in natural language processing and computer vision. In natural language processing, multi-turn dialogue is finding increasingly common applications. Multi-turn dialogue refers to a continuous series of conversations between a human and a model to complete specific tasks or obtain necessary information; that is, in multi-turn dialogue, the model needs to progressively advance the conversation based on the user's input, providing useful feedback and responses at each step. Furthermore, the average number of dialogue turns is often used as an evaluation metric for the effectiveness of multi-turn dialogue; therefore, models need to be able to engage in fluent, multi-turn conversations with humans. Moreover, the interaction methods in multi-turn dialogues typically involve multiple aspects of a single question, requiring the model to understand natural language and possess sufficient contextual knowledge to answer user questions. In other words, to achieve efficient multi-turn dialogue, the model needs sufficiently powerful natural language understanding, natural language generation, dialogue management, and logical reasoning abilities, thus requiring model improvement.

[0051] Furthermore, among the many capabilities of large chatbots, multi-turn dialogue is considered a high-order characteristic. If a large chatbot can engage in fluent, multi-turn conversations with humans, it gives the impression that the model is "intelligent," which can increase user engagement and improve the interactive experience. Since the average number of dialogue turns is often used as an evaluation metric for the effectiveness of chatbot dialogue, improving the effectiveness of multi-turn dialogue is a pressing need that needs to be addressed.

[0052] To address the above requirements, there are generally two solutions:

[0053] The first approach, from the model's perspective, is to employ more robust attention mechanisms, such as increasing the context length and using more effective positional encoding (e.g., rotational positional encoding), which can optimize the model's multi-turn dialogue capabilities.

[0054] The second approach, from a data perspective, involves introducing higher-quality multi-turn dialogue data into the SFT (Supervised Fine-Tuning) stage, i.e., using data augmentation to better stimulate the model's multi-turn dialogue capabilities.

[0055] The first approach presents significant challenges. For instance, while attention mechanisms can model long-range relationships between texts, model learning becomes difficult when the text is long and the logical connections are complex. Therefore, most current approaches employ the second method to enhance the multi-turn dialogue capabilities of models.

[0056] Currently, data augmentation is used on raw multi-turn dialogue data to introduce more multi-turn dialogue data for model training, thereby better stimulating the model's multi-turn dialogue capabilities. Specifically, due to the small size of the training dataset, the original question in the raw multi-turn dialogue data is used as a seed. A Large Language Model (LLM) is used to generate a similar question, and then a similar answer is generated based on this similar question. Finally, new multi-turn dialogue data is constructed based on this similar question and similar answer. However, since the similar question is generated based on the original question, and the similar answer is generated based on the similar question, the sources of similar questions and similar answers are different, and the generated similar questions or similar answers are too scattered. This may lead to inconsistencies between the similar answer and the next round's question, resulting in disjointedness. In some cases, the similar answer in the current round may not even be on the same topic as the question in the next round, thus reducing the model's training effectiveness and consequently reducing the multi-turn dialogue performance. In summary, existing data augmentation methods may introduce significant noise.

[0057] For example, suppose the original multi-turn dialogue data includes n question-answer pairs. In each question-answer pair, the original question generates a corresponding similar question, and the similar answers are generated based on the similar questions; such as Figure 1 As shown, based on the (i-1)th round of question-and-answer pairs, the corresponding original question Q... i-1 Generate similar questions Q′ corresponding to the (i-1)th round of question-answering pairs. i-1 Based on the similar questions Q′ corresponding to the i-1th round of question answering i-1 Generate similar answers A′ for the (i-1)th round of question-and-answer pairs. i-1 Based on the original question Q corresponding to the i-th round of question answering i Generate similar questions Q′ corresponding to the i-th round of question-answering pairs. i Based on the similar questions Q′ corresponding to the i-th round of question answering i Generate similar answers A′ for the i-th round of question-and-answer pairs. i Based on the original question Q corresponding to the (i+1)th round of question answering i+1 Generate similar questions Q′ corresponding to the (i+1)th round of question-answering pairs. i+1 Based on the (i+1)th round of question answering, the corresponding similar question Q′ i+1 Generate similar answers A′ for the (i+1)th round of question-and-answer pairs. i+1However, the similar answer A′ i-1 Similar to problem Q′ i The connection between them might be poor; similar answer A' i Similar to problem Q′ i+1 The connections between them might be poor, resulting in disjointedness and a lack of fluency; they might even be from completely different topics. Furthermore, even similar answers A′... i-1 With the original question Q i There might also be issues with the connection between them.

[0058] To address the above problems, the present invention proposes the following embodiments. Figure 2 A flowchart illustrating the data augmentation method provided by this invention is shown below. Figure 2 As shown, the data augmentation method includes:

[0059] Step 110: Determine the target question-answer pairs to be enhanced in the original multi-turn dialogue data, wherein the original multi-turn dialogue data includes multi-turn question-answer pairs.

[0060] Here, the raw multi-turn dialogue data refers to the original multi-turn dialogue data, i.e., it is the original sample. Furthermore, this raw multi-turn dialogue data is the data to be augmented. The raw multi-turn dialogue data includes consecutive question-and-answer pairs, i.e., highly fluent and coherent multi-turn dialogues.

[0061] For example, suppose a single original multi-turn dialogue data (a single sample) includes n question-answer pairs, i.e., a single sample S = <Q1,A1,Q2,A2,...,Q n A n >, where Q i A i For the i-th round of questions and answers, and <Q1,A1,Q2,A2,...,Q n > is an unlabeled sample, A n The label for the unlabeled sample, i.e. <Q1,A1,Q2,A2,...,Q n A n >This is a supervised sample.

[0062] Here, the target question-answer pair includes an original question and its corresponding original answer. It should be understood that all question-answer pairs in the original multi-turn dialogue data can be enhanced, or only individual question-answer pairs can be enhanced. Based on this, the target question-answer pairs to be enhanced are determined first.

[0063] To facilitate understanding, a multi-turn dialogue scenario is used as an example to illustrate the multi-turn dialogue data. Assume that characters A and B have a multi-turn dialogue, with a total of 3 rounds. That is, the multi-turn dialogue data includes 3 rounds of question-and-answer pairs, as shown in Table 1 below. In Table 1, the serial numbers Q1, Q2, and Q3 represent the questions in the first, second, and third rounds, respectively, and the serial numbers A1, A2, and A3 represent the answers in the first, second, and third rounds, respectively. The content in Table 1 is the text content of the questions or answers.

[0064] Table 1

[0065]

[0066]

[0067] It should be noted that, as shown in Table 1 above, in multi-turn dialogues, it is necessary to pay attention not only to the fluency of each question-and-answer pair, but also to the coherence and logic of the entire multi-turn dialogue, that is, the long-range associative capability of the model. For example, in the question-and-answer pair of the i-th round and the question-and-answer pair of the j-th round, when i≠j, the question Q in the question-and-answer pair of the i-th round... i Answer A in the j-th round of question and answer j It's still necessary to make sure you're talking about the same topic.

[0068] Step 120: Generate multiple similar questions corresponding to the original question in the target question-answer pair, and generate similar answers corresponding to the multiple similar questions respectively.

[0069] Considering the need to identify the most fluent similar question-answer pairs and the most fluent similar multi-turn dialogue data, compared to the existing first-order extension (which generates only one similar question corresponding to the original question), this approach requires generating multiple similar questions, i.e., multi-order extension. This involves using the original question as a seed question to generate multiple similar questions.

[0070] In one embodiment, the original question is input into a large language model, resulting in multiple similar questions output by the large language model.

[0071] Here, the similar answers to each similar question can be obtained manually or generated based on a large language model. That is, the similar questions are input into the large language model, and the similar answers output by the large language model are obtained.

[0072] For example, if the target question-answer pair is the question-answer pair of the i-th round, then the original question Q in that question-answer pair of the i-th round can be generated. i The corresponding k similar problems Q′ i1 ,Q′ i2 …Q′ ik Then, for k similar problems Q′ i1Generate k similar answers A′. i1 A′ i2 ...A′ ik .

[0073] Step 130: Obtain at least one answer corresponding to the previous round of question-and-answer pair of the target question-and-answer pair. The at least one answer includes the original answer corresponding to the previous round of question-and-answer pair in the original multi-round dialogue data and / or multiple similar answers corresponding to the previous round of question-and-answer pair.

[0074] Considering the need to identify the most seamlessly connected similar question from among multiple similar questions corresponding to the target question-answer pair, it is necessary to obtain at least one answer from the previous question-answer pair of the target question-answer pair.

[0075] Here, the method for determining the multiple similar answers corresponding to the previous question-and-answer pair is the same as the method for determining the multiple similar answers corresponding to the target question-and-answer pair. That is, the multiple similar answers corresponding to the previous question-and-answer pair are the answers generated corresponding to the multiple similar questions of the previous question-and-answer pair.

[0076] For example, if the target question-answer pair is the question-answer pair of round i, then the previous question-answer pair is the question-answer pair of round i-1, and the original answer corresponding to the previous question-answer pair is A. i-1 In the previous round of question and answer, the corresponding multiple similar answers were A′. i-1,1 A′ i-1, 2...A′ i-1,k .

[0077] In some embodiments, where the previous question-and-answer pair has been enhanced, at least one answer includes the original answer corresponding to the previous question-and-answer pair in the original multi-turn dialogue data and / or multiple similar answers corresponding to the previous question-and-answer pair.

[0078] In other embodiments, if the previous question-and-answer pair is not enhanced, at least one answer includes only the original answer corresponding to the previous question-and-answer pair.

[0079] Step 140: Based on the fluency measurement results of the at least one answer and the plurality of similar questions, determine the enhanced answer corresponding to the previous round of question-answering pair from the at least one answer, and determine the enhanced question corresponding to the target question-answering pair from the plurality of similar questions.

[0080] Wherein, any of the fluency measurement results is the fluency measurement value of any answer among the at least one answer and any similar question among the plurality of similar questions.

[0081] Specifically, the target fluency measure with the best fluency is determined from the various fluency measure results, the enhanced answer corresponding to the target fluency measure is determined from at least one answer, and the enhanced question corresponding to the target fluency measure is determined from multiple similar questions. That is, the enhanced answer and the enhanced question have the best connection, that is, the best fluency, that is, the best coherence, and that is, the most consistent topic.

[0082] Here, the enhanced answer corresponding to the previous question-and-answer pair is used as the actual answer corresponding to the previous question-and-answer pair in the enhanced similar multi-turn dialogue data.

[0083] For example, if there are M at least one answer and N similar questions, then the number of fluency measurement results is M*N. This means that at least one answer can be combined with multiple similar questions to obtain M*N candidate sets. From these M*N candidate sets, the enhanced answer corresponding to the previous round of question-answering pairs and the enhanced question corresponding to the target question-answering pair are determined. Each candidate set includes any answer from the at least one answer set and any similar question from the multiple similar questions set.

[0084] Specifically, a fluency metric function is used to determine the fluency metric results of at least one answer with multiple similar questions.

[0085] In some embodiments, any fluency measurement result is determined based on the following steps: concatenating the text of any answer in at least one answer with the text of any similar question in a plurality of similar questions to obtain the target text; and determining the fluency measurement result based on the perplexity of the target text.

[0086] In other embodiments, any fluency measurement result is determined based on the following steps: calculating the similarity between the representation vector of the text of any answer in at least one answer and the representation vector of the text of any similar question in a plurality of similar questions, and obtaining a similarity calculation result; and determining the fluency measurement result based on the similarity calculation result.

[0087] In one embodiment, the similarity calculation method can be cosine similarity, and the calculation result is shown in the following formula:

[0088] f = cosine(emb(A′) i-1t ),emb(Q′ it ));

[0089] In the formula, f represents the fluency metric function, and emb(A′) i-1-t ) represents the text representation vector of any answer among multiple similar answers in the previous question-and-answer session, emb(Q′) i,t ) represents the text representation vector of any one of the multiple similar questions corresponding to the target question-answer pair.

[0090] In one embodiment, the similarity calculation result is directly determined as the fluency measurement result. Based on this, the target similarity calculation result with the highest similarity is determined from all similarity calculation results, the enhanced answer corresponding to the target similarity calculation result is determined from at least one answer, and the enhanced question corresponding to the target similarity calculation result is determined from multiple similar questions. For example, the above can be determined using the argmax function.

[0091] Step 150: The similar answers corresponding to the multiple similar questions are taken as multiple similar answers corresponding to the target question-answer pair, so as to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the multiple similar answers corresponding to the target question-answer pair.

[0092] If the next round of the target question-answer pair needs enhancement, generate multiple similar questions corresponding to the original question in the next round of the original multi-turn dialogue data, and obtain the original answer and / or multiple similar answers corresponding to the target question-answer pair. Based on the fluency measurement results of the original answer and / or multiple similar answers corresponding to the target question-answer pair with the multiple similar questions corresponding to the original question in the next round of the question-answer pair, determine the enhanced answer corresponding to the target question-answer pair from the original answer and / or multiple similar answers corresponding to the target question-answer pair. Since the processing method for each round of question-answer pairs is basically the same, it will not be described in detail here.

[0093] If the next round of question-answering pairs for the target question-answering pair does not require enhancement, obtain the original answer and / or multiple similar answers corresponding to the target question-answering pair. Based on the fluency measurement results of the original answer and / or multiple similar answers corresponding to the target question-answering pair with the original question in the next round of question-answering pairs, determine the enhanced answer corresponding to the target question-answering pair from the original answer and / or multiple similar answers corresponding to the target question-answering pair.

[0094] Furthermore, each round of question-and-answer pairs is enhanced according to the dialogue order of the multi-round question-and-answer pairs in the original multi-round dialogue data.

[0095] Step 160: Based on the enhanced question and the enhanced answer corresponding to the target question-answer pair, determine the similar question-answer pairs corresponding to the target question-answer pair, and generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair.

[0096] Here, the similar question-answer pair refers to the enhanced question-answer pair corresponding to the dialogue turn of the target question-answer pair. This similar question-answer pair is used to replace the original question-answer pairs of the same dialogue turn in the original multi-turn dialogue data, thereby generating new similar multi-turn dialogue data. It should be understood that this similar question-answer pair includes the enhanced question and the enhanced answer corresponding to the target question-answer pair.

[0097] Furthermore, if an original multi-turn dialogue data corresponds to multiple similar question-answer pairs, these multiple similar question-answer pairs can be used to replace multiple original question-answer pairs with the same dialogue turn in the original multi-turn dialogue data, thereby generating a new similar multi-turn dialogue data. If there are similar question-answer pairs with discontinuous dialogue turns among the multiple similar question-answer pairs, these multiple similar question-answer pairs can be used to replace multiple original question-answer pairs with the same dialogue turn in the original multi-turn dialogue data, generating multiple new similar multi-turn dialogue data. It is only necessary to ensure that similar question-answer pairs with consecutive dialogue turns are replaced together, while similar question-answer pairs with discontinuous dialogue turns can be replaced separately to generate multiple data.

[0098] The data augmentation method provided in this invention identifies the target question-answer pair to be augmented in the original multi-turn dialogue data, generates multiple similar questions corresponding to the original questions in the target question-answer pair, and generates similar answers corresponding to the multiple similar questions. Based on this, the original multi-turn dialogue data is augmented in multiple stages to increase the diversity of samples, thereby improving the training effect of the model, improving the generalization ability of the model, and ultimately improving the multi-turn dialogue effect. At least one answer corresponding to the previous round question-answer pair of the target question-answer pair is obtained. Based on the fluency measurement results of at least one answer with multiple similar questions, the augmented answer corresponding to the previous round question-answer pair is determined from the at least one answer, and the augmented question corresponding to the target question-answer pair is determined from the multiple similar questions. The best augmented answer and augmented question are determined by evaluating the fluency of the transition between rounds, thereby improving the data quality of the augmented similar multi-turn dialogue data, improving the training effect of the model, and ultimately improving the multi-turn dialogue effect, i.e., reducing the noise problem in the data after similarity augmentation.

[0099] Based on any of the above embodiments, in this method, step 130 includes:

[0100] If the previous question-and-answer pair has been enhanced, obtain the original answer corresponding to the previous question-and-answer pair and multiple similar answers corresponding to the previous question-and-answer pair from the original multi-turn dialogue data;

[0101] If the previous question-and-answer pair is not enhanced, obtain the original answer corresponding to the previous question-and-answer pair in the original multi-turn dialogue data.

[0102] Specifically, if the previous round of question-and-answer pairs has been augmented, at least one answer includes the original answer corresponding to the previous round of question-and-answer pairs and multiple similar answers from the original multi-turn dialogue data. If the previous round of question-and-answer pairs has not been augmented, at least one answer includes only the original answer corresponding to the previous round of question-and-answer pairs.

[0103] Accordingly, if the previous question-and-answer pair has been enhanced, the original answer corresponding to the previous question-and-answer pair and multiple similar answers corresponding to the previous question-and-answer pair are obtained from the original multi-turn dialogue data, and then the process further includes:

[0104] Based on the enhanced question and the enhanced answer corresponding to the previous question-answer pair, similar question-answer pairs corresponding to the previous question-answer pair are determined, so as to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair and the similar question-answer pairs corresponding to the previous question-answer pair.

[0105] Here, the method for determining the augmentation question corresponding to the previous question-answer pair is basically the same as the method for determining the augmentation question corresponding to the target question-answer pair, and will not be elaborated further. It should be understood that this similar question-answer pair includes both the augmentation question corresponding to the previous question-answer pair and the augmentation answer corresponding to the previous question-answer pair.

[0106] It should be noted that similar question-answer pairs corresponding to the target question-answer pair and similar question-answer pairs corresponding to the previous round question-answer pair can be used together to replace two original question-answer pairs of the same dialogue round in the original multi-turn dialogue data, thereby generating a new set of similar multi-turn dialogue data.

[0107] The data augmentation method provided in this invention can augment both individual question-answer pairs in the original multi-turn dialogue data, thereby increasing sample diversity, improving model training performance, enhancing generalization ability, and ultimately improving multi-turn dialogue performance. Furthermore, given that the previous question-answer pair has already been augmented, the original answer and multiple similar answers corresponding to the previous question-answer pair are obtained from the original multi-turn dialogue data. This allows for the identification of the augmented answer with the best fluency from a wider pool of answers, further improving the data quality of the augmented similar multi-turn dialogue data, thus enhancing model training performance and ultimately improving multi-turn dialogue performance. This also further reduces noise issues in the augmented data.

[0108] Based on any of the above embodiments, in this method, any of the fluency measurement results is determined based on the following steps:

[0109] The text of any one of the at least one answers is concatenated with the text of any one of the multiple similar questions to obtain the target text;

[0110] The fluency metric result is determined based on the perplexity of the target text.

[0111] Specifically, the text of any one of the at least one answers can be concatenated at the beginning or at the end. Considering that any one of the at least one answers corresponds to the answer in the previous round of question-and-answer pairs, and any one of the multiple similar questions corresponds to the question in the current round of question-and-answer pairs, it is preferable to concatenate the text of any one of the at least one answers at the beginning to improve the accuracy of determining the perplexity.

[0112] In one embodiment, the perplexity is calculated using the following formula:

[0113] f = ppscore(concat(A) ′ i-1t Q i ′ t ));

[0114] In the formula, f represents the fluency metric function, ppscore represents the perplexity calculation function, and A ′ i-1,t This shows the text of any one of the multiple similar answers from the previous question-and-answer session, Q. i ′ ,t This represents the text of any one of the multiple similar questions in the target question-answer pair, concat(A ′ i-1,t Q i ′ ,t ) represents the target text.

[0115] In one embodiment, perplexity is directly determined as a fluency metric. Based on this, a target perplexity with the minimum perplexity is determined from all perplexities, an enhanced answer corresponding to the target perplexity is determined from at least one answer, and an enhanced question corresponding to the target perplexity is determined from multiple similar questions. For example, the above can be determined using the argmin function.

[0116] In another embodiment, the inverse of the perplexity is determined as the fluency metric result. Based on this, the target perplexity with the largest inverse of the perplexity is determined from the fluency metrics, the enhanced answer corresponding to the target perplexity is determined from at least one answer, and the enhanced question corresponding to the target perplexity is determined from multiple similar questions. For example, the above can be determined using the argmax function.

[0117] The data augmentation method provided in this embodiment of the invention provides support for determining the fluency measurement results in the above manner. The fluency measurement results can be accurately obtained in the above manner, thereby more accurately determining the best augmented answer and augmented question, thereby improving the data quality of the augmented similar multi-turn dialogue data, thereby improving the training effect of the model, and ultimately improving the multi-turn dialogue effect.

[0118] Based on any of the above embodiments, considering that multi-turn dialogue data is difficult to obtain, the dataset size of the original multi-turn dialogue data is small, and the data utilization of the original multi-turn dialogue data is insufficient; therefore, the method further includes:

[0119] The original multi-turn dialogue data is extracted to obtain multiple target multi-turn dialogue data, and each of the target multi-turn dialogue data includes at least two consecutive question-answer pairs;

[0120] Based on the multiple target multi-turn dialogue data, the enhanced multi-turn dialogue data is determined.

[0121] For example, suppose a single piece of raw multi-turn dialogue data S = <Q1,A1,Q2,A2,…,Q n A n Based on this, a maximum of n*(n+1) / 2 target multi-turn dialogue data can be constructed. However, considering that longer sequences can better characterize the long-range association ability of the model, target multi-turn dialogue data with a length of 1 is removed, that is, target multi-turn dialogue data that only includes one round of question-answer pairs is removed.

[0122] For example, a single piece of raw multi-turn dialogue data S =<Q1,A1,Q2,A2,Q3,A3> This results in three sets of multi-turn dialogue data for the target. The first set of multi-turn dialogue data is...<Q1,A1,Q2,A2> The second objective is to collect multi-turn dialogue data.<Q1,A1,Q2,A2,Q3,A3> The third objective is multi-turn dialogue data.<Q2,A2,Q3,A3> .

[0123] In one embodiment, multiple target multi-turn dialogue data are directly identified as enhanced multi-turn dialogue data.

[0124] In another embodiment, considering the large amount of multi-turn dialogue data from multiple targets, random sampling is performed on the multi-turn dialogue data from multiple targets to obtain enhanced multi-turn dialogue data. Further, based on a preset number of samples, random sampling is performed on the multi-turn dialogue data from multiple targets to obtain enhanced multi-turn dialogue data with a preset number of samples.

[0125] In another embodiment, considering that there is a large amount of multi-turn dialogue data for multiple targets, and that the number of question-answer pairs in the multi-turn dialogue data for multiple targets varies, i.e. the generated sample distribution is unbalanced, which may interfere with the model's learning; based on this, the target number of dialogue turns for the multi-turn dialogue data for multiple targets is determined respectively; based on the mean of the number of dialogue turns for each target, a Poisson distribution with respect to the number of dialogue turns is constructed; based on the Poisson distribution, the multi-turn dialogue data for multiple targets is sampled to obtain the enhanced multi-turn dialogue data.

[0126] It should be understood that traditional multi-turn dialogue data construction does not consider data augmentation. It relies on the large model itself to achieve the model's multi-turn dialogue capabilities and long-range correlation effects, increasing the difficulty of model learning. In scenarios with complex data distributions or high demands on logical reasoning abilities, large models may not be able to learn the true data distribution. This invention proposes a simple and effective data augmentation method that fully utilizes the original multi-turn dialogue data while effectively solving the problem of model learning difficulties.

[0127] The data augmentation method provided in this invention enhances the original multi-turn dialogue data in the manner described above, thereby improving the training effect of the model, further optimizing the model's long-range association ability, and ultimately improving the multi-turn dialogue performance. The method extracts multiple target multi-turn dialogue data from the original multi-turn dialogue data, with each target multi-turn dialogue data containing at least two consecutive question-answer pairs. This fully utilizes the information contained in the original multi-turn dialogue data, especially when the number of question-answer pairs is large, as the information contained is very rich. This reduces the problem of data sparsity and insufficient data, thereby improving the training effect of the model and ultimately enhancing the multi-turn dialogue performance.

[0128] Based on any of the above embodiments, considering the large quantity of multi-turn dialogue data from multiple targets, and the varying number of question-answer pairs (i.e., uneven sample distribution) that may interfere with model learning, and that using all multi-turn dialogue data from multiple targets as samples to train the model would increase the difficulty of model learning; therefore, determining the enhanced multi-turn dialogue data based on the multiple target multi-turn dialogue data includes:

[0129] Determine the target dialogue rounds for each of the multiple target multi-turn dialogue data;

[0130] Based on the mean of the number of dialogue turns for each target, a Poisson distribution with respect to the number of dialogue turns is constructed;

[0131] Based on the Poisson distribution, the multi-turn dialogue data of the multiple targets are sampled to obtain enhanced multi-turn dialogue data.

[0132] For example, if the target multi-turn dialogue data includes N rounds of question-answer pairs, then the corresponding target dialogue round number is N.

[0133] It should be noted that the number of dialogue turns in multi-turn dialogue data follows a Poisson distribution. Based on this, a Poisson distribution on the number of dialogue turns can be constructed based on the mean of the number of dialogue turns for each target, and then this Poisson distribution can be used to sample multi-turn dialogue data from multiple targets. More specifically, the expected value of the probability distribution function corresponding to the Poisson distribution can be determined based on this mean, and thus this probability distribution function can be constructed.

[0134] Specifically, sampling is performed on a Poisson distribution whose mean is the mean of the number of target dialogue turns. This ensures that the sampled enhanced multi-turn dialogue data includes more target multi-turn dialogue data with a number of dialogue turns close to the mean and fewer target multi-turn dialogue data with a number of dialogue turns far from the mean, thereby making the generated sample distribution more balanced.

[0135] In one embodiment, probabilities corresponding to multiple dialogue turns are determined based on a Poisson distribution; based on each probability, multiple target multi-turn dialogue data are sampled to obtain enhanced multi-turn dialogue data.

[0136] Furthermore, considering that the earlier the dialogue turn in the original multi-turn dialogue data, the less noise the question-answer pairs, if multiple target multi-turn dialogue data with the same number of dialogue turns are sampled, and it is necessary to sample multiple target multi-turn dialogue data with the same number of dialogue turns again, the target multi-turn dialogue data with the earlier dialogue turn should be selected first.

[0137] It should be understood that sampling data according to a specific distribution in the above manner avoids the problem of model bias caused by the long-tail effect.

[0138] The data augmentation method provided in this invention constructs a Poisson distribution on the number of dialogue turns based on the mean of the number of target dialogue turns in each target multi-turn dialogue data, and samples multiple target multi-turn dialogue data based on this Poisson distribution, thereby reducing the number of samples. Furthermore, sampling based on the Poisson distribution ensures that the generated sample distribution is more balanced, thereby improving the training effect of the model and ultimately improving the multi-turn dialogue effect.

[0139] Based on any of the above embodiments, in this method, sampling the multiple target multi-turn dialogue data based on the Poisson distribution to obtain enhanced multi-turn dialogue data includes:

[0140] Based on the Poisson distribution, the probabilities corresponding to the multiple dialogue turns are determined respectively;

[0141] Based on the probabilities and the preset number of samples, the multi-turn dialogue data of the multiple targets are sampled to obtain the enhanced multi-turn dialogue data with the preset number of samples.

[0142] Specifically, based on the probability distribution function corresponding to the Poisson distribution, the probabilities corresponding to different numbers of dialogue turns are determined. Further, these multiple dialogue turns include 2-n, where n represents the number of question-answer pairs in the original multi-turn dialogue data. For example, if the original multi-turn dialogue data includes 5 question-answer pairs, then the multiple dialogue turns include 2, 3, 4, and 5. Considering that any target multi-turn dialogue data includes at least two consecutive question-answer pairs, the minimum value among the multiple dialogue turns is 2; considering that the maximum number of question-answer pairs in the multiple target multi-turn dialogue data is the same as the number of question-answer pairs in the original multi-turn dialogue data, the maximum value among the multiple dialogue turns is the same as the number of question-answer pairs in the original multi-turn dialogue data.

[0143] Here, the preset number of samples can be set in advance, which is set for a single piece of raw multi-turn dialogue data.

[0144] In some embodiments, the probabilities are sorted, and multiple target multi-turn dialogue data are sampled in descending order of probability. More specifically, multiple target multi-turn dialogue data are sampled based on the number of dialogue turns corresponding to the probability from largest to smallest, so that the sampled enhanced multi-turn dialogue data includes target multi-turn dialogue data with more dialogue turns close to the mean and target multi-turn dialogue data with fewer dialogue turns far from the mean, thereby making the generated sample distribution more balanced.

[0145] In one embodiment, the target multi-turn dialogue data corresponding to the dialogue turn number with a higher probability is sampled first, and the target multi-turn dialogue data corresponding to the dialogue turn number with a lower probability is sampled only after all the target multi-turn dialogue data corresponding to the dialogue turn number with a higher probability has been sampled.

[0146] In another embodiment, multiple target multi-turn dialogue data are sampled based on a preset sampling ratio and the number of dialogue turns corresponding to decreasing probabilities. The preset sampling ratio defines the sampling proportions corresponding to decreasing probabilities. Therefore, compared to the above embodiment, this prevents all sampled multi-turn dialogue data from being the same as the dialogue turns corresponding to the highest probabilities.

[0147] It should be understood that the data is also sampled according to a specific distribution to avoid the problem of model bias caused by the long-tail effect.

[0148] The data augmentation method provided in this embodiment of the invention provides support for the sampling method in the above manner. In addition, the above manner can reduce the number of samples, and the sampling based on each probability and the preset number of samples ensures that the generated sample distribution is more balanced, thereby improving the training effect of the model and ultimately improving the effect of multi-turn dialogue.

[0149] Based on any of the above embodiments, considering that existing technologies treat original multi-turn dialogue data and similar multi-turn dialogue data equally, that is, the proportion of the two as training samples is the same, or all original multi-turn dialogue data and all similar multi-turn dialogue data are directly used as training samples, or the proportion of the sample size is determined manually; however, the above methods may miss the optimal solution, resulting in the model training effect not reaching the best; based on this, the method further includes:

[0150] Based on a preset total number of samples, multiple sample sets corresponding to sample quantity ratios are obtained, where any of the sample quantity ratios is the ratio of the number of samples of the original multi-turn dialogue data to the number of samples of the similar multi-turn dialogue data in the sample set.

[0151] Based on the comprehensive loss value corresponding to each of the sample sets, the target sample set with the smallest comprehensive loss value is determined from each of the sample sets;

[0152] The proportion of the number of samples corresponding to the target sample set is determined as the target sample proportion, and the model is trained based on the training sample set corresponding to the target sample proportion.

[0153] Here, the preset total number of samples can be set in advance, which is used to determine the number of samples in the sample set. Furthermore, the preset total number of samples is relatively small, that is, the sample size is a small batch of data, thereby reducing the amount of computation and improving the efficiency of determining the target sample size ratio.

[0154] Here, the multiple sample size ratios are different. Furthermore, the weights of the sample size of similar multi-turn dialogue data can always be fixed, such as fixing the weight of the sample size of similar multi-turn dialogue data to 1, or the weight of the sample size of the original multi-turn dialogue data can always be fixed, thereby reducing the amount of computation and improving the efficiency of determining the target sample size ratio.

[0155] Specifically, each sample in the sample set is input into the model (such as a multi-turn dialogue model), and the predicted results output by the model are obtained. The loss value corresponding to each predicted result is determined based on the loss function corresponding to the model, and the comprehensive loss value corresponding to the sample set is determined based on each loss value. This comprehensive loss value can be the mean of the loss values. It should be understood that after determining the loss value, backpropagation is not required; that is, the model does not need to be trained.

[0156] Here, the target sample set with the minimum overall loss value is the optimal solution among all sample sets, thereby improving the training effect of the model.

[0157] Here, the ratio of original multi-turn dialogue data to similar multi-turn dialogue data in the training sample set should be the ratio of the target sample quantity, so as to train the model based on this training sample set. The model can be set according to actual needs, such as a multi-turn dialogue model or a large language model.

[0158] For example, a grid search is performed on multiple sample size ratios to determine the target sample size ratio; that is, the sample size ratio is used as a hyperparameter for the grid search. Based on this, the optimal solution is determined by using a grid search method, which traverses the entire parameter space to ensure that no optimal solution is missed.

[0159] Furthermore, any sample size ratio is the ratio of the number of original multi-turn dialogue data samples, the number of enhanced multi-turn dialogue data samples, and the number of similar multi-turn dialogue data samples in the sample set. Based on this, the ratio of original multi-turn dialogue data, enhanced multi-turn dialogue data, and similar multi-turn dialogue data in the training sample set should be the target sample size ratio.

[0160] For example, the target sample ratio is: original multi-turn dialogue data : augmented multi-turn dialogue data : similar multi-turn dialogue data = 3 : 2 : 1. It should be understood that the original multi-turn dialogue data is the source of the data, and its noise is the smallest, so its weight should be the largest, thereby improving the model training effect; the augmented multi-turn dialogue data basically describes the distribution of the original multi-turn dialogue data, so its weight is second, thereby improving the model training effect; the similar multi-turn dialogue data has more noise because it has been processed by a large language model, and this noise is fixed in the system and cannot be overcome, so its weight is smaller, thereby improving the model training effect.

[0161] The data augmentation method provided in this embodiment of the invention determines the optimal proportion of target samples in the above manner, ensuring that no optimal solution is missed, thereby improving the model training effect and thus improving the multi-turn dialogue effect; moreover, the model learns more fully from the original samples, while also taking into account the expanded samples, effectively improving data diversity.

[0162] Based on the above embodiments, this invention proposes a multi-turn dialogue data augmentation scheme based on a large model, which can effectively solve the problems of difficulty in learning long-range associations in multi-turn dialogues, insufficient data utilization, low fluency, data sparsity, and poor diversity, effectively improve the quality of multi-turn dialogue data, and thus optimize the multi-turn dialogue performance of the model.

[0163] The data augmentation apparatus provided by the present invention will be described below. The data augmentation apparatus described below can be referred to in correspondence with the data augmentation method described above.

[0164] Figure 3 A schematic diagram of the data enhancement device provided by the present invention is shown below. Figure 3 As shown, the data enhancement device includes:

[0165] The first determining module 310 is used to determine the target question-answer pair to be enhanced in the original multi-turn dialogue data, wherein the original multi-turn dialogue data includes multi-turn question-answer pairs.

[0166] The question generation module 320 is used to generate multiple similar questions corresponding to the original question in the target question-answer pair, and generate similar answers corresponding to the multiple similar questions respectively;

[0167] The answer acquisition module 330 is used to acquire at least one answer corresponding to the previous round question and answer pair of the target question and answer pair, wherein the at least one answer includes the original answer corresponding to the previous round question and answer pair in the original multi-round dialogue data and / or multiple similar answers corresponding to the previous round question and answer pair;

[0168] The second determining module 340 is used to determine, based on the fluency measurement results of the at least one answer and the plurality of similar questions, the enhanced answer corresponding to the previous round of question-answering pair from the at least one answer, and the enhanced question corresponding to the target question-answering pair from the plurality of similar questions, wherein any of the fluency measurement results is the fluency measurement value of any answer in the at least one answer and any similar question in the plurality of similar questions;

[0169] The third determining module 350 is used to take the similar answers corresponding to the multiple similar questions as multiple similar answers corresponding to the target question-answer pair, so as to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the multiple similar answers corresponding to the target question-answer pair;

[0170] The fourth determining module 360 ​​is used to determine similar question-answer pairs corresponding to the target question-answer pair based on the enhanced question and the enhanced answer corresponding to the target question-answer pair, so as to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair.

[0171] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4As shown, the electronic device may include a processor 410, a communications interface 420, a memory 430, and a communication bus 440, wherein the processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a data augmentation method, which includes: determining a target question-answer pair to be augmented in original multi-turn dialogue data, the original multi-turn dialogue data including multi-turn question-answer pairs; generating multiple similar questions corresponding to the original questions in the target question-answer pair, and generating similar answers corresponding to the multiple similar questions respectively; obtaining at least one answer corresponding to the previous round question-answer pair of the target question-answer pair, the at least one answer including the original answer corresponding to the previous round question-answer pair in the original multi-turn dialogue data and / or multiple similar answers corresponding to the previous round question-answer pair; and determining the previous round question-answer pair from the at least one answer based on the fluency measurement results of the at least one answer and the multiple similar questions respectively. The corresponding enhanced answer, and the enhanced question corresponding to the target question-answer pair determined from the plurality of similar questions, wherein any of the fluency measurement results is the fluency measurement value of any answer among the at least one answer and any similar question among the plurality of similar questions; the similar answers corresponding to the plurality of similar questions are used as the plurality of similar answers corresponding to the target question-answer pair, so as to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the plurality of similar answers corresponding to the target question-answer pair; based on the enhanced question corresponding to the target question-answer pair and the enhanced answer corresponding to the target question-answer pair, the similar question-answer pairs corresponding to the target question-answer pair are determined, so as to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair.

[0172] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0173] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the data augmentation methods provided by the above methods. The method includes: determining a target question-answer pair to be augmented in original multi-turn dialogue data, the original multi-turn dialogue data including multi-turn question-answer pairs; generating multiple similar questions corresponding to the original question in the target question-answer pair, and generating similar answers corresponding to the multiple similar questions respectively; obtaining at least one answer corresponding to the previous round question-answer pair of the target question-answer pair, the at least one answer including the original answer corresponding to the previous round question-answer pair in the original multi-turn dialogue data and / or multiple similar answers corresponding to the previous round question-answer pair; and, based on the fluency measurement results of the at least one answer and the multiple similar questions respectively, from the... The enhanced answer corresponding to the previous round question-answer pair is determined from at least one answer, and the enhanced question corresponding to the target question-answer pair is determined from the plurality of similar questions. Any of the fluency metrics is the fluency metric value of any answer among the at least one answer and any similar question among the plurality of similar questions. The similar answers corresponding to the plurality of similar questions are used as the plurality of similar answers corresponding to the target question-answer pair to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the plurality of similar answers corresponding to the target question-answer pair. Based on the enhanced question corresponding to the target question-answer pair and the enhanced answer corresponding to the target question-answer pair, similar question-answer pairs corresponding to the target question-answer pair are determined to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair.

[0174] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0175] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0176] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data augmentation method, characterized in that, include: Identify the target question-answer pairs to be enhanced in the original multi-turn dialogue data, wherein the original multi-turn dialogue data includes multi-turn question-answer pairs; Generate multiple similar questions corresponding to the original question in the target question-answer pair, and generate similar answers corresponding to each of the multiple similar questions; Obtain at least one answer corresponding to the previous round question-answer pair of the target question-answer pair, wherein the at least one answer includes the original answer corresponding to the previous round question-answer pair in the original multi-round dialogue data and / or multiple similar answers corresponding to the previous round question-answer pair; Based on the fluency measurement results of the at least one answer and the plurality of similar questions, the enhanced answer corresponding to the previous round of question-answering pair is determined from the at least one answer, and the enhanced question corresponding to the target question-answering pair is determined from the plurality of similar questions, wherein any of the fluency measurement results is the fluency measurement value of any answer in the at least one answer and any similar question in the plurality of similar questions; The similar answers corresponding to the multiple similar questions are used as multiple similar answers corresponding to the target question-answer pair, so as to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the multiple similar answers corresponding to the target question-answer pair; Based on the enhanced question and the enhanced answer corresponding to the target question-answer pair, similar question-answer pairs corresponding to the target question-answer pair are determined, and enhanced similar multi-turn dialogue data are generated based on the similar question-answer pairs corresponding to the target question-answer pair.

2. The data augmentation method according to claim 1, characterized in that, Obtaining at least one answer corresponding to the previous round of question-and-answer pairs for the target question-and-answer pair includes: If the previous question-and-answer pair has been enhanced, obtain the original answer corresponding to the previous question-and-answer pair and multiple similar answers corresponding to the previous question-and-answer pair from the original multi-turn dialogue data; If the previous question-and-answer pair is not enhanced, obtain the original answer corresponding to the previous question-and-answer pair in the original multi-turn dialogue data; In the case that the previous question-and-answer pair has been enhanced, the method further includes obtaining the original answer corresponding to the previous question-and-answer pair and multiple similar answers corresponding to the previous question-and-answer pair from the original multi-turn dialogue data, and then including: Based on the enhanced question and the enhanced answer corresponding to the previous question-answer pair, similar question-answer pairs corresponding to the previous question-answer pair are determined, so as to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair and the similar question-answer pairs corresponding to the previous question-answer pair.

3. The data augmentation method according to claim 1, characterized in that, Any of the aforementioned fluency metrics results are determined based on the following steps: The text of any one of the at least one answers is concatenated with the text of any one of the multiple similar questions to obtain the target text; The fluency metric result is determined based on the perplexity of the target text.

4. The data augmentation method according to claim 1, characterized in that, Also includes: The original multi-turn dialogue data is extracted to obtain multiple target multi-turn dialogue data, and each of the target multi-turn dialogue data includes at least two consecutive question-answer pairs; Based on the multiple target multi-turn dialogue data, the enhanced multi-turn dialogue data is determined.

5. The data augmentation method according to claim 4, characterized in that, The step of determining the enhanced multi-turn dialogue data based on the multiple target multi-turn dialogue data includes: Determine the target dialogue rounds for each of the multiple target multi-turn dialogue data; Based on the mean of the number of dialogue turns for each target, a Poisson distribution with respect to the number of dialogue turns is constructed; Based on the Poisson distribution, the multi-turn dialogue data of the multiple targets are sampled to obtain enhanced multi-turn dialogue data.

6. The data augmentation method according to claim 5, characterized in that, The step of sampling the multiple target multi-turn dialogue data based on the Poisson distribution to obtain enhanced multi-turn dialogue data includes: Based on the Poisson distribution, the probabilities corresponding to the multiple dialogue turns are determined respectively; Based on the probabilities and the preset number of samples, the multi-turn dialogue data of the multiple targets are sampled to obtain the enhanced multi-turn dialogue data with the preset number of samples.

7. The data augmentation method according to claim 1, characterized in that, Also includes: Based on a preset total number of samples, multiple sample sets corresponding to sample quantity ratios are obtained, where any of the sample quantity ratios is the ratio of the number of samples of the original multi-turn dialogue data to the number of samples of the similar multi-turn dialogue data in the sample set. Based on the comprehensive loss value corresponding to each of the sample sets, the target sample set with the smallest comprehensive loss value is determined from each of the sample sets; The proportion of the number of samples corresponding to the target sample set is determined as the target sample proportion, and the model is trained based on the training sample set corresponding to the target sample proportion.

8. A data augmentation device, characterized in that, include: The first determining module is used to determine the target question-answer pairs to be enhanced in the original multi-turn dialogue data, wherein the original multi-turn dialogue data includes multi-turn question-answer pairs. The question generation module is used to generate multiple similar questions corresponding to the original question in the target question-answer pair, and to generate similar answers corresponding to the multiple similar questions respectively; The answer acquisition module is used to acquire at least one answer corresponding to the previous round question-and-answer pair of the target question-and-answer pair, wherein the at least one answer includes the original answer corresponding to the previous round question-and-answer pair in the original multi-round dialogue data and / or multiple similar answers corresponding to the previous round question-and-answer pair; The second determining module is used to determine, based on the fluency measurement results of the at least one answer and the plurality of similar questions, the enhanced answer corresponding to the previous round of question-answer pair from the at least one answer, and the enhanced question corresponding to the target question-answer pair from the plurality of similar questions, wherein any of the fluency measurement results is the fluency measurement value of any answer in the at least one answer and any similar question in the plurality of similar questions; The third determining module is used to take the similar answers corresponding to the multiple similar questions as multiple similar answers corresponding to the target question-answer pair, so as to determine the enhanced answer corresponding to the target question-answer pair from the original answer in the target question-answer pair and / or the multiple similar answers corresponding to the target question-answer pair; The fourth determining module is used to determine similar question-answer pairs corresponding to the target question-answer pair based on the enhanced question and the enhanced answer corresponding to the target question-answer pair, so as to generate enhanced similar multi-turn dialogue data based on the similar question-answer pairs corresponding to the target question-answer pair.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the data augmentation method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data augmentation method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Question and answer method and device, electronic equipment and readable storage medium

    CN116662518A

  • Method for providing vehicle-mounted question and answer data, vehicle-mounted infotainment system, intelligent vehicle and medium

    CN117271731A