A federated learning method based on flexible combination of feature extractor and classifier

By flexibly combining feature extractors and classifiers in federated learning, and using global feature anchors to guide local training, the problems of model performance degradation and privacy leakage in heterogeneous data environments are solved, and more efficient model training and privacy protection are achieved. .

CN119005302BActive Publication Date: 2024-12-20QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411455446.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2024-12-20
Estimated Expiration
2044-10-18

AI Technical Summary

Technical Problem

In a heterogeneous data environment, existing federated learning methods cannot effectively match feature extractors and classifiers, resulting in degraded model performance and privacy leakage problems.

Method used

A federated learning method based on the flexible combination of feature extractors and classifiers is adopted to train local feature extractors and classifiers separately through global model initialization, local model updates, and use global feature anchors to guide local feature extractor training to reduce Communication overhead and enhance privacy protection.

Benefits of technology

Improve the generalization performance and privacy protection of the model, reduce communication overhead, and generate more stable local models in heterogeneous data environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119005302B_ABST
    Figure CN119005302B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of federated learning, and more specifically, relates to a federated learning method based on a flexible combination of feature extractors and classifiers. The method comprises: the server initializes the global model; if it is the first round, the local classifier is updated to the global classifier, if not, the local classifier is allowed to use the local classifier after the previous round of training; the local classifier is trained, and then the local feature extractor is trained, and the global feature extractor generates a global feature anchor to guide the training of the local feature extractor, and the local feature extractor is first combined with the global classifier for training, and then combined with the local classifier for training; based on the number of client samples, the aggregation weight is generated, and the local model is aggregated to obtain a new round of global model; the steps are repeated until the model converges or reaches the set communication round. The present invention solves the problems of model performance degradation and privacy leakage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of federated learning, and more specifically, relates to a federated learning method based on a flexible combination of a feature extractor and a classifier. Background Art

[0002] Data is crucial to the development of artificial intelligence and is regarded as one of the three pillars driving the progress of artificial intelligence. However, the data used for artificial intelligence training often involves personal privacy and is usually restricted in use. This creates a paradox: on the one hand, a large amount of data is needed to train smarter and more robust artificial intelligence; on the other hand, due to privacy and the economic value of data, individuals and companies are reluctant to share data. This contradiction restricts the development of artificial intelligence and hinders technological innovation. In order to solve this paradox, federated learning came into being. Federated learning is an innovative distributed machine learning method that allows multiple participants to collaborate on training models without exposing the original data. It cleverly balances the contradiction between privacy protection and data sharing through a distributed architecture.

[0003] In federated learning, when data is uniform or independent and identically distributed among clients, the training objectives of each client are similar, and simple parameter averaging can generate an effective global model, so traditional federated learning algorithms such as FedAvg perform well. However, in the case of heterogeneous or non-independent and identically distributed data, due to the large data differences between clients, simple model aggregation may not be able to adapt to all clients, resulting in poor performance of the trained model. In order to alleviate the problem of limited performance of federated learning under heterogeneous data, people have carried out a series of research. Personalized federated learning based on model decoupling and using different processing strategies for decoupled feature extractors and classifiers is one of the methods. For example, Chinese patent document CN116702864A discloses a method and system for data privacy protection of federated learning based on model decoupling, which includes: the server publishes a federated learning task; the client receives and analyzes the resources consumed to complete the task; the server selects the clients participating in this training according to historical data and distributes the global model; the clients participating in this training decouple the global model for training; the server aggregates the training models of the clients participating in the training and updates the global model; the server calculates the contribution of the clients participating in the training and calculates the actual reward, which is distributed to the clients participating in the training. However, the existing methods based on this technology do not consider the matching problem of feature extractors and classifiers well. The combination of overly common feature extractors and overly personalized classifiers cannot well alleviate the negative impact of heterogeneous data on federated learning.

[0004] In view of this, the present invention designs a federated learning method based on a flexible combination of feature extractors and classifiers to solve problems such as model performance degradation and privacy leakage. Summary of the invention

[0005] The present invention aims to overcome at least one defect of the above-mentioned prior art and provide a federated learning method based on a flexible combination of feature extractors and classifiers to solve problems such as model performance degradation and privacy leakage.

[0006] The detailed technical scheme of the present invention is as follows:

[0007] A federated learning method based on a flexible combination of a feature extractor and a classifier, the method comprising:

[0008] S1. Global model initialization: The server initializes the global model , and sends this global model to all the participants in federated learning Clients;

[0009] S2, local model update: During the first local model update training, each client updates the local model to the latest received global model; if it is not the first local model update training, each client updates the local feature extractor part in the local model to the global feature extractor part in the latest received global model, and the local classifier part is not updated, and the local classifier obtained after the last local model training continues to be used;

[0010] S3, local model training: After the local model is updated, the local model starts to be trained. The local feature extractor and local classifier in the local model are trained separately, and the local classifier is trained first. At this time, only the parameters of the local classifier part are changed. When training the local classifier, the latest received global classifier is used to guide the training of the local classifier in the form of knowledge distillation.

[0011] After the local classifier is trained, the local feature extractor is trained again. At this time, only the parameters of the local feature extractor are changed. When the local feature extractor is trained, the global feature extractor in the global model generates a global feature anchor based on the client's current data set, and uses this global feature anchor to guide the training of the local feature extractor. At the same time, the local feature extractor is first combined and trained with the global classifier, and then combined and trained with the local classifier;

[0012] S4, global model aggregation: Each client uploads its trained local model and the size of its data set to the server. The size of the data set is uploaded to the server only after the first round of local update training. The server determines the client's aggregation weight based on the size of each client's data set, and aggregates and generates a global model based on the client's aggregation weight. After the aggregation is completed, the latest aggregated global model is sent to the clients participating in federated learning;

[0013] S5. Repeat S2-S4 until the local model converges or reaches the set communication round.

[0014] Preferably, according to the present invention, the global model and the local model have the same structure: the last layer of the global model and the local model is a classifier, and the remaining layers are combined into a feature extractor.

[0015] Preferably, according to the present invention, when training the local classifier, the latest received global classifier is used to guide the training of the local classifier in a knowledge distillation manner, and the formula is as follows:

[0016] (1)

[0017] In formula (1), represents the trained local classifier, represents the local classifier before training after update, represents the learning rate, represents the gradient corresponding to the cross entropy loss, represents the cross entropy loss, represents the local feature extractor before updating and training, Indicates that it belongs to the client dataset Small batches of data, is a hyperparameter, , ;

[0018] Specifically, first combine the local classifier and the global classifier with the local feature extractor, and then let them generate logits output under the same input. The logits output is the result of the global model and the local model before the normalization operation in the last layer. The logits output is a dimensional vector, each dimension value after normalization represents the predicted probability of the corresponding class of this dimension, and the logits output corresponding to the global classifier is defined as , where the logits output of the kth dimension is , the logits output corresponding to the local classifier is , where the logits output of the kth dimension is , in obtaining and After that, they are normalized. The logits output of the kth dimension generated by the global classifier is normalized using the following formula:

[0019] (2)

[0020] In formula (2), is the normalized result, where is a hyperparameter, is the logits output of the kth dimension of the global classifier;

[0021] The logits output of the kth dimension generated by the local classifier is normalized using the following formula:

[0022] (3)

[0023] In formula (3), is the normalized result, is the logits output of the kth dimension of the local classifier;

[0024] After obtaining the above two groups (each group has After the normalized results are obtained, the values ​​in these two sets of results are calculated. Divergence, and add them up, that is ,in

[0025] (4)

[0026] Each sample in is processed in the above way.

[0027] Preferably, according to the present invention, when the local feature extractor is trained, the local feature extractor and the global classifier are combined and trained as follows:

[0028] (5)

[0029] In formula (5), It represents the state after the combined training of the local feature extractor and the global classifier and before the combined training of the local classifier. represents the local feature extractor before updating and training, Indicates The global classifier received before the local update training, is a hyperparameter, represents the global feature anchor point, represents the L2 norm;

[0030] The local feature extractor and local classifier are trained in combination as follows:

[0031] (6)

[0032] In formula (6), represents the trained local feature extractor, represents the L2 norm, Represented as the first client in the i-th client data set The data characteristics of a certain piece of data in a class;

[0033] Specifically, a global feature extractor is used to generate corresponding feature vectors based on the client data, and the feature vectors of each class are averaged to define the result as the global feature anchor point of this class, that is,

[0034] (7)

[0035] In formula (7), represents the global feature anchor of the k-th class, Represented as the first client in the i-th client data set The data characteristics of a certain data of a class, Indicates the first client in the i-th client data set The number of data in each class;

[0036] After obtaining the global feature anchor, the following feature alignment operation is performed to constrain the training of the local feature extractor

[0037] (8)

[0038] In formula (8), represents the L2 norm, Indicates The local feature extraction function during the local update training, represents or, the calculation formula is:

[0039] (9)

[0040] In formula (9), The dimension of the feature vector, Indicates or.

[0041] Preferably, according to the present invention, the aggregation weight based on the client is used to aggregate and generate the global model, which is specifically as follows:

[0042] (10)

[0043] (11)

[0044] In formula (10) and (11), For Clients The aggregation weight of Indicates The size of the client's private dataset, Indicates The global model after round aggregation, Indicates The local model obtained after a round of local update training, subscript represents the j-th client.

[0045] Compared with the prior art, the present invention has the following beneficial effects:

[0046] (1) The present invention completely localizes the acquisition of global feature anchor points. Compared with the traditional method of first obtaining local feature anchor points through local models and then performing global aggregation to obtain global feature anchor points, the present invention eliminates the step of transmitting local feature anchor points, thus minimizing communication overhead.

[0047] (2) The method of the present invention only requires the local client to transmit its own local model to the server, and the server only needs to transmit the global model to the local client, that is, only the model is transmitted without transmitting other parameters, so that the communication cost between the client and the server is the same as the simplest federated learning method.

[0048] (3) The present invention utilizes the received global feature extractor to generate a global feature anchor on the client, and uses the global feature anchor to standardize the training of the local feature extractor. This technology not only enables the local feature extractor to have better generalization performance, but also better prevents the occurrence of privacy issues such as gradient leakage compared to some existing methods of aggregating and generating global feature anchors on the server.

[0049] (4) During local training, the present invention flexibly combines the feature extractors and classifiers of the local model with those of the global model, so that the entire model can learn the effective knowledge of the remaining client models while excellently completing local personalized tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 is a flow chart of the federated learning method described in the present invention.

[0051] Figure 2 It is a schematic diagram of the implementation process of the federated learning method described in Example 1 of the present invention.

[0052] Figure 3 This is a graph of experimental results when the client data set size is 100 and the proportion of clients participating in aggregation is 10% on the CINIC-10 data set in Example 1 of the present invention.

[0053] Figure 4 This is a graph of experimental results in Example 1 of the present invention when the client data set size is 200 on the CINIC-10 data set and the proportion of clients participating in aggregation is 10%.

[0054] Figure 5This is a graph of experimental results when the client data set size is 100 and the proportion of clients participating in aggregation is 50% on the CINIC-10 data set in Example 1 of the present invention. DETAILED DESCRIPTION

[0055] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments.

[0056] Embodiment 1,

[0057] In common hospital-related disease prediction and diagnosis applications in reality, or in financial-related fraud detection, there are N clients, each with its own local model. These clients hope to improve the effectiveness of their own models without sharing their own data, or hope to learn the knowledge implicit in other clients' data. Therefore, a federated learning method was developed. In the federated learning method, there is a server, and each client will transfer its local model trained based on the local data set to the server. The global model is generated by aggregating the local models in the server, thereby realizing the knowledge fusion of each local model. Therefore, the global model contains the knowledge in the data of each client, and then the global model is transmitted to the local client. After that, the client will use this global model when training the local model, so that the client can learn the knowledge in the data of other clients without sharing the data.

[0058] When the data of each client is heterogeneous, the effect of the local model trained by the above traditional federated learning method will be affected. After using the method proposed in the present invention, each client can obtain a local model with better effect, higher generalization and more stable performance.

[0059] This embodiment provides a federated learning method based on a flexible combination of a feature extractor and a classifier. The method steps are as follows: Figure 1 The specific implementation process is as shown in Figure 2 As shown, including:

[0060] S1. Server initializes the global model , and sends this global model to all the participants in federated learning Clients. [Local and global model initialization]

[0061] S2. During the first local model update training, each client updates the local model to the latest received global model, that is: If this is not the first local model update training, assume that If the local model is updated and trained, each client only updates the local feature extractor part in the local model to the global feature extractor part in the latest received global model, that is: , while the local classifier part is not updated, and the local classifier obtained through local training in the previous round continues to be used, that is: .

Local model update phase

[0062] S3. After the update is completed, the local model starts training. The local feature extractor and local classifier in the local model are trained separately, and the local classifier is trained first. At this time, only the parameters of the local classifier are changed. When training the local classifier, let the latest received global classifier guide the training of the local classifier in the form of knowledge distillation, that is: After the local classifier is trained, the local feature extractor is trained. At this time, only the parameters of the local feature extractor are changed. When training the local feature extractor, the global feature extractor in the global model generates a global feature anchor based on the client's current data set, and uses this global feature anchor to guide the training of the local feature extractor. At the same time, this design allows the local feature extractor to be combined and trained with the global classifier first, and then combined and trained with the local classifier, that is, combined training with the global classifier: , combined with local classifier training:

Local model training phase

[0063] S4: Each client uploads its trained local model and the size of its data set to the server. The size of the data set is uploaded to the server only after the first round of local update training, and there is no need to upload it in subsequent rounds. The server determines the client's aggregation weight based on the size of each client's data set, and aggregates and generates a global model based on this aggregation weight, that is: , After the aggregation is completed, the latest aggregated global model is sent to the clients participating in federated learning. [Global Model Aggregation]

[0064] After that, S2-S4 are repeated until the local model converges or the set communication round is reached.

[0065] A detailed introduction to the above content:

[0066] First, the terms and definitions used in the present invention are introduced.

[0067] In this paper, a federated learning scenario is considered, and it is assumed that There is a client and a server. The client and the server can communicate normally. Clients [The subscript in the formula ], No. Round local update training [the superscript in the formula 】, unless otherwise specified, the rest of the clients and the rest of the local update training rounds are the same as the first Client, The same situation as the local update training round, the client has its own private dataset There are a total of Each data is exists in the form of For The client has a local model and the most recently received global model, e.g. The local model obtained after a round of local update training , and Round local update training received before the global model .

[0068] Regarding feature extractors and classifiers. Client, Take the local update training of round as an example, and the other clients and rounds are the same.

[0069] Whether it is a global model or a local model, they have the same model structure. In the present invention, the last layer of the model is used as a classifier, and the combination of all layers except the last layer is used as a feature extractor. The feature extractor is used with ' 'Related symbols are used to represent the classifier. 'Related symbols are used to indicate, for example, The local feature extractor obtained after a round of local update training is expressed as , the local classifier is represented as ;No. The global feature extractor received before the local update training is expressed as , the global classifier is expressed as .

[0070] The present invention also defines a feature extraction function , and classification function , which are determined by the feature extractor and classifier respectively, and are also the abstraction of the function of the feature extractor and classifier. The local feature extraction function during the local update training is defined as , the global feature extraction function is defined as , the local classification function is defined as , the global classification function is defined as Here is a specific example of a local model. For this data, firstly, Input into the feature extraction function, that is , get the corresponding feature vector, and then input the feature vector into the classification function, that is, , and obtain the final classification prediction result.

[0071] Next, we will introduce the S2 local model update in detail. Client, Take the local update training of round as an example, and the other clients and rounds are the same.

[0072] During the update, the local feature extractor and the local classifier are updated separately. Except for the first local update training, the local classifier is updated with the global classifier. At other times, the local classifier is not updated with the global classifier, but the local classifier obtained from the last training of the previous round is used. The local feature extractor is updated with the latest local global feature extractor at any time.

[0073]

[0074]

[0075] At the same time, the present invention is to distinguish In the two phases of the round update training phase, the expression before training after defining the local update will be obtained with ' ',Right now Indicates that after The local feature extractor before training after rounds of local updates, Indicates that after The local classifier before training after a round of local updates.

[0076] Next, we will introduce the local model training in S3 in detail. Client, Take the local update training of round as an example, and the other clients and rounds are the same.

[0077] During the training period after the update is completed, the local feature extractor and the local classifier are trained separately, and the local classifier is trained first and then the local feature extractor. The expressions used in the training process are explained below. The whole process includes the following three expressions, and the training goal is to minimize the following three expressions:

[0078] Local classifier training:

[0079] ,

[0080] Local feature extractor training, combined with global classifier:

[0081] ,

[0082] Local feature extractor training, combined with local classifier:

[0083] .

[0084] First, we introduce the parts other than the regularization term, that is, , , ,in' ' represents the cross entropy loss,' ' means belonging to Small batch data,' 'Represents the gradient corresponding to the cross entropy loss,' ' represents the learning rate. After local training is completed, use and Represents the local feature extractor and the local classifier. At the same time, when the local feature extractor is trained, it is combined with the global classifier and the local classifier respectively, so the intermediate state is set Represents the state after the combined training of the local feature extractor and the global classifier and before the combined training of the local classifier.

[0085] Next, the regularization term is introduced, which is: , , ,in , When training the local classifier, the present invention uses the global classifier to guide the training of the local classifier by the method of knowledge distillation. First, the local classifier and the global classifier are combined with the local feature extractor. Here, the global classifier is equivalent to combining with the copy of the local feature extractor. Then, they are allowed to generate logits output under the same input. The logits output is the result of the global model and the local model before the normalization operation in the last layer. It is a dimensional vector, each dimension value after normalization represents the predicted probability of the corresponding class of this dimension, and the logits output corresponding to the global classifier is defined as , where the logits output of the kth dimension is , the logits output corresponding to the local classifier is , where the logits output of the kth dimension is , in obtaining and After that, they are normalized, and the logits output of the kth dimension produced by the global classifier is used Normalize it, is the normalized result, where is a hyperparameter; for the k-th dimension logits output produced by the local classifier, Normalize it, This is the normalized result. Other dimensions are normalized in the same way.

[0086] After obtaining the above each group has After obtaining two sets of normalized results, the values ​​in these two sets of results are calculated. Divergence, and add them up, that is ,in .

[0087] Each sample in is processed in the above way.

[0088] Next is the regularization term of the feature extractor. The present invention uses a global feature extractor to generate corresponding feature vectors based on the client data, and averages the feature vectors of each class to define the result as the global feature anchor point of this class, that is, .

[0089] in Indicated as belonging to The data characteristics of a certain data of a class, Indicates that it belongs to The number of data in each class, Indicates The global feature anchor points of the class are obtained in the same way.

[0090] After obtaining the global feature anchor, the following feature alignment operation is performed to constrain the training of the local feature extractor

[0091] ,

[0092] in represents the L2 norm, assuming that the dimension of the feature vector is , the calculation formula is:

[0093] .

[0094] Next, we introduce the global model generated by aggregation in S4. Take round aggregation as an example, the same applies to other rounds.

[0095] The aggregation weight is determined according to the size of the client data set. The uploaded local models are aggregated based on this weight to obtain the global model. The specific method is as follows:

[0096] , .

[0097] in Indicates The global model after round aggregation, For Clients The size of the data set (same for other clients), For Clients The aggregation weight of .

[0098] Summarize the changes in rounds, that is, the situation of superscripts, with the first Take a local client as an example:

[0099] First, the 0th server aggregation: the server initializes the global model , which contains the global classifier With global feature extractor , and sent to the local.

[0100] Then the first local feature extractor and local classifier are updated: after the update, the local feature extractor and local classifier are represented by ' ' and the superscript is '1' , .

[0101] Then the first local feature extractor and local classifier training is performed: After the training is completed, the local feature extractor and local classifier are represented as , , where after the local feature extractor is trained with the global classifier, before the local classifier is trained, it is expressed as .

[0102] Then the first server aggregation is performed: after aggregation, the global feature extractor and global classifier are expressed as , .

[0103] Subsequent rounds are the same as above.

[0104] Experimental testing

[0105] The experimental configuration and experimental results of the present invention include the following:

[0106] a. Dataset and model settings

[0107] The present invention conducts experiments on the CINIC-10 dataset, which contains a total of 270,000 images, evenly distributed in 10 classes. It combines images from two sources: ImageNet and CIFAR-10. The model used by the present invention has 3 convolutional layers, the number of filters is 16, 32 and 64 respectively, the convolution kernel size is 5, 5, 3, ReLU activation and maximum pooling are used, and finally a fully connected layer is used, which includes an intermediate layer and an output layer of 128 units.

[0108] b. Training settings and data segmentation

[0109] Set local iteration count for feature extractors and classifiers , 100 rounds of global communication, using mini-batch stochastic gradient descent ( ) as the local optimizer. The data is distributed using Dirichlet distribution. By adjusting Parameters that control the degree of data heterogeneity. The smaller it is, the higher the degree of heterogeneity.

[0110] c. Comparison of baseline and experimental results

[0111] Compare to baseline

[0112] Traditional local training without federated learning; the FedProx method that adds regularization terms related to the global model; the Ditto method that trains the global model and the local model at the same time; the FedAvg method with parameter fine-tuning; the LG-FedAvg, FedPer, FedRep, FedBABU and FedPAC methods with parameter decoupling.

[0113] Experimental Results

[0114] In order to better check the effectiveness of Example 1 of the present invention, an experiment is conducted in a resource-constrained environment: Assume that there are 20 clients participating in federated learning, but each client has only 100 or 200 samples, and the data heterogeneity rate is ,During global aggregation, the server only selects 10% or 50% of the clients to participate in the aggregation, such as Figure 3 , 4 As shown in , 5, 'Ours' is the present invention. The experimental results show that the average model accuracy of the present invention is 2-3% higher than that of the baseline.

Claims

1. A federated learning method based on a flexible combination of feature extractors and classifiers, characterized in that: The method comprises: S1. Global model initialization: The server initializes the global model , and sends this global model to all the participants in federated learning Clients; S2, local model update: During the first local model update training, each client updates the local model to the latest received global model; if it is not the first local model update training, each client updates the local feature extractor part in the local model to the global feature extractor part in the latest received global model, and the local classifier part is not updated, and the local classifier obtained after the last local model training continues to be used; S3, local model training: After the local model is updated, the local model starts to be trained. The local feature extractor and local classifier in the local model are trained separately, and the local classifier is trained first. When training the local classifier, the latest received global classifier is used to guide the training of the local classifier in the form of knowledge distillation. After the local classifier is trained, the local feature extractor is trained. When the local feature extractor is trained, the global feature extractor in the global model generates a global feature anchor based on the client's current data set, and uses this global feature anchor to guide the training of the local feature extractor. At the same time, the local feature extractor is first combined and trained with the global classifier, and then combined and trained with the local classifier; The global feature anchor point is obtained by using a global feature extractor to generate a corresponding feature vector based on the client data and averaging the feature vectors of each class; S4, global model aggregation: each client uploads its trained local model and the size of the data set to the server. The size of the data set is uploaded to the server only after the first round of local update training. The server determines the client's aggregation weight according to the size of each client's data set, and aggregates and generates a global model based on the client's aggregation weight. After the aggregation is completed, the latest aggregated global model is sent to the clients participating in federated learning; the data set is an image data set; S5. Repeat S2-S4 until the local model converges or reaches the set communication round.

2. A federated learning method based on a flexible combination of a feature extractor and a classifier according to claim 1, characterized in that: The global model and the local model have the same structure: the last layer of the global model and the local model is a classifier, and the remaining layers are combined into a feature extractor.

3. A federated learning method based on a flexible combination of a feature extractor and a classifier according to claim 1, characterized in that: When training the local classifier, the latest received global classifier is used to guide the training of the local classifier in the form of knowledge distillation. The formula is as follows: (1) In formula (1), the subscript Indicates Clients, superscript Indicates Round of local update training, represents the trained local classifier, represents the local classifier before training after update, represents the learning rate, represents the gradient corresponding to the cross entropy loss, represents the cross entropy loss, represents the local feature extractor before updating and training, Indicates that it belongs to the client dataset Small batches of data, is a hyperparameter, , ; Specifically, first combine the local classifier and the global classifier with the local feature extractor, and then let them generate logits output under the same input. The logits output is the result of the global model and the local model before the normalization operation in the last layer. The logits output is a dimensional vector, each dimension value after normalization represents the predicted probability of the corresponding class of this dimension, and the logits output corresponding to the global classifier is defined as , where the logits output of the kth dimension is , the logits output corresponding to the local classifier is , where the logits output of the kth dimension is , in obtaining and After that, they are normalized. The logits output of the kth dimension generated by the global classifier is normalized using the following formula: (2) In formula (2), is the normalized result, where is a hyperparameter, is the logits output of the kth dimension of the global classifier; The logits output of the kth dimension generated by the local classifier is normalized using the following formula: (3) In formula (3), is the normalized result, is the logits output of the kth dimension of the local classifier; After obtaining the above two sets of normalized results, the values ​​in these two sets of results are calculated. Divergence, and add them up, that is ,in (4) Each sample in is processed in the above way.

4. A federated learning method based on a flexible combination of feature extractors and classifiers according to claim 3, characterized in that: When the local feature extractor is trained, the local feature extractor and the global classifier are combined and trained as follows: (5) In formula (5), It represents the state after the combined training of the local feature extractor and the global classifier and before the combined training of the local classifier. represents the local feature extractor before updating and training, Indicates The global classifier received before the local update training, is a hyperparameter, Represented as the first client in the i-th client data set The data characteristics of a certain data of a class, represents the global feature anchor point, represents the L2 norm, Indicates Local feature extraction function of each client; The local feature extractor and local classifier are trained in combination as follows: (6) In formula (6), represents the trained local feature extractor, represents the L2 norm, Represented as the first client in the i-th client data set The data characteristics of a certain piece of data in a class; Specifically, a global feature extractor is used to generate corresponding feature vectors based on the client data, and the feature vectors of each class are averaged to define the result as the global feature anchor point of this class, that is, (7) In formula (7), represents the global feature anchor of the k-th class, Represented as the first client in the i-th client data set The data characteristics of a certain data of a class, Indicates the first client in the i-th client data set The number of data in each class, represents the global feature extraction function used during the tth round of local update training, It means the global feature extractor is obtained after the t-1th round of global aggregation; After obtaining the global feature anchor, the following feature alignment operation is performed to constrain the training of the local feature extractor (8) In formula (8), represents the L2 norm, Indicates The local feature extraction function during the local update training, represents or, the calculation formula is: (9) In formula (9), The dimension of the feature vector, Indicates or.

5. A federated learning method based on a flexible combination of a feature extractor and a classifier according to claim 4, characterized in that: The global model is generated by aggregation based on the client's aggregation weight, as follows: (10) (11) In formula (10) and (11), For Clients The aggregation weight of Indicates The size of the client's private dataset, Indicates The global model after round aggregation, Indicates The local model obtained after a round of local update training, subscript represents the j-th client.