One-time data-free transmission federated learning method and system in data privacy scenario

By constructing an ensemble model in a data privacy scenario and optimizing the model weights using cosine similarity and generative adversarial networks, the problems of high communication overhead and data heterogeneity in federated learning are solved, thereby improving the model's performance and generalization ability on global data.

CN122154980APending Publication Date: 2026-06-05SOUTH CHINA UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTH CHINA UNIV OF TECH
Filing Date
2026-02-02
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing federated learning methods in data privacy scenarios suffer from problems such as high communication overhead, high computational complexity, and insufficient model generalization ability due to data heterogeneity. In particular, it is difficult to effectively integrate the unique information and important features of each local model in heterogeneous scenarios.

Method used

By constructing an ensemble model with a global perspective, using cosine similarity to evaluate local data differences, employing generative adversarial networks to generate high-quality data, and combining knowledge distillation techniques to optimize model weights, we can achieve one-time data-free federated learning in a data privacy scenario under single-round communication.

Benefits of technology

It improves the model's performance on global data, enhances communication efficiency, reduces data collection costs, strengthens the model's generalization ability, generates higher-quality data, and is suitable for real-world heterogeneous scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122154980A_ABST
    Figure CN122154980A_ABST
Patent Text Reader

Abstract

The application provides a one-time data-transmission-free federated learning method in a data privacy scenario, wherein each local privacy data set is input into a trained local model to calculate the average of prototypes of all category privacy data; the trained local model and the average of the prototypes of all category privacy data of each local are uploaded to a server end to jointly form a local data integrated model; the cosine similarity is used to judge the privacy data difference of each local, and the two local models with the largest local privacy data gap are paired; data generated by all paired local models are used to adjust the output weight of the local data integrated model to obtain an integrated model with adjusted weight; the knowledge distillation technology is used to migrate the knowledge to the server model, and the integrated model with adjusted weight is used as a teacher model to obtain a final server model. The application improves the performance of the model after knowledge distillation on the global data by constructing an integrated model from a global perspective.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of federated learning technology, and more specifically, to a one-time data-free federated learning method and system for data privacy scenarios. Background Technology

[0002] Federated learning is a distributed machine learning paradigm that allows multiple client devices to collaboratively train models while protecting data privacy. The first widely used method was Federated Avg, which trains the model locally on each client and then sends the trained models to a central server. The server then weights and aggregates the models based on the relative size of each client's dataset. While this method is effective, it incurs significant communication overhead. To mitigate this issue, much research has focused on reducing data exchange through model compression and related techniques.

[0003] One-round federated learning aims to improve communication efficiency by limiting client-server interactions to single-turn communication. Existing one-round federated learning methods can be divided into two main categories: parameter-optimized one-round federated learning methods and methods that rely on auxiliary public datasets. Parameter-optimized one-round federated learning methods typically assume homogeneous client architectures and introduce significant computational complexity, which reduces their practicality in real-world heterogeneous federated learning scenarios. Methods that rely on auxiliary public datasets improve global model performance by building teacher ensemble models, but the introduction of external data not only increases data collection costs but may also affect model generalization ability due to differences in data distribution, limiting the applicability of these methods in practical tasks.

[0004] To reduce reliance on external data, some research has shifted towards knowledge augmentation or ensemble distillation using locally synthesized data. While these methods alleviate data requirements to some extent, they still face key challenges posed by data heterogeneity: in statistically heterogeneous environments, the learning capabilities and expressive ranges of local models on different clients vary significantly. Constructing an ensemble model solely from a global perspective can easily overlook the unique information and important features of each local model, preventing the global model from fully integrating effective knowledge from different distributions and thus impacting the overall performance of the model in complex heterogeneous scenarios. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings and deficiencies of the prior art and provide a one-time data-free federated learning method and system for data privacy scenarios. This one-time data-free federated learning method and system can construct an integrated model through a global perspective, thereby improving the performance of the knowledge-distilled model on global data.

[0006] To achieve the above objectives, the present invention provides a one-time data-free federated learning method for data privacy scenarios, characterized by comprising the following steps:

[0007] S1. Obtain local privacy data, preprocess local privacy data to obtain local training sets and local privacy datasets.

[0008] S2. Each local model is trained using its own local training set to obtain a trained local model.

[0009] S3. Input each local privacy dataset into the trained local model, save the data of the model feature extraction layer as the prototype of all local privacy data, and then calculate and save the average value of the prototype of all local privacy data.

[0010] S4. Upload the average value of each trained local model and the prototype of all categories of privacy data in each local model to the server. The local models together form a local data integration model.

[0011] S5. Calculate the cosine similarity of the prototypes of all categories of local privacy data, determine the differences in local privacy data through the cosine similarity, and pair the two local models with the largest differences in local privacy data.

[0012] S6. Use the data generated by all paired local models to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model;

[0013] S7. Use knowledge distillation technology to transfer the knowledge in the weighted ensemble model to the server model. Use the weighted ensemble model as the teacher model and train another distillation generator to synthesize data to obtain the final server model.

[0014] Furthermore, in S1, the image classification dataset is distributed to each locality through a Dirichlet distribution to obtain the privacy data of each locality;

[0015] Preprocessing the local privacy data involves scaling the allocated local privacy data to ensure uniform input size, converting image samples into processable tensors and adjusting the channel order, and finally standardizing the RGB channels of the image samples to normalize the input data, thus obtaining the local training sets and local privacy datasets.

[0016] Furthermore, in S3, the step of inputting each local privacy dataset into the trained local model, saving the data from the model's feature extraction layer as the prototype of all categories of local privacy data, and then calculating and saving the average value of the prototype of all categories of local privacy data refers to:

[0017] The first The local first Local privacy data in each category is recorded as follows: ,in , Representing the total number of categories, the prototype is defined as the mean of the instance embedding vectors within each category, calculated as follows:

[0018]

[0019] in, It is the first The local first The average of the privacy data prototypes across all categories, which needs to be uploaded locally to the server, can be expressed as: , It is the first The embedding function of each local model has the following parameters: .

[0020] Furthermore, in S4, uploading the average value of the trained local models and the prototypes of all categories of local privacy data to the server, whereby the local models together form a local data ensemble model, means:

[0021] Each locally trained model And the prototype average of all categories of privacy data in each locality. All local models uploaded to the server together form a local data integration model applicable to all local data:

[0022]

[0023] Among them, the model This represents the predicted probability of the nth local model on sample x. It is the weight coefficient of the nth client. The local data integration model is abbreviated as... The weights of the local data integration model were set to N is the number of local models.

[0024] Furthermore, in S5, calculating the cosine similarity of the prototypes of all categories of local privacy data, judging the differences in local privacy data through the cosine similarity, and pairing the two local models with the largest differences in local privacy data means:

[0025] Randomly select an unpaired local model and obtain the prototype mean of all categories of privacy data uploaded by it. ;

[0026] Calculate the cosine similarity between the nth local and the prototype matrix of all unpaired locals; if the nth local has no samples in a certain category, and the ith local also has no samples in that category, then the cosine similarity is set to 1; if only one of the ith local and the nth local lacks samples in a certain category, then the cosine similarity is set to -1; if both the nth local and the ith local have samples in the mth category, then the cosine similarity is calculated according to the following formula:

[0027]

[0028] After obtaining the cosine similarity of all categories for the nth local and the ith local, the average of the cosine similarities of all categories is used to obtain the similarity between the two locals, as shown in the following formula:

[0029]

[0030] in, Represents the total number of categories;

[0031] After calculating the similarity between the nth local area and all other local areas, we can obtain the set of similarity scores between local area n and all other local areas. Sort the cosine similarity scores and extract them from the cosine similarity set. The minimum value is selected from the local models to determine the difference in privacy data between each local model and local n. The local model with the largest difference between the local privacy data and n is then paired.

[0032] From the remaining unpaired local models, randomly select one and continue this process until all local models are paired or only one unpaired local model remains. If only one unpaired local model remains, it forms a pair with itself, and the final result is... Grouping pairs of local models, where , This represents the number of local models.

[0033] Furthermore, in S6, the step of using data generated by all paired local models to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model refers to:

[0034] Using a generative adversarial network (GAN), random Gaussian noise and image labels are generated as... Input to a local generator A local generator is Pair the local models together; combine each pair of local models into a small ensemble model, and finally obtain Z small ensemble models; A small ensemble model is used as the discriminator of the generative adversarial network to train it. There are several local generators. Through generative adversarial methods, the original Gaussian noise is made to be closer to the real image data. Each local generator generates a batch of image data. All the generated image data together form a training set for adjusting the weights of the local data ensemble model. Finally, the weights of the local data ensemble model are trained using the training set with adjusted weights, resulting in an ensemble model with adjusted weights.

[0035] Furthermore, after obtaining After pairing the local models, each pair is combined into a small ensemble model, resulting in Z small ensemble models; given samples , No. Local models of grouping versus small ensemble models of grouping It can be represented as:

[0036]

[0037] in, Indicates the first The set of indices for the local model pairs of the group pair, with a size of 1 or 2, corresponding to the pair consisting of a single local model or two local models, respectively;

[0038] use A small ensemble model is used as the discriminator of the generative adversarial network for training. A local generator is used to obtain data containing sufficient local knowledge;

[0039] Set to sample random noise from a standard Gaussian distribution Uniform random sampling labels Used to train a local generator Its parameters are ; Use classification loss function to ensure A small ensemble model can reliably classify synthetic data and improve the quality of generated data and prevent [further issues] by introducing a penalty coefficient. The small ensemble model overfits the generated data, resulting in the following optimization objective:

[0040]

[0041] in, Indicate category The corresponding probability, This refers to the classic CE loss function;

[0042] To make the generated samples more challenging for the ensemble model, an adversarial loss is introduced, which increases the local model's performance against the ensemble model. The differences between the predictions of the small ensemble models can be expressed as:

[0043]

[0044] It is the classic KL loss function; the first The final loss function of each local generator is obtained by combining the two loss functions mentioned above:

[0045]

[0046] in yes The scaling factor is used to control its effect;

[0047] After the local generators are trained, sample random noise is input. A local generator can obtain the synthesized data. , obtain dataset , synthesize dataset Data shuffling for local data integration models The objective function for optimizing the weights can be expressed as:

[0048]

[0049] in With a constant learning rate along the gradient direction renew :

[0050]

[0051] in, Ensure that all weight values ​​are constrained within the range of [0,1]. The sign function is then used to obtain the weighted ensemble model. .

[0052] Furthermore, in S7, the step of using knowledge distillation technology to transfer knowledge from the weighted ensemble model to the server model, using the weighted ensemble model as the teacher model, and training another distillation generator to synthesize data to obtain the final server model refers to:

[0053] Knowledge distillation is used to transfer knowledge from the weighted ensemble model to the server model, and the weighted ensemble model is then used. As a teacher model, another distillation generator is trained to synthesize data:

[0054] Set to sample random noise from a standard Gaussian distribution And uniformly and randomly sample labels Used to train distillation generator Its parameters are The optimization objective for training the distillation generator is:

[0055]

[0056]

[0057] ,

[0058] in, These are weight parameters. It is a server-side model with randomly initialized parameters;

[0059] Distillation generator After training, inputting sampled random noise into the distillation generator will yield synthetic data for distillation. Then, the synthesis data used for distillation was employed. And the KL loss function to train the server-side model ;

[0060] Through multiple rounds of knowledge distillation, a server-side model suitable for global data is finally obtained. ,in These are the server-side model parameters after multiple distillation operations.

[0061] A one-time, data-free federated learning system for data privacy scenarios, characterized by comprising the following modules:

[0062] The sample acquisition module is used to acquire each local training set and each local privacy dataset;

[0063] The local data integration model acquisition module is used to input each local privacy dataset into the trained local model, save the data of the model feature extraction layer as the prototype of all categories of local privacy data, calculate and save the average value of the prototype of all categories of local privacy data, and upload each trained local model and the average value of the prototype of all categories of local privacy data to the server. All local models together form a local data integration model.

[0064] The high-quality ensemble model acquisition module is used to calculate the cosine similarity of the prototypes of all categories of local privacy data. The cosine similarity is used to determine the differences in privacy data among local data, and the two local models with the largest differences in local privacy data are paired. The data generated by all paired local models are used to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model, which is the high-quality ensemble model.

[0065] The knowledge distillation module is used to transfer knowledge from the weighted ensemble model to the server model using knowledge distillation technology. The weighted ensemble model is used as the teacher model, and another distillation generator is trained to synthesize data to obtain the final server model.

[0066] A storage medium storing a program, characterized in that, when the program is executed by a processor, it implements the one-time data-free federated learning method under the above-mentioned data privacy scenario.

[0067] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0068] 1. Compared with traditional federated learning methods, this invention greatly improves communication efficiency by limiting local-server interaction to a single round of communication, making the application of federated learning in real-world scenarios more possible and greatly promoting the progress of federated learning applications.

[0069] 2. This invention uses the cosine similarity between prototypes to evaluate the differences in local data, thereby efficiently identifying the model pairs with the greatest differences in local data for the generation of integrated models. This greatly improves the accuracy and authenticity of judging the differences in local data, and opens up a new direction for the process of training server-side models using local models in the field of federated learning.

[0070] 3. This invention proposes using multiple pairs of local models to train a series of generators, which generate data to further adjust the weights of the ensemble model. This method can generate reliable data and retain a large amount of knowledge from the local models, thereby improving the quality of the ensemble model and greatly reducing the loss of local model knowledge during the ensemble process.

[0071] 4. This invention innovatively constructs the loss function of the generator, and further increases the difficulty of the generated samples fitting the ensemble model by introducing a penalty coefficient and adversarial loss, thereby increasing the difference between the predictions of the local model and the ensemble model, improving the quality of the generated data and thus improving the performance of the server model on global data. Attached Figure Description

[0072] Figure 1 This is a flowchart of a one-time data-free federated learning method under a data privacy scenario in this invention embodiment;

[0073] Figure 2 This is a flowchart of the prototype-based local model matching strategy in an embodiment of the present invention;

[0074] Figure 3 This is a simplified flowchart of a one-time data-free federated learning method in a data privacy scenario according to an embodiment of the present invention. Detailed Implementation

[0075] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0076] Example 1

[0077] like Figures 1 to 3 As shown, the one-time data-free federated learning method for data privacy scenarios of the present invention includes the following steps:

[0078] S1. Obtain local privacy data, preprocess the local privacy data to obtain local training sets and local privacy datasets.

[0079] Specifically, Cifar-10, an image classification dataset covering ten common categories, was selected as the image classification dataset. This dataset was then distributed to various local locations using a Dirichlet distribution to obtain the privacy data of each local location. (Dirichlet distribution parameters...) The smaller the value, the more unbalanced the distribution of local data. In this embodiment, Set it to 0.1.

[0080] Assuming we have Each locality has a privacy dataset distributed via a Dirichlet distribution. ,in It is the number of local privacy samples. It is a sample. It is its corresponding label, in this embodiment, .

[0081] Preprocessing the local privacy data involves: scaling the allocated local privacy data to ensure a uniform input size; converting image samples into processable tensors and adjusting the channel order; and finally standardizing the RGB channels of the image samples to normalize the input data, resulting in local training sets and local privacy datasets. In this embodiment, scaling typically reduces the image samples to a size of 32*32.

[0082] S2. Each local model is trained using its own local training set to obtain a trained local model.

[0083] In this embodiment, CNN is used as both the local model and the server-side model structure, and each local model is trained using its own local training set.

[0084] S3. Input each local privacy dataset into the trained local model, save the data of the model feature extraction layer as the prototype of all categories of local privacy data, and then calculate and save the average value of the prototype of all categories of local privacy data.

[0085] Specifically, the first The local first Local privacy data in each category is recorded as follows: ,in , Representing the total number of categories, the prototype is defined as the mean of the instance embedding vectors within each category, calculated as follows:

[0086]

[0087] in, It is the first The local first The average of the privacy data prototypes across all categories, which needs to be uploaded locally to the server, can be expressed as: , It is the first The embedding function of each local model has the following parameters: .

[0088] S4. Upload the trained local models and the average value of the prototypes of all categories of privacy data in each local model to the server. All local models together form a local data integration model.

[0089] Specifically, each local training model And the prototype average of all categories of privacy data in each locality. All local models uploaded to the server together form a local data integration model applicable to all local data:

[0090]

[0091] Among them, the model This represents the predicted probability of the nth local model on sample x. It is the weight coefficient of the nth client. The local data integration model is abbreviated as... The weights of the local data integration model were set to N is the number of local models.

[0092] S5. Calculate the cosine similarity of the prototypes of all categories of local privacy data, determine the differences in local privacy data through cosine similarity, and pair the two local models with the largest differences in local privacy data.

[0093] Randomly select an unpaired local model and obtain the prototype mean of all categories of privacy data uploaded by it. ;

[0094] Calculate the cosine similarity between the nth local and the prototype matrix of all unpaired locals; if the nth local has no samples in a certain category, and the ith local also has no samples in that category, then the cosine similarity is set to 1; if only one of the ith local and the nth local lacks samples in a certain category, then the cosine similarity is set to -1; if both the nth local and the ith local have samples in the mth category, then the cosine similarity is calculated according to the following formula:

[0095]

[0096] After obtaining the cosine similarity of all categories for the nth local and the ith local, the average of the cosine similarities of all categories is used to obtain the similarity between the two locals, as shown in the following formula:

[0097]

[0098] in, Represents the total number of categories;

[0099] After calculating the similarity between the nth local area and all other local areas, we can obtain the set of similarity scores between local area n and all other local areas. Sort the cosine similarity scores and extract them from the cosine similarity set. The minimum value is selected from the local models to determine the difference in privacy data between each local model and local n. The local model with the largest difference between the local privacy data and n is then paired.

[0100] From the remaining unpaired local models, randomly select one and continue this process until all local models are paired or only one unpaired local model remains. If only one unpaired local model remains, it forms a pair with itself, and the final result is... Grouping pairs of local models, where , This represents the number of local models.

[0101] S6. Use the data generated by all paired local models to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model.

[0102] Using a generative adversarial network (GAN), random Gaussian noise and image labels are generated as... Input to a local generator A local generator is Pair the local models together; combine each pair of local models into a small ensemble model, and finally obtain Z small ensemble models; A small ensemble model is used as the discriminator of the generative adversarial network to train it. There are several local generators. Through generative adversarial methods, the original Gaussian noise is made to be closer to the real image data. Each local generator generates a batch of image data. All the generated image data together form a training set for adjusting the weights of the local data ensemble model. Finally, the weights of the local data ensemble model are trained using the training set with adjusted weights, resulting in an ensemble model with adjusted weights.

[0103] The specific steps are as follows:

[0104] In obtaining After pairing the local models, each pair is combined into a small ensemble model, resulting in Z small ensemble models; given samples , No. Local models of grouping versus small ensemble models of grouping It can be represented as:

[0105]

[0106] in, Indicates the first The set of indices for the local model pairs of the group pair, with a size of 1 or 2, corresponding to the pair consisting of a single local model or two local models, respectively;

[0107] use A small ensemble model is used as the discriminator of the generative adversarial network for training. A local generator is used to obtain data containing sufficient local knowledge;

[0108] Set to sample random noise from a standard Gaussian distribution Uniform random sampling labels Used to train a local generator Its parameters are ; Use classification loss function to ensure A small ensemble model can reliably classify synthetic data and improve the quality of generated data and prevent [further issues] by introducing a penalty coefficient. The small ensemble model overfits the generated data, resulting in the following optimization objective:

[0109]

[0110] in, Indicate category The corresponding probability, This refers to the classic CE loss function;

[0111] To make the generated samples more challenging for the ensemble model, an adversarial loss is introduced, which increases the local model's performance against the ensemble model. The differences between the predictions of the small ensemble models can be expressed as:

[0112]

[0113] It is the classic KL loss function; the first The final loss function of each local generator is obtained by combining the two loss functions mentioned above:

[0114]

[0115] in yes The scaling factor is used to control its impact; in this embodiment... .

[0116] After the local generators are trained, sample random noise is input. A local generator can obtain the synthesized data. , obtain dataset , synthesize dataset Data shuffling for local data integration models The objective function for optimizing the weights can be expressed as:

[0117]

[0118] in With a constant learning rate along the gradient direction renew :

[0119]

[0120] in, Ensure that all weight values ​​are constrained within the range of [0,1]. The sign function is then used to obtain the weighted ensemble model. .

[0121] S7. Use knowledge distillation technology to transfer the knowledge in the weighted ensemble model to the server model. Use the weighted ensemble model as the teacher model and train another distillation generator to synthesize data to obtain the final server model.

[0122] Specifically, knowledge distillation technology is used to transfer knowledge from the weight-adjusted ensemble model to the server model, and the weight-adjusted ensemble model is then used. As a teacher model, another distillation generator is trained to synthesize data:

[0123] Set to sample random noise from a standard Gaussian distribution And uniformly and randomly sample labels Used to train distillation generator Its parameters are The optimization objective for training the distillation generator is:

[0124]

[0125]

[0126] ,

[0127] in, These are weight parameters. It is a server-side model with randomly initialized parameters;

[0128] Distillation generator After training, inputting sampled random noise into the distillation generator will yield synthetic data for distillation. Then, the synthesis data used for distillation was employed. And the KL loss function to train the server-side model ;

[0129] Through multiple rounds of knowledge distillation (e.g., 200 epochs), a server-side model suitable for global data is finally obtained. ,in These are the server-side model parameters after multiple distillation operations.

[0130] Example 2

[0131] The one-time, data-free federated learning system for data privacy scenarios in this embodiment includes the following modules:

[0132] The sample acquisition module is used to acquire each local training set and each local privacy dataset;

[0133] The local data integration model acquisition module is used to input each local privacy dataset into the trained local model, save the data of the model feature extraction layer as the prototype of all categories of local privacy data, calculate and save the average value of the prototype of all categories of local privacy data, and upload each trained local model and the average value of the prototype of all categories of local privacy data to the server. All local models together form a local data integration model.

[0134] The high-quality ensemble model acquisition module is used to calculate the cosine similarity of the prototypes of all categories of local privacy data. The cosine similarity is used to determine the differences in privacy data among local data, and the two local models with the largest differences in local privacy data are paired. The data generated by all paired local models are used to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model, which is the high-quality ensemble model.

[0135] The knowledge distillation module is used to transfer knowledge from the weighted ensemble model to the server model using knowledge distillation technology. The weighted ensemble model is used as the teacher model, and another distillation generator is trained to synthesize data to obtain the final server model.

[0136] Example 3

[0137] This embodiment provides a storage medium storing a program. When the program is executed by a processor, it implements a one-time data-free federated learning method under the data privacy scenario of Embodiment 1.

[0138] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.

Claims

1. A one-time data-free federated learning method for data privacy scenarios, characterized in that: Includes the following steps: S1. Obtain local privacy data, preprocess local privacy data to obtain local training sets and local privacy datasets. S2. Each local model is trained using its own local training set to obtain a trained local model. S3. Input each local privacy dataset into the trained local model, save the data of the model feature extraction layer as the prototype of all local privacy data, and then calculate and save the average value of the prototype of all local privacy data. S4. Upload the average value of each trained local model and the prototype of all categories of privacy data in each local model to the server. The local models together form a local data integration model. S5. Calculate the cosine similarity of the prototypes of all categories of local privacy data, determine the differences in local privacy data through the cosine similarity, and pair the two local models with the largest differences in local privacy data. S6. Use the data generated by all paired local models to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model; S7. Use knowledge distillation technology to transfer the knowledge in the weighted ensemble model to the server model. Use the weighted ensemble model as the teacher model and train another distillation generator to synthesize data to obtain the final server model.

2. The one-time data-free federated learning method for data privacy scenarios according to claim 1, characterized in that: In S1, the image classification dataset is distributed to each locality through a Dirichlet distribution to obtain the privacy data of each locality; Preprocessing the local privacy data involves scaling the allocated local privacy data to ensure uniform input size, converting image samples into processable tensors and adjusting the channel order, and finally standardizing the RGB channels of the image samples to normalize the input data, thus obtaining the local training sets and local privacy datasets.

3. The one-time data-free federated learning method for data privacy scenarios according to claim 1, characterized in that: In S3, the step of inputting each local privacy dataset into the trained local model, saving the data from the model's feature extraction layer as the prototype of all categories of local privacy data, and then calculating and saving the average value of the prototype of all categories of local privacy data refers to: The first The local first Local privacy data in each category is recorded as follows: ,in , Representing the total number of categories, the prototype is defined as the mean of the instance embedding vectors within each category, calculated as follows: ; in, It is the first The local first The average of the privacy data prototypes across all categories, which needs to be uploaded locally to the server, can be expressed as: , It is the first The embedding function of each local model has the following parameters: .

4. The one-time data-free federated learning method for data privacy scenarios according to claim 3, characterized in that: In S4, uploading the average value of the trained local models and the prototypes of all categories of local privacy data to the server, whereby the local models together form a local data ensemble model, means: Each locally trained model And the prototype average of all categories of privacy data in each locality. All local models uploaded to the server together form a local data integration model applicable to all local data: ; Among them, the model This represents the predicted probability of the nth local model on sample x. It is the weight coefficient of the nth client. The local data integration model is abbreviated as... The weights of the local data integration model were set to N is the number of local models.

5. The one-time data-free federated learning method for data privacy scenarios according to claim 3, characterized in that: In S5, calculating the cosine similarity of the prototypes of all categories of local privacy data, judging the differences in local privacy data through cosine similarity, and pairing the two local models with the largest differences in local privacy data means: Randomly select an unpaired local model and obtain the prototype mean of all categories of privacy data uploaded by it. ; Calculate the cosine similarity between the nth local and the prototype matrix of all unpaired locals; if the nth local has no samples in a certain category, and the ith local also has no samples in that category, then the cosine similarity is set to 1; if only one of the ith local and the nth local lacks samples in a certain category, then the cosine similarity is set to -1; if both the nth local and the ith local have samples in the mth category, then the cosine similarity is calculated according to the following formula: ; After obtaining the cosine similarity of all categories for the nth local and the ith local, the average of the cosine similarities of all categories is used to obtain the similarity between the two locals, as shown in the following formula: ; in, Represents the total number of categories; After calculating the similarity between the nth local area and all other local areas, we can obtain the set of similarity scores between local area n and all other local areas. Sort the cosine similarity scores and extract them from the cosine similarity set. The minimum value is selected from the local models to determine the difference in privacy data between each local model and local n. The local model with the largest difference between the local privacy data and n is then paired. From the remaining unpaired local models, randomly select one and continue this process until all local models are paired or only one unpaired local model remains. If only one unpaired local model remains, it forms a pair with itself, and the final result is... Grouping pairs of local models, where , This represents the number of local models.

6. The one-time data-free federated learning method for data privacy scenarios according to claim 5, characterized in that: In S6, the step of using data generated by all paired local models to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model refers to: Using a generative adversarial network (GAN), random Gaussian noise and image labels are generated as... Input to a local generator A local generator is Pair the local models together; combine each pair of local models into a small ensemble model, and finally obtain Z small ensemble models; A small ensemble model is used as the discriminator of the generative adversarial network to train it. There are several local generators. Through generative adversarial methods, the original Gaussian noise is made to be closer to the real image data. Each local generator generates a batch of image data. All the generated image data together form a training set for adjusting the weights of the local data ensemble model. Finally, the weights of the local data ensemble model are trained using the training set with adjusted weights, resulting in an ensemble model with adjusted weights.

7. The one-time data-free federated learning method for data privacy scenarios according to claim 6, characterized in that: In obtaining After pairing the local models, each pair is combined into a small ensemble model, resulting in Z small ensemble models; given samples , No. Local models of grouping versus small ensemble models of grouping It can be represented as: ; in, Indicates the first The set of indices for the local model pairs of the group pair, with a size of 1 or 2, corresponding to the pair consisting of a single local model or two local models, respectively; use A small ensemble model is used as the discriminator of the generative adversarial network for training. A local generator is used to obtain data containing sufficient local knowledge; Set to sample random noise from a standard Gaussian distribution Uniform random sampling labels Used to train a local generator Its parameters are ; Use classification loss function to ensure A small ensemble model can reliably classify synthetic data and improve the quality of generated data and prevent [further issues] by introducing a penalty coefficient. The small ensemble model overfits the generated data, resulting in the following optimization objective: ; in, Indicates category The corresponding probability, This refers to the classic CE loss function; To make the generated samples more challenging for the ensemble model, an adversarial loss is introduced, which increases the local model's performance against the ensemble model. The differences between the predictions of the small ensemble models can be expressed as: ; It is the classic KL loss function; the first The final loss function of each local generator is obtained by combining the two loss functions mentioned above: ; in yes The scaling factor is used to control its effect; After the local generators are trained, sample random noise is input. A local generator can obtain the synthesized data. , obtain dataset , synthesize dataset Data disruption for local data integration models The objective function for optimizing the weights can be expressed as: ; in With a constant learning rate along the gradient direction renew : ; in, Ensure that all weight values ​​are constrained within the range [0,1]. The sign function is then used to obtain the weighted ensemble model. .

8. The one-time data-free federated learning method for data privacy scenarios according to claim 7, characterized in that: In S7, the process of using knowledge distillation to transfer knowledge from the weighted ensemble model to the server model, using the weighted ensemble model as the teacher model, and training another distillation generator to synthesize data to obtain the final server model refers to: Knowledge distillation is used to transfer knowledge from the weighted ensemble model to the server model, and the weighted ensemble model is then used. As a teacher model, another distillation generator is trained to synthesize data: Set to sample random noise from a standard Gaussian distribution And uniformly and randomly sample labels Used to train distillation generator Its parameters are The optimization objective for training the distillation generator is: ; in, These are weight parameters. It is a server-side model with randomly initialized parameters; Distillation generator After training, inputting sampled random noise into the distillation generator will yield synthetic data for distillation. Then, the synthesis data used for distillation was employed. And the KL loss function to train the server-side model ; Through multiple rounds of knowledge distillation, a server-side model suitable for global data is finally obtained. ,in These are the server-side model parameters after multiple distillation operations.

9. A one-time data-free federated learning system for data privacy scenarios, characterized in that: Includes the following modules: The sample acquisition module is used to acquire each local training set and each local privacy dataset; The local data integration model acquisition module is used to input each local privacy dataset into the trained local model, save the data of the model feature extraction layer as the prototype of all categories of local privacy data, calculate and save the average value of the prototype of all categories of local privacy data, and upload each trained local model and the average value of the prototype of all categories of local privacy data to the server. All local models together form a local data integration model. The high-quality ensemble model acquisition module is used to calculate the cosine similarity of the prototypes of all categories of local privacy data. The cosine similarity is used to determine the differences in privacy data among local data, and the two local models with the largest differences in local privacy data are paired. The data generated by all paired local models are used to adjust the output weights of the local data ensemble model to obtain the weight-adjusted ensemble model, which is the high-quality ensemble model. The knowledge distillation module is used to transfer knowledge from the weighted ensemble model to the server model using knowledge distillation technology. The weighted ensemble model is used as the teacher model, and another distillation generator is trained to synthesize data to obtain the final server model.

10. A storage medium storing a program, characterized in that, When the program is executed by the processor, it implements the one-time data-free federated learning method for data privacy scenarios as described in any one of claims 1-8.