Passive domain adaptive sample forgetting method based on sample sensitivity
Through sample sensitivity identification and removal of noise samples, combined with federal learning and knowledge distillation technology, the problems of noise samples and privacy protection in model training are solved, and the model's efficient adaptation and performance improvement in the target domain are achieved.
Patent Information
- Application Number
- CN202510456174.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-08-15
AI Technical Summary
In machine learning model training, noise samples and outlier samples affect model performance, and data privacy protection is difficult to balance model performance improvement and privacy protection needs.
The passive domain adaptation sample forgetting method based on sample sensitivity is used to identify and remove samples that have negative impacts on model training by calculating sample sensitivity. Combining federated learning and knowledge distillation technology, the target domain data is used to generate pseudo-labels for model optimization.
Without relying on source domain data, the generalization ability and accuracy of the model in the target domain is improved, while protecting data privacy.
Smart Images

Figure CN120494042A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to federated learning, passive domain adaptation and sample forgetting technology, and specifically to a passive domain adaptation sample forgetting method based on sample sensitivity. Background Art
[0002] In machine learning model training, data diversity and quality play a decisive role in model performance. Rich and diverse data allows models to learn a wide range of features and patterns, effectively improving their generalization capabilities and enabling accurate predictions even when faced with unknown data. However, practical applications present numerous problems. For one thing, some samples contain noise, which can arise from errors in data collection equipment, human input errors, or transmission interference. For example, in image recognition, image blur and noise caused by lighting and sensor issues can severely affect object recognition. Furthermore, outlier samples can differ significantly from the overall data distribution due to unique business scenarios, rare events, or annotation errors. For example, in medical data, abnormal physiological indicators of individual patients can easily lead to model overfitting and reduced generalization ability when included in training. Furthermore, with growing awareness of data privacy protection, data containing sensitive information, such as financial transactions and medical records, can easily lead to privacy leaks if improperly handled during model training, resulting in financial losses and privacy violations for users.
[0003] When identifying and processing bad samples, traditional methods often rely on simple statistical indicators or empirical thresholds, such as calculating the mean and variance of the data, to determine whether the sample is abnormal. However, in high-dimensional and complex data, many samples that are potentially harmful to model performance will be missed. Some samples with ambiguous semantics or deviations from mainstream text features cannot be identified through simple statistics. In terms of data privacy processing, although existing encryption and desensitization technologies can protect privacy, these operations are often "one-size-fits-all", and while protecting privacy, they excessively destroy useful information in the data. Taking medical image data as an example, desensitization overly blurs key areas of the image, making it impossible for the model to extract effective disease features, ultimately causing a significant decline in model performance. It is always difficult to balance the needs of improving model performance and protecting data privacy. Summary of the Invention
[0004] In response to the problems of noise interference in samples during model training in a distributed data environment and difficulty in handling the impact of samples on the model, the present invention discloses a passive domain adaptation sample forgetting method based on sample sensitivity. This method uses an innovative sample sensitivity calculation method to identify samples that have a negative impact or are sensitive to model training, introduces a federated learning architecture, and achieves the collaborative execution of sample forgetting strategies while protecting data privacy. Combined with passive domain adaptation technology, the model can effectively use target domain data for learning and optimization without the need for source domain data. The present invention adopts the following technical solution, and the steps include:
[0005] Step 1: Each client independently trains a local source domain model using its own source domain data. The server aggregates the local models to generate a global source domain model. This federated training process is repeated 10 times and the optimal global model of each iteration is saved.
[0006] Step 2: Use the optimal global source domain model from federated training as the initial model, generate Gaussian noise for each sample multiple times to simulate small perturbations, and input the perturbed samples into the model to calculate the sample sensitivity;
[0007] Step 3: Based on the specific requirements of the initial model training and the characteristics of the data, try different thresholds through experiments, observe the performance of the initial model on the validation set, and select the threshold that can optimize the performance of the initial model or meet specific requirements as the forgetting threshold;
[0008] Step 4: Remove the marked forget samples from the training data set, reorganize the training data, and retrain the initial model using the new training data set. During the training process, record the training loss and accuracy performance indicators of the local model;
[0009] Step 5: If the local model performance does not meet expectations or there is room for improvement, adjust the forgetting threshold based on the evaluation results, and perform the sample sensitivity calculation, sample forgetting operation, and local model training steps again until the local model performance reaches satisfactory results;
[0010] Step 6: The client uses the optimal global model initial target model to generate initial pseudo labels for the local target domain data, generates a teacher model through self-supervised learning, and uses the pseudo labels of the teacher model to guide the learning of the student model. The server aggregates the model and broadcasts it back to the client to complete one round of iteration. The training ends after 10 rounds.
[0011] Furthermore, step 1 specifically includes:
[0012] Assume that the number of clients participating in the training in the federated learning process is N, then N={n1,n2,n3,…,n N}, the source domain data of the i-th client is in, is the input data, Each client uses the last layer of Resnet50 plus the Transformer structure as a pre-training model to train a local source domain model The cross entropy loss function formula (1) is used to express:
[0013]
[0014] By optimizing L ce , each client updates its local model parameters After the local model is trained, the server receives the model parameters from all clients. Where M is the number of clients. The server calculates the global model parameters θ s , its calculation formula is expressed by formula (2):
[0015]
[0016] Assume that after T rounds of iterations, the optimal global model parameters saved are
[0017] Furthermore, step 2 specifically includes:
[0018] The best global source domain model after 10 rounds of federated training For each sample in the training dataset, input it into the global source domain model In the example, the feature representation f is obtained through the feature extractor i =F(x i ), the bottleneck feature b is obtained through the bottleneck layer i =B(f i ), and the final output is obtained through the classifier For each sample x i , perform K perturbation operations. Each time, Gaussian noise ∈ ik ~N(0,σ 2 ), where σ is the standard deviation of Gaussian noise, k = 1, 2, ..., K, and the perturbed samples are expressed as formula (3):
[0019]
[0020] The perturbed sample is input into the global source domain model to calculate the perturbed output. The calculation process is similar to the original output and is expressed using formula (4):
[0021]
[0022] For each sample, calculate the L2 norm difference between the original output and the perturbed output under the kth perturbation and the L2 norm of the perturbation, then calculate the ratio of each perturbation, and take the average of the k perturbations as the sensitivity of the sample. The sample sensitivity is expressed using formula (5):
[0023]
[0024] Among them, ||·||2 represents the L2 norm, r ik is the ratio of each disturbance, s i is the sample sensitivity, ∈ ik is the kth perturbation of the i-th sample.
[0025] Furthermore, step 3 specifically includes:
[0026] According to the proportion of each client to be forgotten, a forgetting threshold τ of sample sensitivity is set. This threshold is used to determine whether the sample should be forgotten. If the sample sensitivity s i If the value is greater than the forgetting threshold, it is considered that the sample may have a greater impact on the global source domain model training or there is a sensitivity risk, and further processing is required. Traverse each sample in the data set and compare its sensitivity with the forgetting threshold. For samples that meet the sample sensitivity s i For samples larger than the forget threshold, they are marked as forget samples, and relevant information is recorded, including the path and label of the sample.
[0027] Furthermore, step 4 specifically includes:
[0028] Remove the marked forget samples from the original training data set to obtain a new training data set D′. Let the marked forget sample set be D forgotten ={x j ,y j}, where s j >τ, then D'=DD forgotten , the global source domain model is retrained using the new training dataset D′.
[0029] The total loss function consists of the sample sensitivity loss function and the classification loss function. The sample sensitivity loss function is used to measure the sensitivity of the model to sample perturbations, prompting the global source domain model to learn more stable and robust features. For a batch of samples, |B| represents the batch size, and the sample sensitivity loss function is expressed using formula (6):
[0030]
[0031] Among them, s i is the sensitivity of the jth sample in the batch. The classification loss function is used to measure the difference between the classification prediction results of the global source domain model and the true label. The cross entropy loss function is used to represent the classification loss. The weights of the two loss functions are balanced by a hyperparameter λ, which is expressed by formula (7):
[0032]
[0033] Among them, λ is a non-negative hyperparameter used to control the importance of sample sensitivity loss in the total loss. ce Denotes the cross entropy loss. Then, the marked forget samples are removed from the training data set, the training data is rearranged, and the model is retrained using the new training data set. The total loss function is minimized by the optimization algorithm stochastic gradient descent SGD, which is expressed by formula (8):
[0034] min θ ∑ (x,y)∈D′ L total (M(x;θ),y) (8)
[0035] Where M(x;θ) represents the output of the global source domain model M for sample x under parameter θ. During the training process, the training loss of the local model is recorded.
[0036] Furthermore, step 5 specifically includes:
[0037] Use the test set to evaluate the performance of the retrained local model, using accuracy as the primary evaluation metric. Calculate the ratio of samples correctly predicted by the local model on the test set to the total number of samples. Execute steps 3-5 again, i.e., recalculate sample sensitivity, determine forgotten samples, update the training dataset, and retrain the local model, until 20 rounds of local training are completed to generate the corresponding local model.
[0038] Furthermore, step 6 specifically includes:
[0039] The server aggregates each local model to generate a global model, and uses the optimal global source domain model parameters as the initial target model parameters. This model only relies on the unlabeled data of the target domain to generate pseudo labels. The pseudo label calculation formula is expressed as formula (9):
[0040]
[0041] in, is the generated pseudo label, is the initial target model Input On each client, a knowledge distillation strategy is introduced to use the pseudo labels generated by the teacher model to guide the learning of the student model. The knowledge distillation loss function is expressed using formula (10):
[0042]
[0043] Among them, L kd is the knowledge distillation loss, It is a student model Input The predicted output is obtained by optimizing L kd Update the student model parameters. In addition, the information entropy loss is introduced to measure the uncertainty of the target domain samples. The information entropy loss function is expressed using formula (11):
[0044]
[0045] in, is the number of data samples of the i-th client in the target domain, is the jth unlabeled sample in the target domain, Model for students The predicted output of The information entropy is calculated for the predicted probability of each category to measure the uncertainty of the predicted distribution. Each client calculates the total loss based on the local data and the optimized pseudo-label. The total loss function formula is expressed using formula (12):
[0046]
[0047] Among them, L kd is the knowledge distillation loss, L ent is the entropy loss, λ1 controls the weight of the information entropy loss, and λ2 controls the weight of the cross entropy loss. Based on this, the student model parameters are updated and the updated parameters are sent to the server. The formula for updating the student model parameters is expressed using formula (13):
[0048]
[0049] in, represents the student model parameters of the i-th client, η is the learning rate, which controls the step size of parameter update, and L is the total loss function used to optimize the target domain model. It is the gradient of the loss function with respect to the student model parameters, guiding the adjustment of the parameters to reduce the loss. The server aggregates the student model and broadcasts the globally updated target model parameters back to each client.
[0050] Through the above steps, the present invention discloses a passive domain-adaptive sample forgetting method based on sample sensitivity. This method, without relying on source domain data, introduces sample sensitivity calculation and a sample forgetting mechanism, effectively enhancing the model's generalization ability to target domain data. At each client, sample sensitivity calculation is first performed on the source domain data. The sensitivity of each sample is determined by performing multiple perturbations on the source domain samples and comparing the changes in model output before and after the perturbations. Based on a pre-set sensitivity threshold, samples to be forgotten are identified and removed from the source domain training dataset, thereby obtaining a purer and more effective training dataset. Pseudo-labels are then generated using unlabeled data from the target domain. Specifically, a teacher model trained on processed source domain data is used to predict the target domain data, and the prediction results serve as training labels for the student model. After pseudo-label generation is completed on each client, the student model is trained using knowledge distillation. Knowledge distillation, as an effective model optimization technique, transfers knowledge from the teacher model to the student model, enabling the student model to learn richer feature representations. This not only improves the performance of the student model but also enables effective learning of target domain data without relying on source domain data. At the same time, a federated learning framework is used to aggregate model parameter updates from each client. This approach not only protects data privacy but also further improves the model's performance in the target domain by aggregating model parameter updates from each client. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0052] Figure 1 Schematic diagram of the flow of the passive domain adaptive sample forgetting method based on sample sensitivity of the present invention;
[0053] Figure 2 This is a module structure diagram of the passive domain adaptive sample forgetting method based on sample sensitivity of the present invention. DETAILED DESCRIPTION
[0054] To make the technical solutions and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention:
[0055] The present invention discloses a passive domain adaptation sample forgetting method based on sample sensitivity. It does not rely on source domain data. It first calculates the sample sensitivity of the source domain data on each client, determines and removes the samples to be forgotten based on the threshold, and obtains a pure training set. The teacher model trained with the processed source domain data is then used to predict the unlabeled data in the target domain and generate pseudo labels to guide the training of the student model. The student model then learns the knowledge of the teacher model through knowledge distillation, improving its performance to efficiently learn the target domain data. Finally, the federated learning framework is used to aggregate the parameter updates of each client model, which not only protects data privacy but also further improves the performance of the model in the target domain. This method screens samples based on sample sensitivity and combines pseudo-labeling technology to achieve effective domain adaptation without the need for source domain data, significantly enhancing the adaptability and accuracy of the local model in the target domain.
[0056] like Figure 1 The flowchart of the method of the present invention is shown. Experiments were conducted using a public office-home dataset. In the embodiment, three of the four domains of Art, Clipart, Product, and RealWorld were used as source domains, and the other domain was used as the target domain for experiments. The entire dataset contains 15,500 images, and each of the four domains contains 65 categories of images. In terms of data distribution, 10% of the data from each client is extracted as server data to simulate the federated learning scenario in a distributed data environment. For the source domain data, its training set and test set are divided into a ratio of 9:1 for training and evaluating local source domain models. The images in the target domain are unlabeled, which is in line with the actual situation of passive domain adaptation. Then, the sample sensitivity calculation and forgetting mechanism are used, combined with federated learning and adaptive strategies, to improve the model performance on unlabeled target domain data. Training includes the following steps:
[0057] Step 1: Select three of the four domains in the Office-Home dataset as source domains and one as the target domain. The three source domains are used as clients. Each client extracts 10% of its data and sends it to the server. The remaining 90% is split into training and test sets at a ratio of 9:1. Each client trains its own local source domain model using the local training set data and then tests it on the local test set.
[0058] Step 2: The server collects the local source domain model parameters from all clients and aggregates them to generate a global source domain model. The global model is tested on the server's data, its performance is judged based on accuracy, and the best performing global model is saved.
[0059] Step 3: Use the optimal global source model to process each sample in the source training set. This generates the global source model output. Multiple perturbations (Gaussian noise) are then performed on each sample. After each perturbation, the model is fed back into the model to generate a new output. Sample sensitivity is calculated by comparing the outputs before and after the perturbation. A forgetting threshold is then set, and samples with a sensitivity above the threshold are marked as forgotten and removed from the source training set, resulting in a new source training set.
[0060] Step 4: Each client retrains its local source domain model based on the new source domain training set. The server collects the local source domain model parameters of the client again, aggregates them to generate a new global source domain model, and saves the global source domain model with the best performance.
[0061] Step 5: The optimal new global source domain model is used as the initial target model for target domain training. The server distributes this model to all clients, and the clients begin adaptive training. The clients feed the target domain input data into the target model to extract features and obtain classification outputs. The outputs are converted to probability distributions, cross entropy and information entropy are calculated, predicted labels are determined, and initial accuracy is calculated. Features are normalized, distances are measured using cosine similarity, and initial cluster centers are determined. In subsequent iterative updates, the distances between features and cluster centers are calculated and labels are reassigned to obtain predicted labels, which are then used to generate the teacher model.
[0062] Step 6: Use the global model distributed by the server as the student model, load the weights, and freeze its parameters. The teacher model transfers the soft-label knowledge to the student model and dynamically updates the student model parameters based on the teacher model parameters using an exponential moving average strategy. Regularly evaluate the performance of the two models and dynamically adjust the update strategy based on the performance difference. Combined with the local target domain data and the optimized pseudo-labels, calculate the total loss of comprehensive knowledge distillation loss, information entropy loss, and cross-entropy loss, with each loss weighted to 1. The client uses the optimizer to update the student model parameters based on the total loss and sends the updated parameters to the server. The server aggregates the globally updated target model parameters and broadcasts them to the client. Repeat steps 5-6, continuously monitoring the model's performance on the target domain dataset, to complete ten rounds of federated training.
[0063] In this experiment, the federated learning training process was set up as follows: a total of 10 federated rounds were conducted, with each client performing 20 epochs of training locally. During the source domain training phase, the batch size was set to 32, which effectively balances computational efficiency and model convergence during training. The learning rate was set to 0.005, and the weight decay coefficient was set to 0.0001. This setting ensures fast training while effectively mitigating exploding or vanishing gradients during training. Sample sensitivity was also calculated during this phase, and samples to be forgotten were identified and removed based on a set threshold. During this phase, the source domain was retrained using a batch size of 4 and a learning rate of 0.0005. During target domain training, the batch size was set to 32, and the learning rate was adjusted to 0.0005. Stochastic gradient descent was used as the optimization algorithm. To further improve the optimization effect, the momentum parameter is set to 0.9, which helps the model accelerate convergence and reduce oscillations when the parameters are updated. At the same time, the momentum decay is set to 0.001, and the sensitivity loss and classification loss weights in the loss function are both 1. As the training progresses, the influence of the momentum is gradually adjusted to make the model more stable in the later stages of training, thereby achieving more effective model optimization and improving model performance.
[0064] The present invention uses accuracy as the model performance evaluation indicator, and the accuracy calculation formula is expressed using formula (10):
[0065]
[0066] Among them, C represents the total number of categories, TP c Indicates the number of samples in category c that are correctly predicted to be of this category; TN c Indicates the number of negative samples in category c that are actually predicted as negative samples by the model; FP c Indicates the number of negative samples in category c that are actually predicted as positive samples by the model; FN c It represents the number of positive samples in category c that are incorrectly predicted as negative samples by the model.
[0067] According to the above steps, build a passive domain adaptation sample forgetting architecture, such as Figure 2 As shown in Table 1, the data clearly shows that the evaluation indicators of the proposed method are significantly better than those of the simple federated learning method for training passive domain adaptation tasks. The clients participating in federated learning correspond to the three domains in the office-home dataset, and the target domain is another domain in the office-home dataset.
[0068] Table 1 Performance comparison with simple federated learning source domain training on the office-home dataset
[0069]
[0070] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes based on the technical solutions and inventive concepts of the present invention within the technical scope disclosed in the present invention, and these changes should be covered by the scope of protection of the present invention.
Claims
1. A passive domain adaptive sample forgetting method based on sample sensitivity, characterized by include: S1: Each client independently trains a local source domain model using source domain data, and the server aggregates to generate a global model; S2: Use the optimal global model from federated training as the initial model, add Gaussian noise perturbations to each sample multiple times, and input the perturbed samples into the initial model to calculate the sample sensitivity; S3: Experiment with different thresholds, observe the performance of the initial model on the validation set, and select the threshold that optimizes model performance as the forgetting threshold. S4: Remove the marked forget samples from the training data set, reorganize the training data, and use the new training data set to retrain the initial model to generate a local model. During the training process, record the training loss and accuracy performance indicators of the local model; S5: If the initial model performance does not meet expectations or there is room for improvement, adjust the forgetting threshold according to the evaluation results, and perform the steps of sample sensitivity calculation, sample forgetting operation, and model training again until the local model performance reaches a satisfactory result and the optimal global model is obtained; S6: The client uses the optimal global model to generate initial pseudo labels for the local target domain data, generates a teacher model through self-supervised learning, and uses the pseudo labels of the teacher model to guide the learning of the client's student model. The server aggregates the model and broadcasts it back to the client to complete one round of iteration. The training ends after multiple rounds.
2. The passive domain adaptive sample forgetting method based on sample sensitivity according to claim 1, characterized in that: When calculating the sample sensitivity, Gaussian noise with different standard deviations is generated for each sample multiple times to obtain multiple perturbed samples. The original sample and the perturbed sample are respectively input into the initial model to obtain the corresponding output. The sample sensitivity is obtained by calculating the degree of change in the output: Among them, ||·||2 represents the L2 norm, r ik is the ratio of each disturbance, s i is the sample sensitivity, ∈ ik is the kth perturbation of the i-th sample, is the initial output of the i-th sample, is the output after disturbance.
3. The passive domain adaptive sample forgetting method based on sample sensitivity according to claim 1, characterized in that: When retraining the initial model using a new training dataset to generate a local model: S31: Remove the marked forgotten samples from the original training data set D to obtain a new training data set D'. Let the marked forgotten sample set be D forgotten ={x j ,y j }, where s j >τ, then D'=DD forgotten , retrain the initial model using the new training dataset D′; S32: Retrain the model using a new training dataset. The total loss function is composed of the sample sensitivity loss function and the cross entropy loss function. composition: Among them, λ is a non-negative hyperparameter used to control the importance of sample sensitivity loss in the total loss, L ce is the cross entropy loss, L sensitivity is the sample sensitivity loss.
4. The passive domain adaptive sample forgetting method based on sample sensitivity according to claim 1, characterized in that: Each client introduces a knowledge distillation strategy, using pseudo labels generated by the teacher model to guide the student model's learning. During the knowledge distillation process, the teacher model is used to guide the student model's learning: Each client uses the teacher model to generate more stable pseudo labels to guide the student model to learn: Among them, L kd is the knowledge distillation loss, KL represents the Kullback-Leibler divergence, and are the output probability distributions of the teacher model and the student model respectively.
5. The passive domain adaptive sample forgetting method based on sample sensitivity according to claim 1, characterized in that: Each client uses the optimized pseudo-label to update the student model parameters and uploads them to the server. The server aggregates the parameters of each client to generate the global model parameters. S51: Each client calculates the total loss based on the target domain data: in, is the cross entropy loss, L ent is the information entropy loss, L kd is the knowledge distillation loss, λ1 and λ2 are the weights of information entropy loss and cross entropy loss respectively; S52: Use the optimizer to update the student model parameters, send the updated parameters to the server, and update the student model parameters: in, represents the student model parameters of the i-th client, η is the learning rate, It is the gradient of the loss function with respect to the student model parameters, guiding it to adjust the parameters to reduce the loss.
Citation Information
Cited By
Heterogeneous label noise robust federated learning method based on group dynamics
CN120996229A
Multi-modal large language model passive forgetting method based on proxy anchor point
CN122133188A
A multi-modal large language model passive forgetting method based on proxy anchor points
CN122133188B