A method and device for expanding data set

Through the method of generating sample data based on the language model and screening low-quality data, the problems of poor quality and insufficient diversity of data sets in the existing technology are solved, and high-quality and diverse data sets are expanded, which improves the performance and generalization capabilities of the model.

CN118607668BActive Publication Date: 2025-04-18BEIJING UNIV OF POSTS & TELECOMM +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410830079.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2025-04-18
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing data set synthesis methods have problems with poor quality and lack of diversity in the fields of artificial intelligence, machine learning, and natural language processing, resulting in poor performance or inability to generalize models.

Method used

By generating sample data based on the language model, and using the evaluation mechanism to filter out low-quality data with a correlation degree of less than the threshold with the real data, gradually expanding the data set until the performance threshold is met.

Benefits of technology

Ensure the quality and effectiveness of the data set, avoid the negative impact of noisy data on model training, improve the quality and diversity of generated samples, and improve the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118607668B_ABST
    Figure CN118607668B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method and device for expanding a data set, belonging to the field of data processing technology, the method comprising: generating first sample data based on a first language model; adding the first sample data to a data set containing second sample data, and filtering out third sample data from the data set; the second sample data is real data, and the third sample data is data in the first sample data whose correlation with the real data is less than a first threshold; training the first language model based on fourth sample data; the fourth sample data is data in the data set other than the third sample data; returning to execute the step of generating the first sample data based on the first language model until the set conditions are met, and obtaining the expanded data set. The method and device for expanding a data set provided by the present disclosure can eliminate low-quality samples, optimize the generation process, and effectively retain richer and higher-quality samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the field of data processing technology, and more specifically, to a data set expansion method and device. Background Art

[0002] In the fields of artificial intelligence, machine learning, and natural language processing, high-quality datasets are a key factor in training and evaluating models. However, existing dataset synthesis methods are limited by issues such as data quality, quantity, and diversity, resulting in poor performance of trained models or failure to generalize to actual scenarios. Currently, dataset synthesis methods usually involve manual annotation, data augmentation, and synthesis techniques. Manual annotation is time-consuming, labor-intensive, and expensive, and data augmentation may introduce noise and distortion. Among synthesis methods, common techniques also include rule-based synthesis and sequence-to-sequence models. However, these methods may have problems such as poor quality and lack of diversity in generated sample data. Summary of the invention

[0003] The purpose of the present disclosure is to provide a method and device for data set expansion to solve the problems of poor quality and lack of diversity in data set synthesis in a specific field.

[0004] According to a first aspect of an embodiment of the present disclosure, a method for expanding a data set is provided, including: generating first sample data based on a first language model.

[0005] The first sample data is added to a data set containing the second sample data, and the third sample data is screened out from the data set. The second sample data is real data, and the third sample data is data in the first sample data whose correlation with the real data is less than a first threshold.

[0006] The first language model is trained based on the fourth sample data. The fourth sample data is data in the data set other than the third sample data.

[0007] Return to the step of generating the first sample data based on the first language model until the set condition is met to obtain an expanded data set.

[0008] A second aspect of the embodiments of the present disclosure provides a data set expansion device, including:

[0009] The first calculation module is used to generate first sample data based on the first language model.

[0010] The second calculation module is used to add the first sample data to the data set containing the second sample data, and filter out the third sample data from the data set. The second sample data is real data, and the third sample data is data in the first sample data whose correlation with the real data is less than the first threshold.

[0011] The third computing module is used to train the first language model based on fourth sample data. The fourth sample data is data in the data set other than the third sample data.

[0012] The fourth calculation module returns to the step of generating the first sample data based on the first language model until the set conditions are met to obtain an expanded data set.

[0013] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the above-mentioned data set expansion method when executing the computer program.

[0014] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for expanding a data set are implemented.

[0015] The beneficial effect of a data set expansion method and device provided by the embodiments of the present disclosure is that low-quality data that differs too much from the real data is screened out through an evaluation mechanism, thereby ensuring the quality and effectiveness of the data set and avoiding the impact of the model training effect due to the introduction of too much noise data. This evaluation mechanism can effectively retain high-quality and diverse samples and eliminate low-quality samples by setting threshold screening. It improves objectivity and automation capabilities, avoids the subjective influence of manual evaluation, and improves efficiency. Using the screened high-quality data to train the model can enable the model to continuously optimize its ability to generate high-quality samples during the training process, further improving the quality and diversity of the generated samples. This iterative optimization process makes the data set expansion method more efficient and flexible, and can adapt to a variety of different data sets and model structures. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0017] Figure 1 A flowchart of a data set expansion method provided by an embodiment of the present disclosure;

[0018] Figure 2 A structural block diagram of a data set expansion device provided by an embodiment of the present disclosure;

[0019] Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.

[0021] In order to make the purpose, technical solutions and advantages of the present disclosure more clear, specific embodiments will be described below in conjunction with the accompanying drawings.

[0022] Please refer to Figure 1 , Figure 1 A flowchart of a data set expansion method provided in an embodiment of the present disclosure is provided. The method may include S101 to S104.

[0023] S101: Generate first sample data based on a first language model.

[0024] In this embodiment, the first language model may include a pre-trained language model, and the first sample data may include a synthetic data set.

[0025] Exemplarily, the first language model may include a pre-trained Generative Pre-trained Transformer 4 (GPT-4) language model. The sample data may include simulated or predicted text and image data. Real data may be input into the GPT-4 language model for training, and feature information of the real data and the relationship between features may be learned to obtain a trained GPT-4 language model. The trained GPT-4 language model may be used to generate sample data similar to the real data.

[0026] S102: Add the first sample data to a data set containing the second sample data, and filter out the third sample data from the data set. The second sample data is real data, and the third sample data is data in the first sample data whose correlation with the real data is less than a first threshold.

[0027] In this embodiment, the third sample data may include low-quality sample data that has been screened out. The first threshold may include a preset threshold for screening out low-quality sample data that does not reach the preset threshold. The generated first sample data is added to a data set of second sample data containing real data, and data whose correlation with the real data is less than the first threshold is screened out from the mixed data set through comparative calculation. This ensures that the generated data has a certain degree of diversity while avoiding being too similar to the real data and losing the meaning of expansion.

[0028] Exemplarily, through the designed evaluation mechanism, the quality score of each candidate sample is evaluated, low-quality samples are filtered out, and high-quality samples are retained as the final synthetic data set. The evaluation mechanism can include two main indicators. One is the quality score, which is used to measure the degree of fit between the sample and the real data distribution. The other is the diversity score, which is used to measure the degree of difference between the candidate samples. The final evaluation score can include the weighted sum of the quality score and the diversity score. By setting a threshold, samples with lower evaluation scores can be filtered out to obtain a high-quality and diverse synthetic data set.

[0029] S103: Training the first language model based on fourth sample data. The fourth sample data is data in the data set other than the third sample data.

[0030] In this embodiment, the fourth sample data can be preprocessed, and the processed data can be input into the corresponding language model for training, and the language model can learn the feature information and its relationship in the training data. The trained model is evaluated using appropriate evaluation indicators (such as perplexity, etc.) to ensure the effectiveness and accuracy of the model. The model is iterated and optimized according to the evaluation results, such as adjusting hyperparameters and changing the model structure, to further improve the performance of the model.

[0031] Exemplarily, there is an initial text classification model and a data set containing 2,000 real annotated texts. Using the model, 1,000 text data samples can be generated and added to the original data set. An evaluation criterion (such as text similarity) is defined to calculate the correlation between the newly generated text data samples and the real text. By calculating the similarity between each new text data sample and the real text, texts with a similarity lower than a preset threshold can be screened out. These text data samples are usually very different from the real text, that is, low-quality data. The text classification model is retrained using the remaining text data samples after screening. During the training process, the model can learn more diverse text representations and classification rules. After completing one iteration, the updated model is used again to generate new text data, and the above data screening and model training process is repeated. After multiple iterations, an expanded data set containing thousands or even tens of thousands of text data can be obtained. Using this data set to train the text classification model, it can be expected that the performance of the model on the test set can be significantly improved.

[0032] S104: Return to the step of generating first sample data based on the first language model until the set conditions are met to obtain an expanded data set.

[0033] In this embodiment, the setting condition may include that the performance test result of the first language model reaches a second threshold value. The second threshold value may be a preset threshold value.

[0034] Exemplarily, there is an initial sentiment analysis model and a text data set containing 1,000 real sentiment annotations. The model can be used to generate 1,000 text data samples with sentiment labels and add them to the original data set. Use a certain difference measurement algorithm (such as cosine similarity) to filter out samples with a correlation with real data less than 0.5 from the mixed data set to obtain 400 filtered data. The 400 data samples are filtered out from the 1,000 text data samples with sentiment labels, and the sentiment analysis model is retrained using the remaining 600 data. After each model training, the performance of the model is analyzed to obtain a performance test result, and the iteration can be stopped when the performance test result reaches a second threshold. For example, when the iterative optimization process is repeated N times, the performance test result of the language model reaches the second threshold. After repeating this process N times, an expanded data set containing M sample data can be obtained, which is used to train a sentiment analysis model with better performance.

[0035] It can be concluded from the above that this embodiment screens out low-quality data that is too different from the real data through the evaluation mechanism, thereby ensuring the quality and effectiveness of the data set and avoiding the influence of the model training effect due to the introduction of too much noise data. This evaluation mechanism can effectively retain high-quality and diverse samples and eliminate low-quality samples by setting threshold screening. It improves objectivity and automation capabilities, avoids the subjective influence of manual evaluation, and improves efficiency. Using the screened high-quality data to train the model can enable the model to continuously optimize its ability to generate high-quality samples during the training process, further improving the quality and diversity of the generated samples. This iterative optimization process makes the data set expansion method more efficient and flexible, and can adapt to a variety of different data sets and model structures.

[0036] In one embodiment of the present disclosure, filtering out third sample data from a data set includes:

[0037] The data set is input into the second language model to obtain the perplexity corresponding to each first sample data in the data set. The perplexity is the perplexity of the second language model for each first sample data.

[0038] The semantic distance between each first sample data and the second sample data is calculated to obtain a first semantic distance corresponding to each first sample data.

[0039] Calculate the information entropy of each first sample data.

[0040] The first evaluation value corresponding to each first sample data is calculated based on the perplexity of each first sample data, the first semantic distance corresponding to each first sample data and the information entropy of each first sample data. The first evaluation value is used to characterize the association between the first sample data and the second sample data.

[0041] The third sample data is screened out from the data set based on the first evaluation value.

[0042] In this embodiment, the data set is input into the second language model to obtain the perplexity corresponding to each first sample data in the data set. The perplexity is the perplexity of the second language model for each first sample data. The perplexity of the language model can be used to measure grammatical correctness.

[0043] Exemplarily, the calculation formula of perplexity is:

[0044]

[0045] in, represents the first sample data, represents the number of samples in the first sample data, represents the i-th sample, represents the predicted probability of the i-th sample.

[0046]

[0047] in, Represents real data, represents the number of samples in the real data, represents the i-th sample, represents the predicted probability of the i-th sample.

[0048] The semantic correctness evaluation value of the sample data can be calculated by the perplexity of the language model for the input sample data. For example, different perplexities can correspond to different semantic correctness evaluation values.

[0049] In this embodiment, the information entropy of each first sample data is calculated. The information entropy calculation process may include counting the occurrence frequency of each text block in the sample data, calculating the probability distribution of each text block in the sample data, and calculating the information entropy of the sample data using the information entropy formula.

[0050] The calculation formula of information entropy is:

[0051]

[0052] in, represents the information entropy of the first sample data, X represents the text block in the sample data, represents the i-th sample, It represents the probability of a text block appearing in the sample data, and n represents the number of different text blocks in the sample data.

[0053] The information richness evaluation value of the sample data can be obtained according to the calculated information entropy. For example, different information entropies can correspond to different information richness evaluation values.

[0054] In this embodiment, the semantic distance between each first sample data and the second sample data is calculated to obtain the first semantic distance corresponding to each first sample data. Semantic coherence can be evaluated by the semantic similarity between the sample data and the real data. The calculation of semantic similarity can be converted into the calculation of semantic distance between samples.

[0055] Exemplarily, for each sample data, the semantic distance between it and multiple real data is calculated, and the semantic distances of all sample data and multiple real data are summed to obtain the sum of the semantic distances of the sample data and the real data. The semantic similarity can be calculated based on the semantic distance, for example, different semantic distances can correspond to different semantic similarities. The semantic coherence evaluation value can be calculated based on the semantic similarity, for example, different semantic similarities can correspond to different semantic coherence evaluation values.

[0056] In this embodiment, the first evaluation value corresponding to each first sample data is calculated based on the perplexity of each first sample data, the first semantic distance corresponding to each first sample data, and the information entropy of each first sample data.

[0057] Exemplarily, based on the perplexity, semantic distance and information entropy of the sample data, the semantic correctness evaluation value, semantic coherence evaluation value and semantic richness evaluation value of the sample data are calculated respectively. The semantic correctness evaluation value, semantic coherence evaluation value and semantic richness evaluation value of the sample data are weighted and summed to obtain a first evaluation value, which can be used to filter out sample data whose evaluation value is lower than a preset threshold.

[0058] This embodiment proposes an evaluation mechanism based on a language model, which can effectively retain high-quality and diverse samples and eliminate low-quality samples by setting a threshold for sample data. This evaluation method is objective and automated, and can avoid the subjectivity and inefficiency of manual evaluation.

[0059] In one embodiment of the present disclosure, filtering out third sample data from the data set based on the first evaluation value includes:

[0060] The first sample data whose first evaluation value is smaller than the first threshold value is determined as the third sample data.

[0061] Exemplarily, the first evaluation value may include a quality score (Quality Score) of the sample data. The quality score can be used to measure the degree of fit between the sample and the real data distribution. Some samples can be randomly selected from the real data set and mixed into a set with the candidate samples to be evaluated. A well-trained language model is used to estimate the probability of the mixed set, and the predicted probability of the real sample should be higher than that of the candidate sample. Based on the above steps, a quality score function can be defined to evaluate the quality of each candidate sample. When the quality score of the sample data is less than a preset threshold, it is a low-quality data sample and is classified as the third sample data.

[0062] This embodiment can comprehensively and objectively measure the semantic quality of sample data by evaluating the semantic correctness, coherence and richness of sample data, thereby ensuring the accuracy and availability of data. In addition, the weighted summation method can adjust the weights of various evaluation indicators according to actual needs, so that the evaluation results are more in line with specific application scenarios. By setting a preset threshold, sample data with low semantic quality can be quickly screened out, improving data processing efficiency and data quality.

[0063] In an embodiment of the present disclosure, calculating the semantic distance between each first sample data and the second sample data includes: calculating the semantic distance between each first sample data and the second sample data based on cosine similarity.

[0064] For example, in an intelligent customer service system, in order to improve the accuracy and diversity of automatic replies, it is necessary to build a high-quality dialogue data set. This data set includes a series of sample pairs of user questions and system replies, where the first sample data can represent user questions and the second sample data can represent corresponding system replies. A large number of user questions and system replies are screened out from historical dialogue records to form an initial data set. Semantic distance is used as a metric. When calculating the semantic distance, each user question and the corresponding system reply can be converted into a vector representation, for example, encoded using a BERT model. The cosine similarity between these vectors is calculated. The lower the cosine similarity, the greater the semantic distance between the two samples, that is, the greater their semantic difference. According to the semantic distance between each sample pair in the data set, the sample data is screened and optimized to ensure that the final data set contains both high-quality replies and rich diversity to meet the needs of the intelligent customer service system.

[0065] The cosine similarity used in this embodiment is an efficient measurement method that can quickly calculate the angle between two text vectors, thereby reflecting the semantic difference between them. This method does not rely on a specific vocabulary or syntactic structure and can capture the deep semantic information of the text. By calculating the semantic distance by cosine similarity, more semantically rich and diverse sample data can be screened out, improving the quality of the data set and the generalization ability of the model.

[0066] In one embodiment of the present disclosure, filtering out third sample data from the data set further includes:

[0067] The semantic distance between every two adjacent first sample data in the data set is calculated to obtain a plurality of second semantic distances.

[0068] The second evaluation value is obtained by summing up the multiple second semantic distances.

[0069] The first evaluation value and the second evaluation value are weightedly summed to obtain a third evaluation value.

[0070] The third sample data is screened out from the data set based on the third evaluation value.

[0071] In this embodiment, the second evaluation value may include a diversity score of the sample data, which is used to measure the difference between the candidate sample data.

[0072] Exemplarily, a diversity score function can be defined. In this method, the semantic distance between samples can be calculated using the cosine similarity based on sentence BERT (Bidirectional Encoder Representations from Transformers) embedding. For example, BERT is embedded in each sample, and the cosine similarity between the samples is calculated. The similarity is converted into a semantic distance, where the semantic distance of each two closest sample data can be selected. All calculated semantic distances are normalized or weighted summed to obtain a diversity score.

[0073] In this embodiment, the first evaluation value and the second evaluation value are weightedly summed to obtain the third evaluation value.

[0074] Exemplarily, the calculated quality score and diversity score may be weighted and summed to obtain an overall evaluation value for evaluating the quality of the sample data.

[0075] This embodiment calculates the semantic distance between every two adjacent sample data in the data set and sums them up to obtain the second evaluation value. This step effectively measures the diversity of samples in the data set. Combined with the first evaluation value (for sample quality or accuracy evaluation), the third evaluation value is obtained by weighted summation, which can more comprehensively evaluate the overall quality of the data set. The screening process based on the third evaluation value can ensure that the selected third sample data has both high-quality sample features and sufficient diversity, which has a significant beneficial effect on improving the generalization ability of the model.

[0076] In one embodiment of the present disclosure, before returning to execute the step of generating first sample data based on the first language model, the method further includes:

[0077] The prompt words for the third sample data are input into the trained first language model.

[0078] In this embodiment, the third sample data is low-quality sample data, which is input into the first language model together with the preset prompt word for training to generate corresponding high-quality sample data.

[0079] Exemplarily, in order to allow the results of model evaluation to provide valuable feedback information for further optimization of the data set. In this step, the model's error cases on the test set, that is, low-quality third sample data, can be collected and analyzed, and focus on those data samples with higher error rates. For these error samples, we input them into the language model to extract the corresponding feature information. When generating candidate data samples, the feature information extracted from the error cases can be used to optimize the generation conditions. For example, using causal relationship prompts, keyword prompts, etc., set the corresponding prompt words to be input into the language model, so that the language model can better understand the semantics and structure of the data, thereby generating improved data samples that are closer to the actual distribution to replace the original error samples. By optimizing the generation conditions, the risk of the language model generating low-quality or irrelevant data can be reduced, thereby improving the overall quality of the generated data.

[0080] For example, in a natural language processing sentiment analysis project, a technician trained a model to identify sentiment tendencies in text. After the model training is completed, the model can be evaluated using a test set, and it is found that the prediction results of some third sample data are greatly deviated from the actual labels, that is, these samples are incorrectly classified by the model. For these erroneous samples, in-depth analysis is conducted, and it is found that these samples are more complex or ambiguous in emotional expression. In order to optimize the data set, key feature information such as specific vocabulary, phrases or sentence structures can be extracted from these erroneous samples. When generating new candidate data samples, these feature information can be used to set prompt words. For example, for samples expressing positive emotions, keywords such as "feel happy" and "like" can be set as prompt words, and for samples expressing negative emotions, keywords such as "feel disappointed" and "dislike" can be used. These prompt words are input into the trained language model to generate new data samples. These new samples are more explicit in emotional expression and are closer to the actual distribution than the original erroneous samples.

[0081] This embodiment can reduce the risk of a language model generating low-quality or irrelevant data by optimizing the generation conditions, thereby improving the overall quality of the generated data.

[0082] In one embodiment of the present disclosure, training the first language model based on the fourth sample data includes:

[0083] A training set and a test set are obtained based on the fourth sample data.

[0084] The first language model is trained based on the training set.

[0085] The first language model is tested according to the test set to obtain a first language model performance test result.

[0086] The set condition is that the performance test result reaches a second threshold.

[0087] In this embodiment, obtaining the training set and the test set based on the fourth sample data may include dividing the fourth sample data into a training set and a test set according to a certain strategy (such as random sampling, time series division, etc.). The training set is used to train the model, and the test set is used to evaluate the performance of the model.

[0088] In this embodiment, training the first language model according to the training set may include the language model learning the inherent rules and characteristics of the sample data and adjusting its own parameters. Testing the first language model according to the test set to obtain the first language model performance test result may include testing the model using the test set after the model training is completed. By comparing the predicted results of the model on the test set with the actual results, we can obtain the performance evaluation results of the model, that is, the first language model performance test results.

[0089] In this embodiment, the condition is set that the performance test result reaches the second threshold. A performance threshold can be set. When the performance evaluation result of the model on the test set reaches or exceeds this threshold, the model training is considered successful, the iteration process is stopped, and it is used for practical applications. Otherwise, the model structure or parameters need to be adjusted and the training process continues to be iterated.

[0090] For example, a laboratory is developing a chatbot for intelligent customer service, which needs to be able to understand and answer users' natural language questions. In this case, a large number of chat records between users and customer service can be used to train a language model so that it can simulate the behavior and answers of human customer service. For example, there are 1 million chat records between users and customer service. 900,000 are randomly selected as the training set, and the remaining 100,000 are used as the test set. Use the training set to train the language model until the performance of the model on the validation set is stable. Use the test set to test the model and obtain its performance evaluation results in real scenarios. If the result reaches the threshold we set (such as an accuracy rate of more than 90%), the model can be deployed in the intelligent customer service system.

[0091] This embodiment ensures the scientificity and rigor of the model training process. By dividing the training set and the test set, the actual application scenario can be simulated to effectively test the generalization ability of the model. Setting the second threshold as the performance judgment standard can ensure that the final model has sufficient accuracy and reliability.

[0092] Corresponding to a data set expansion method in the above embodiment, Figure 2 This is a structural block diagram of a data set expansion device 20 provided in an embodiment of the present disclosure. For ease of description, only the parts related to the embodiment of the present disclosure are shown. Figure 2 , a data set expansion device 20 comprises:

[0093] The first calculation module 21 is used to generate first sample data based on the first language model.

[0094] The second calculation module 22 is used to add the first sample data to the data set containing the second sample data, and filter out the third sample data from the data set. The second sample data is real data, and the third sample data is data in the first sample data whose correlation with the real data is less than a first threshold.

[0095] The third calculation module 23 is used to train the first language model based on fourth sample data. The fourth sample data is data in the data set other than the third sample data.

[0096] The fourth calculation module 24 is used to return to the step of generating the first sample data based on the first language model until the set condition is met to obtain the expanded data set.

[0097] In one embodiment of the present disclosure, the second calculation module 22 includes:

[0098] The first calculation unit is used to input the data set into the second language model to obtain the perplexity corresponding to each first sample data in the data set. The perplexity is the perplexity of the second language model for each first sample data.

[0099] The semantic distance between each first sample data and the second sample data is calculated to obtain a first semantic distance corresponding to each first sample data.

[0100] Calculate the information entropy of each first sample data.

[0101] The first evaluation value corresponding to each first sample data is calculated based on the perplexity of each first sample data, the first semantic distance corresponding to each first sample data and the information entropy of each first sample data. The first evaluation value is used to characterize the association between the first sample data and the second sample data.

[0102] The third sample data is screened out from the data set based on the first evaluation value.

[0103] In an embodiment of the present disclosure, the first calculation unit is specifically configured to determine first sample data whose first evaluation value is less than a first threshold as the third sample data.

[0104] In an embodiment of the present disclosure, the first calculation unit is further configured to calculate a semantic distance between each first sample data and the second sample data based on cosine similarity.

[0105] In an embodiment of the present disclosure, the first calculation unit is further configured to calculate a semantic distance between every two adjacent first sample data in the data set to obtain a plurality of second semantic distances.

[0106] The second evaluation value is obtained by summing up the multiple second semantic distances.

[0107] The first evaluation value and the second evaluation value are weightedly summed to obtain a third evaluation value.

[0108] The third sample data is screened out from the data set based on the third evaluation value.

[0109] In one embodiment of the present disclosure, a data set expansion device 20 further includes:

[0110] The fifth calculation module is used to input the prompt word for the third sample data into the trained first language model before returning to execute the step of generating the first sample data based on the first language model.

[0111] In one embodiment of the present disclosure, the third calculation module 23 is specifically configured to obtain a training set and a test set based on the fourth sample data.

[0112] The first language model is trained based on the training set.

[0113] The first language model is tested according to the test set to obtain a first language model performance test result.

[0114] The set condition is that the performance test result reaches a second threshold.

[0115] See also Figure 3 , Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. Figure 3 The electronic device 300 in the embodiment shown may include: one or more processors 301, one or more input devices 302, one or more output devices 303 and one or more memories 304. The processors 301, input devices 302, output devices 303 and memories 304 communicate with each other via a communication bus 305. The memory 304 is used to store computer programs, which include program instructions. The processor 301 is used to execute the program instructions stored in the memory 304. The processor 301 is configured to call the program instructions to execute the functions of each module / unit in the above-mentioned device embodiments, such as Figure 2 The functions of modules 21 to 24 are shown.

[0116] It should be understood that in the embodiment of the present disclosure, the processor 301 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0117] The input device 302 may include a touch panel, a fingerprint collection sensor (for collecting the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 303 may include a display (LCD, etc.), a speaker, etc.

[0118] The memory 304 may include a read-only memory and a random access memory, and provide instructions and data to the processor 301. A portion of the memory 304 may also include a non-volatile random access memory. For example, the memory 304 may also store information about the device type.

[0119] In a specific implementation, the processor 301, input device 302, and output device 303 described in the embodiments of the present disclosure can execute the implementation methods described in the first and second embodiments of a data set expansion method provided in the embodiments of the present disclosure, and can also execute the implementation methods of the electronic device described in the embodiments of the present disclosure, which will not be repeated here.

[0120] In another embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by the processor, all or part of the processes in the above-mentioned embodiment method are implemented, and the computer program can also be completed by instructing the relevant hardware through the computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0121] The computer-readable storage medium may be an internal storage unit of the electronic device of any of the aforementioned embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0122] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.

[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the electronic devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0124] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces or units, or it can be an electrical, mechanical or other form of connection.

[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present disclosure.

[0126] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0127] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present disclosure, and these modifications or replacements should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A data set expansion method, characterized in that: include: Generate first sample data based on the first language model; the first sample data includes simulated or predicted text and image data; Add the first sample data to a data set containing the second sample data, and filter out third sample data from the data set; the second sample data is real data, and the third sample data is data in the first sample data whose correlation with the real data is less than a first threshold; The step of filtering out the third sample data from the data set includes: Inputting the data set into a second language model to obtain the perplexity corresponding to each first sample data in the data set; the perplexity is the perplexity of the second language model for each first sample data; Calculating the semantic distance between each of the first sample data and the second sample data to obtain a first semantic distance corresponding to each of the first sample data; Calculating the information entropy of each of the first sample data; Calculate a first evaluation value corresponding to each of the first sample data based on the perplexity of each of the first sample data, the first semantic distance corresponding to each of the first sample data, and the information entropy of each of the first sample data; the first evaluation value is used to characterize the association between the first sample data and the second sample data; Filtering third sample data from the data set based on the first evaluation value; Training the first language model based on fourth sample data; the fourth sample data is data in the data set other than the third sample data; Return to the step of generating the first sample data based on the first language model until the set condition is met to obtain an expanded data set.

2. A data set expansion method as claimed in claim 1, characterized in that: The step of selecting third sample data from the data set based on the first evaluation value includes: The first sample data having a first evaluation value smaller than the first threshold is determined as the third sample data.

3. A data set expansion method as claimed in claim 1, characterized in that: The calculating the semantic distance between each of the first sample data and the second sample data comprises: The semantic distance between each of the first sample data and the second sample data is calculated based on cosine similarity.

4. A data set expansion method as claimed in claim 1, characterized in that: The step of filtering out the third sample data from the data set further includes: Calculating the semantic distance between every two adjacent first sample data in the data set to obtain a plurality of second semantic distances; Summing a plurality of said second semantic distances to obtain a second evaluation value; Performing a weighted summation of the first evaluation value and the second evaluation value to obtain a third evaluation value; The third sample data is filtered out from the data set based on the third evaluation value.

5. A data set expansion method as claimed in claim 1, characterized in that: Before returning to execute the step of generating first sample data based on the first language model, the method further includes: The prompt words for the third sample data are input into the trained first language model.

6. A data set expansion method as claimed in claim 1, characterized in that: The training of the first language model based on the fourth sample data includes: Obtaining a training set and a test set based on the fourth sample data; Training the first language model according to the training set; Testing the first language model according to the test set to obtain a performance test result of the first language model; The set condition is that the performance test result reaches a second threshold.

7. A data set expansion device, characterized in that: include: A first calculation module, configured to generate first sample data based on a first language model; The first sample data includes simulated or predicted text and image data; A second calculation module is used to add the first sample data to a data set containing the second sample data, and filter out third sample data from the data set; the second sample data is real data, and the third sample data is data in the first sample data whose correlation with the real data is less than a first threshold; The second calculation module includes: a first calculation unit, used to input the data set into a second language model to obtain the perplexity corresponding to each first sample data in the data set; the perplexity is the perplexity of the second language model for each first sample data; Calculating the semantic distance between each of the first sample data and the second sample data to obtain a first semantic distance corresponding to each of the first sample data; Calculating the information entropy of each of the first sample data; Calculate a first evaluation value corresponding to each of the first sample data based on the perplexity of each of the first sample data, the first semantic distance corresponding to each of the first sample data, and the information entropy of each of the first sample data; the first evaluation value is used to characterize the association between the first sample data and the second sample data; Filtering out third sample data from the data set based on the first evaluation value; A third computing module, configured to train the first language model based on fourth sample data; the fourth sample data is data in the data set other than the third sample data; The fourth calculation module returns to the step of generating the first sample data based on the first language model until the set conditions are met to obtain an expanded data set.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Language-model-based data augmentation method for textual classification tasks with little data

    US20210350076A1