Adaptive resampling method and device for synthetic and real data, and electronic device
By using an adaptive resampling method, the problems of distribution bias and sample bias in training with a mixture of synthetic and real data are solved, thereby improving the model training efficiency and generalization performance. This method is suitable for large language models and vertical domain tasks.
Patent Information
- Application Number
- CN202610289527.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-26
- Estimated Expiration
- 2046-03-11
AI Technical Summary
Existing technologies struggle to accurately characterize the distribution bias and sample bias among multiple data sources when training with a mixture of synthetic and real data. This results in low efficiency in utilizing training resources and limited improvement in model performance.
By acquiring training datasets from multiple data sources, performing unified preprocessing and feature representation, calculating distribution bias and sample bias features, dynamically adjusting resampling strategies, constructing a bias-free training sample set, and performing multiple rounds of optimization based on model training feedback.
It achieves adaptive optimization of data distribution in large language model training, improving model training efficiency and generalization performance, and is suitable for vertical domain tasks.
Smart Images

Figure CN121808748B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence and natural language processing technology, and in particular relates to an adaptive resampling method and apparatus for synthetic and real data, and electronic equipment. Background Technology
[0002] With the widespread application of machine learning models, especially large-scale deep learning models and large language models, the scale and quality of training data have an increasingly significant impact on model performance. In practical applications, to reduce data acquisition costs and improve coverage, training datasets are often constructed using both real and synthetic data. For example, synthetic data can be automatically constructed through rule generation, simulation systems, or generative models to supplement scenarios and samples that are difficult to cover in real data.
[0003] However, synthetic data and real data often differ significantly in terms of generation mechanisms, distribution characteristics, and semantic structure. Synthetic data typically has a regular structure, low noise, but a uniform distribution, while real data contains more noise, incomplete information, and complex long-tailed distributions. Directly mixing these multi-source data for model training can easily introduce data distribution bias and sample bias problems, thereby affecting the model's generalization ability and practical application performance.
[0004] To alleviate the problem of imbalanced data distribution, existing technologies often employ oversampling, undersampling, or weighted sampling to process training data. However, these methods are mostly based on static statistical features or preset proportion rules, making it difficult to accurately characterize the deep distributional differences between different data sources, and they also cannot dynamically adjust sampling strategies based on feedback during model training. Existing technologies typically ignore the impact of model training status on data sampling strategies, lacking a mechanism that can dynamically debias and adaptively resample multi-source data by incorporating model training feedback. This results in low efficiency in training resource utilization and limited model performance improvement.
[0005] Therefore, how to accurately characterize the distribution bias and sample bias among multiple data sources in training scenarios where synthetic and real data coexist, and on this basis, achieve adaptive resampling and debiasing to improve model training efficiency and generalization performance, has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0006] The purpose of this invention is to provide an adaptive resampling method, apparatus, and electronic device for synthetic and real data, which can enhance and optimize the generalization performance of data in vertical domains, and help adaptive resampling and bias removal of training data for large language models, so as to improve model training efficiency and generalization performance.
[0007] According to a first aspect of the embodiments of this application, an adaptive resampling method for synthetic and real data is provided, characterized in that it includes:
[0008] S1: Obtain training datasets from large language models and multiple data sources in vertical domains, including at least synthetic data sources and real data sources;
[0009] S2: Perform unified preprocessing on the training datasets from the multiple data sources to construct a unified data representation set;
[0010] S3: Based on the unified data representation set, and combined with the training data feature requirements of the vertical domain, calculate the distribution deviation and sample bias features between different data sources;
[0011] S4: Calculate the debiasing weight and resampling probability for each sample based on the distribution bias and sample bias characteristics.
[0012] S5: Based on the debiasing weights and resampling probabilities, perform adaptive resampling on the training datasets from multiple data sources to construct a debiased training sample set;
[0013] S6: Use the bias-reduced training sample set to train and update the large language model and multiple data sources in the vertical domain, and dynamically adjust the resampling strategy based on the model training feedback, thereby realizing multi-round adaptive bias-reduction and resampling optimization of the data, and obtaining data that can be used for the large language model and vertical domain after adaptive bias-reduction and resampling optimization.
[0014] According to a second aspect of the application embodiments, an adaptive resampling apparatus for synthesized and real data is provided, characterized in that it includes:
[0015] The data acquisition module is used to acquire training datasets from large language models and multiple data sources in vertical domains, wherein the data sources include at least synthetic data sources and real data sources;
[0016] The feature construction module is used to perform unified preprocessing on the training datasets from the multiple data sources to construct a unified data representation set;
[0017] The deviation modeling module is used to calculate the distribution deviation and sample bias characteristics between different data sources based on the unified data representation set and the training data feature requirements of the vertical domain.
[0018] The debiasing weight calculation module is used to calculate the debiasing weight and resampling probability of each sample based on the distribution bias and sample bias characteristics.
[0019] An adaptive resampling module is used to perform adaptive resampling on training datasets from multiple data sources based on the debiasing weights and resampling probabilities to construct a debiased training sample set.
[0020] The feedback update module is used to train and update the large language model and multiple data sources in the vertical domain using the bias-reduced training sample set, and dynamically adjust the resampling strategy based on the model training feedback, thereby realizing multi-round adaptive bias-reduction and resampling optimization of the data, and obtaining data that can be used for the large language model and vertical domain adaptive bias-reduction and resampling optimization.
[0021] According to a third aspect of the embodiments of this application, an electronic device is provided, comprising:
[0022] One or more processors;
[0023] Memory, used to store one or more programs;
[0024] When the one or more programs are executed by the one or more processors, the one or more processors perform the method as described in the first aspect.
[0025] According to a third aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described in the first aspect.
[0026] Compared with the prior art, the embodiments of the present invention have at least the following beneficial effects:
[0027] By combining the characteristic requirements of training data in vertical domains, the distribution bias and sample bias features between different data sources are calculated, and the debiasing weight and resampling probability of each sample are calculated. Adaptive resampling is then performed on the dataset, thereby effectively optimizing the subsequent model training at the data level. Based on the debiased training sample set, joint training and iterative updates are performed on the large language model and multiple data sources in the vertical domain, realizing multi-round adaptive debiasing and resampling optimization of the data. Finally, an adaptive debiasing and resampling optimized dataset that can serve both the large language model and vertical domain tasks is obtained. Attached Figure Description
[0028] Figure 1 This is a flowchart illustrating an adaptive resampling method for synthesized and real data according to an exemplary embodiment.
[0029] Figure 2 This is a block diagram illustrating an adaptive resampling device for synthesized and real data according to an exemplary embodiment.
[0030] Figure 3 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0031] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0032] Figure 1 This is a flowchart illustrating an adaptive resampling method for synthetic and real data according to an exemplary embodiment. This example uses a large-scale intelligent question-answering model and a vertical education field as case studies, but it is not limited to these. (See references.) Figure 1 An adaptive resampling method for synthetic and real data provided in this embodiment of the invention may include:
[0033] S1: Obtain training datasets from large language models and multiple data sources in vertical domains, including at least synthetic and real data sources:
[0034] S11: Obtain synthetic data generated by rules, models, or simulations, wherein the synthetic data comes from training datasets of large language models and multiple data sources in the vertical domain;
[0035] Specifically, in this example, the method of the present invention is applied to an intelligent question-answering system in the field of education. During the system training phase, both real data and synthetic data are used. The real data comes from real user question inquiry logs and manually compiled questions and answers, while the synthetic data is a question-answer sample constructed through rule templates and generation models.
[0036] S12: Obtain real data from real business systems, customer service Q&A logs within the domain, user interaction logs, or manually collected data;
[0037] Specifically, the data obtained includes real data from actual teaching business systems, software question-and-answer logs in the education field, user interaction logs, or manually collected data. In this example, the real data includes, but is not limited to: student questions and teacher answers generated by online teaching platforms, homework systems, or Q&A systems; question-searching records, problem-solving step display logs, and user click feedback information generated by educational software during actual operation; multi-round dialogue interaction logs of users in intelligent question-and-answer systems; and high-quality question-and-answer samples that have been manually screened, labeled, and verified.
[0038] During the collection process, the user identity information of the aforementioned real data was anonymized, and invalid samples, duplicate samples, and noisy data were removed according to preset data cleaning rules to ensure the accuracy and compliance of the training data.
[0039] S13: Assign data source identifiers to data from different sources to distinguish synthetic data from real data;
[0040] Specifically, in this example, a corresponding data source identifier field is introduced for each training sample. The data source identifier is used to indicate whether the sample comes from a synthetic data source or a real data source, and further distinguishes the specific data acquisition method, generation strategy or business system source. The data source identifier, as additional feature information of the sample, participates in the subsequent data distribution modeling, debiasing weight calculation and resampling probability calculation process, so that the model can identify and model the distribution differences and bias features between different data sources during the training process.
[0041] Data source identifier It can be represented as:
[0042]
[0043] in i Represents the first in-sample dataset i Data, if A value of 1 indicates a real data source, while a value of 0 indicates a synthetic data source.
[0044] S14: Combine the real data and the synthetic data to form a training dataset.
[0045] S2: Perform unified preprocessing on the training datasets from the multiple data sources and construct a unified data representation set, including the following sub-steps:
[0046] S21: Perform data cleaning and format normalization on training datasets from multiple data sources;
[0047] Specifically, preprocessing operations such as text denoising, format standardization, long text truncation and sliding window splitting, and standardized question-answering structure are performed on all training set samples. The samples are then structurally decomposed, and semantic features, task features, and statistical features are extracted using Transformer. The data source identifier is jointly encoded with the aforementioned features to construct the basic feature representation of the samples.
[0048] S22: The data format of the training datasets from multiple cleaned data sources is unified to obtain a unified data representation set consisting of question text, context document, answer text, and data source identifiers;
[0049] Specifically, a unified data representation set Represented as:
[0050]
[0051] in Indicates the problem text. This indicates the retrieved context document. This represents the answer text. Indicates the data source identifier.i Represented as the first in the current dataset i Data entries.
[0052] Obtain the real data source respectively With synthetic data This constitutes a unified data representation set. D :
[0053]
[0054] S3: Based on the unified data representation set and considering the training data feature requirements of the vertical domain, calculate the distribution deviation and sample bias features between different data sources, including the following sub-steps:
[0055] S31: Estimate the distribution characteristics of the unified data representation of the synthetic data and the real data in the feature space respectively, and extract the semantic representation of the samples based on the distribution characteristics;
[0056] Specifically, considering the characteristics and needs of training data in the education field, this example focuses on a unified data representation set. D The question text, context document, and answer text are used to encode the features of the samples using a pre-trained language model to obtain corresponding high-dimensional semantic vector representations; wherein, the semantic vectors contain at least representational information on the semantic difficulty of the question, the scope of knowledge points covered, the question type structure, and the contextual dependencies;
[0057] Furthermore, based on the data source identifiers of the samples, the distribution characteristics of synthetic and real data in the feature space are estimated respectively, and the semantics of the samples are extracted using the encoder part of the current large language model. Represented as:
[0058]
[0059] in Indicates the problem text. This indicates the retrieved context document. i Represented as the first in the current dataset i Data entries.
[0060] S32: Based on the semantic representation of the sample, construct a statistical feature vector to obtain the basic feature representation;
[0061] Specifically, construct statistical feature vectors to obtain sample statistical features. :
[0062]
[0063] in, len This indicates that the text length is being calculated. rarity This indicates that the rarity of the text is calculated.
[0064] Obtain joint encoding of data sources, and final sample basic features Represented as:
[0065]
[0066] in This indicates the data source identifier, which can be divided into real data and synthetic data.
[0067] S33: Based on the basic characteristics of the samples, calculate the distribution deviation and sample bias characteristics between different data sources;
[0068] Specifically, through the basic features of the samples Obtain sample bias features :
[0069]
[0070] Further, discriminative modeling is performed using the data source to train a binary classification model to distinguish sample sources. This model is mainly used for bias estimation and does not participate in the training of the main model. The sample bias is calculated through the model. :
[0071]
[0072] The degree to which a sample is more likely to be identified as synthetic or real data is used as a metric for sample bias, defining sample distribution bias. for:
[0073]
[0074] A distribution bias approaching 0 indicates that the sample is close to a true-synthetic mixture distribution, while a bias approaching 0.5 indicates that the sample is highly biased towards a particular data source. This degree of bias is used as the basis for sample debiasing modeling.
[0075] S4: Based on the distribution bias and sample bias characteristics, calculate the debiasing weight and resampling probability of each sample, including the following sub-steps:
[0076] S41: Based on the distribution bias and sample bias characteristics, construct sample debiasing weights and design a debiasing weight function;
[0077] Specifically, based on the bias index, sample debiasing weights are constructed. Design the bias removal weight function:
[0078]
[0079] in This is expressed as the depolarization intensity hyperparameter. This is expressed as the distribution bias hyperparameter. i Represented as the first in the current dataset i Data entries.
[0080] S42: Assign weights to data source samples based on the value of the bias removal weighting function;
[0081] Specifically, samples from overly biased data sources are assigned lower weights, while samples from scarce or low-coverage sources are assigned higher weights. In this case, samples from overly biased data sources are assigned a weight of less than 0.5, while samples from scarce or low-coverage sources are assigned a weight of greater than 0.5.
[0082] S43: Normalize the weights to obtain sample debiased weights, and finally perform resampling probability mapping based on the debiased weights to obtain the resampling probability.
[0083] Specifically, the weights are normalized to obtain the sample debiasing weights. :
[0084]
[0085] Finally, resampling probability mapping is performed to create a unified data representation set. resampling probability It can then be expressed as:
[0086]
[0087] S5: Based on the debiasing weights and resampling probabilities, perform adaptive resampling on the multi-source training data to construct a debiased training sample set;
[0088] Specifically, a resampling method with replacement is adopted. Under the premise of ensuring data diversity constraints, the sampling ratio of synthetic data and real data is controlled. Training is performed using a large language model, and the biased training sample set is constructed by minimizing the standard training loss.
[0089] The resampling probability of a sample is determined based on the sample debiasing weights, and resampling with replacement is used to obtain a unified representation set of the resampled data. :
[0090]
[0091] To ensure data diversity, and to control the sampling ratio between synthetic and real data, a sampling ratio constraint is introduced:
[0092]
[0093] in The minimum and maximum values representing the sampling ratio are set to 0.2 and 0.8 in this case. This is represented as a unified data representation set. The set of real data sources in the dataset.
[0094] Use the resampled data to represent a unified set Training is performed on a large language model to minimize the standard training loss; after determining the sampling ratio between the synthetic data and the real data, a bias-reduced training sample set is constructed based on the ratio constraint.
[0095] Determine the sampling ratio between the synthetic data and the real data. After that, the biased training sample set can be obtained. Represented as:
[0096]
[0097] in This is represented as a unified data representation set. The synthetic data source representation set in the dataset.
[0098] S6: Using the bias-reduced training sample set, train and update the existing target model in the vertical domain, and dynamically adjust the resampling strategy based on the model training feedback, thereby realizing multi-round adaptive bias-reduction and resampling optimization of the data, and obtaining adaptive bias-reduction and resampling optimized data that can be used for large language models and vertical domains, including the following sub-steps:
[0099] S61: Input the bias-reduced training sample set into the existing target model in the vertical domain. After completing one round of model training, evaluate the performance of the model in the validation set or real application scenario, and construct a resampling feedback signal accordingly.
[0100] Specifically, the bias-free training sample set is input into the existing target model within the vertical domain. In this case, GPT version 5.2 is used, and it is set to an education-oriented question-answering mode to debias the training sample set. Input the model for training and updating, and express the overall accuracy as... Acc The index on the long-tail set is represented as Tail, And a performance evaluation of the large-scale intelligent question-answering model in the field of education:
[0101]
[0102] Evaluate model performance on the real validation set, expressing the overall accuracy as... Acc The index on the long-tail set is represented as Tail , t This indicates the current training phase:
[0103]
[0104]
[0105] in These represent the difference in accuracy between the current training phase and the previous phase, respectively. This represents the index difference on the long-tail set during the current training phase.
[0106] Build feedback signals :
[0107]
[0108] S62: Dynamically adjust the sample debiasing weight or resampling probability according to the feedback signal until the sampling strategy adaptively converges.
[0109] Specifically, based on feedback signals R Adaptive update of bias reduction intensity:
[0110] like R A value less than 0 indicates that the sampling is too aggressive or biased towards the source of error, which in turn indicates the hyperparameter of the debiasing intensity. Distribution bias hyperparameter The value needs to be adjusted, which can be done by adjusting the debiasing intensity hyperparameter factor. Distribution bias hyperparameter factor :
[0111]
[0112] Adjusting the parameter factor makes the sampling smoother and reduces the debiasing intensity.
[0113] like R A value greater than 0 indicates the direction is correct, making it more smooth.
[0114]
[0115] Output updated Then proceed to the next iteration until the sampling strategy adaptively converges.
[0116] After completing one round of model training, evaluate the model's performance on the validation set or in real-world application scenarios, and dynamically adjust the sample debiasing weights or resampling probabilities based on the feedback signals.
[0117] S63: Repeat steps S3-S6, and perform the above resampling and training process through multiple rounds of iteration to gradually reduce the distribution difference between synthetic data and real data until the distribution difference is lower than the threshold and the resampling weight distribution tends to stabilize.
[0118] Specifically, resampling is performed iteratively multiple times to remove bias from the training sample set. The distribution difference between the synthetic data and the real data will be gradually reduced until the difference is within 10%, at which point the resampling weight distribution tends to stabilize. This will ultimately achieve multi-round adaptive debiasing and resampling optimization of the data, resulting in training data that can be better used for intelligent question answering large language models and multiple data sources in the education field.
[0119] Corresponding to the aforementioned embodiments of the adaptive resampling method for synthesized and real data, this application also provides embodiments of an adaptive resampling apparatus for synthesized and real data.
[0120] Figure 2 This is a block diagram illustrating an adaptive resampling method for synthesized and real data according to an exemplary embodiment. (Reference) Figure 2 The device includes:
[0121] Data acquisition module 1 is used to acquire training datasets from large language models and multiple data sources in vertical domains, wherein the data sources include at least synthetic data sources and real data sources;
[0122] Feature construction module 2 is used to perform unified preprocessing on the training datasets from the multiple data sources to construct a unified data representation set;
[0123] The deviation modeling module 3 is used to calculate the distribution deviation and sample bias characteristics between different data sources based on the unified data representation set and the training data feature requirements of the vertical domain.
[0124] The debiasing weight calculation module 4 is used to calculate the debiasing weight and resampling probability of each sample based on the distribution bias and sample bias characteristics.
[0125] The adaptive resampling module 5 is used to perform adaptive resampling on training datasets from multiple data sources based on the debiasing weights and resampling probabilities to construct a debiased training sample set.
[0126] Feedback update module 6 is used to train and update the large language model and multiple data sources in the vertical domain using the bias-removed training sample set, and dynamically adjust the resampling strategy based on the model training feedback, thereby realizing multi-round adaptive bias removal and resampling optimization of the data, and obtaining data that can be used for the large language model and vertical domain after adaptive bias removal and resampling optimization.
[0127] Accordingly, this application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; and, when the one or more programs are executed by the one or more processors, causing the one or more processors to implement an adaptive resampling method for synthesized and real data as described above. Figure 3The diagram shown is a hardware structure diagram of any device with data processing capabilities, which includes an adaptive resampling device for synthesized and real data provided in an embodiment of the present invention. (Except for...) Figure 3 In addition to the processor and memory shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.
[0128] Accordingly, this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the adaptive resampling method for synthesized and real data as described above. The computer-readable storage medium can be an internal storage unit of any data-processing device as described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device of a wind turbine, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data-processing device and external storage devices. The computer-readable storage medium is used to store the computer program and other programs and data required by the data-processing device, and can also be used to temporarily store data that has been output or will be output.
[0129] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.
[0130] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. An adaptive resampling method for synthetic and real data, characterized in that, include: S1: Obtain training datasets from large language models and multiple data sources in vertical domains, including at least synthetic data sources and real data sources; S2: Perform unified preprocessing on the training datasets from the multiple data sources to construct a unified data representation set consisting of question text, context document, and answer text data source identifiers; S3: Based on the unified data representation set and considering the training data feature requirements of the vertical domain, calculate the distribution bias and sample bias features between different data sources; specifically, this includes: estimating the distribution characteristics of synthetic data and real data in the feature space within the unified data representation set; extracting sample semantic representations using the encoder of the current large language model based on these distribution characteristics; constructing statistical feature vectors based on the sample semantic representations to obtain basic feature representations; and calculating the distribution bias and sample bias features between different data sources based on these basic sample features. This includes using data sources for discriminative modeling, training a binary classification model to distinguish sample sources, and calculating sample bias through the model. , , For sample bias features, Indicates the data source identifier. As the basic features of the sample; S4: Calculate the debiasing weight and resampling probability for each sample based on the distribution bias and sample bias characteristics; specifically including: constructing sample debiasing weights based on the distribution bias and sample bias characteristics; designing a debiasing weight function, which includes a debiasing intensity hyperparameter and a distribution bias hyperparameter; assigning weights to data source samples based on the value of the debiasing weight function; normalizing the weights to obtain the sample debiasing weights; and finally, mapping the resampling probability based on the debiasing weights to obtain the resampling probability; the debiasing weight function is... ;in, Remove biased weights from the samples. This is expressed as the depolarization intensity hyperparameter. This is expressed as the distribution bias hyperparameter. i Represented as the first in the current dataset i Data items; This is due to sample distribution bias. S5: Based on the debiasing weights and resampling probabilities, perform adaptive resampling on the training datasets from multiple data sources to construct a debiased training sample set; S6: Use the bias-reduced training sample set to train and update the large language model and multiple data sources in the vertical domain, and dynamically adjust the resampling strategy based on the model training feedback, thereby realizing multi-round adaptive bias-reduction and resampling optimization of the data, and obtaining data that can be used for the large language model and vertical domain after adaptive bias-reduction and resampling optimization.
2. The method according to claim 1, characterized in that, Obtain training datasets from multiple data sources, including large language models and vertical domains, including: Acquire synthetic data generated by rules, models, or simulations, wherein the synthetic data comes from training datasets of large language models and multiple data sources in a vertical domain; Obtain real data from real business systems, customer service Q&A logs within the domain, user interaction logs, or manually collected data; Assign data source identifiers to data from different sources to distinguish synthetic data from real data; The real data and the synthetic data are used to form a training dataset.
3. The method according to claim 1, characterized in that, The training datasets from the multiple data sources are preprocessed uniformly to construct a unified data representation set, including: Perform data cleaning and format normalization on training datasets from multiple data sources; The data of the training datasets from multiple cleaned data sources are represented in a unified format to obtain a unified data representation set consisting of question text, context document, answer text, and data source identifiers.
4. The method according to claim 1, characterized in that, Based on the aforementioned debiasing weights and resampling probabilities, adaptive resampling is performed on the multi-source training data to construct a debiased training sample set, including: By employing a resampling method with replacement, and while ensuring data diversity constraints, the sampling ratio between synthetic and real data is controlled. Training is performed using a large language model, and the biased training sample set is constructed by minimizing the standard training loss.
5. The method according to claim 1, characterized in that, The bias-reduced training sample set is used to train and update a large language model and multiple data sources in vertical domains. The resampling strategy is dynamically adjusted based on model training feedback to achieve multi-round adaptive bias reduction and resampling optimization of the data, resulting in adaptively bias-reduced and resampling optimized data usable for large language models and vertical domains, including: S61: Input the bias-reduced training sample set into the large language model and multiple data sources in the vertical domain. After completing one round of model training, evaluate the performance of the model in the validation set or real application scenarios, and construct a resampling feedback signal accordingly. S62: Dynamically adjust the sample debiasing weight or resampling probability according to the feedback signal until the sampling strategy adaptively converges. S63: Repeat steps S3-S6, and perform the resampling and training process through multiple rounds of iteration to gradually reduce the distribution difference between synthetic data and real data until the distribution difference is lower than the threshold and the resampling weight distribution tends to stabilize.
6. An adaptive resampling device for synthetic and real data, characterized in that, include: The data acquisition module is used to acquire training datasets from large language models and multiple data sources in vertical domains, wherein the data sources include at least synthetic data sources and real data sources; The feature construction module is used to perform unified preprocessing on the training datasets from the multiple data sources to construct a unified data representation set composed of question text, context document, and answer text data source identifiers; The bias modeling module is used to calculate the distribution bias and sample bias features between different data sources based on the unified data representation set and the training data feature requirements of the vertical domain. Specifically, it includes: estimating the distribution characteristics of synthetic data and real data in the feature space within the unified data representation set; extracting sample semantic representations using the encoder of the current large language model based on these distribution characteristics; constructing statistical feature vectors based on the sample semantic representations to obtain basic feature representations; and calculating the distribution bias and sample bias features between different data sources based on these basic feature representations. Specifically, it utilizes data sources for discriminative modeling, training a binary classification model to distinguish sample sources, and calculating sample bias through the model. , , For sample bias features, Indicates the data source identifier. As the basic features of the sample; The debiasing weight calculation module is used to calculate the debiasing weight and resampling probability of each sample based on the distribution bias and sample bias characteristics. Specifically, it includes: constructing sample debiasing weights based on the distribution bias and sample bias characteristics; designing a debiasing weight function, which includes a debiasing intensity hyperparameter and a distribution bias hyperparameter; assigning weights to data source samples based on the value of the debiasing weight function; normalizing the weights to obtain the sample debiasing weights; and finally, mapping the resampling probability based on the debiasing weights to obtain the resampling probability. The debiasing weight function is... ;in, Remove biased weights from the samples. This is expressed as the depolarization intensity hyperparameter. This is expressed as the distribution bias hyperparameter. i Represented as the first in the current dataset i Data items; This is due to sample distribution bias. An adaptive resampling module is used to perform adaptive resampling on training datasets from multiple data sources based on the debiasing weights and resampling probabilities to construct a debiased training sample set. The feedback update module is used to train and update the large language model and multiple data sources in the vertical domain using the bias-reduced training sample set, and dynamically adjust the resampling strategy based on the model training feedback, thereby realizing multi-round adaptive bias-reduction and resampling optimization of the data, and obtaining data that can be used for the large language model and vertical domain adaptive bias-reduction and resampling optimization.
7. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
8. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by the processor, this instruction implements the steps of the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Training sample optimization method, device and equipment and storage medium
CN111401465A
Nuclear power equipment data prediction model building method based on sample migration
CN116108738A
Sample distribution adaptive adjustment method and system based on model training feedback driving
CN120804706A