Prototype network-based iterative clustering federated learning method

By adopting an iterative clustering federated learning method based on prototype networks, the problem of poor clustering results caused by heterogeneous user category distribution is solved, personalized federated training is achieved, and user clustering results and model training performance are improved.

CN115049076BActive Publication Date: 2025-12-09UNIV OF SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210824020.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-13
Publication Date
2025-12-09
Estimated Expiration
2042-07-13

AI Technical Summary

Technical Problem

Existing federated learning methods have failed to effectively address the problem of heterogeneous category distribution among users, resulting in poor clustering performance and failing to meet the needs of personalized federated learning.

Method used

An iterative clustering federated learning method based on prototype networks is adopted. The global prototype network is trained on the user side and the user embedding representation vector and category distribution are calculated. The server side determines the user clustering results based on the model distance and performs global model parameter aggregation. The process is repeated until the convergence condition is met.

Benefits of technology

It improves user clustering performance, is applicable to scenarios with heterogeneous user category distribution, enables personalized federated training, and optimizes model training performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115049076B_ABST
    Figure CN115049076B_ABST
Patent Text Reader

Abstract

The present disclosure provides a prototype network-based iterative clustering federated learning method, which comprises: a user end receiving a global prototype network sent by a server end; the user end training the global prototype network according to a local sample data set and determining a user embedding representation vector and a user category distribution, wherein each user has one user embedding representation vector; the user end sending the trained global prototype network, the user embedding representation vector and the user category distribution to the server end, so that the server end performs the following operations: determining a model distance based on the trained global prototype network according to the user embedding representation vector and the user category distribution; determining a user clustering result according to the model distance, and then performing global model parameter aggregation to obtain the latest global model parameters; and performing the above steps for T rounds of circulation until the global prototype network trained by the prototype network-based iterative clustering federated learning method meets a preset convergence condition.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of federated learning and distributed personalized model training, and in particular to an iterative clustering federated learning method based on a prototype network. BACKGROUND

[0002] With the awakening of the public's awareness of data privacy and the introduction of relevant laws, the data privacy and security problem of machine learning has gradually become prominent, which makes it very difficult to collect a large amount of labeled data sets. The emergence of federated learning makes it possible for end users to jointly train machine learning models using local data. In the paradigm of traditional federated learning algorithms, all users jointly train a unique global model in a distributed manner, and the model is then deployed to all end users.

[0003] In the process of implementing the present disclosure, the inventors found that at least the following technical problems exist in the related art: The data heterogeneity problem between users makes it impossible to train only one global model to meet the data distribution of all users, and the current clustering federated learning method does not take into account the class distribution heterogeneity between users, i.e., the class distribution is imbalanced and inconsistent, which makes the clustering accuracy of users low and cannot achieve excellent user clustering effect, and cannot meet the demand of personalized federated learning. SUMMARY

[0004] In view of the above problems, the present disclosure provides a personalized federated learning method, which can be applied to the user class distribution heterogeneity scenario and an iterative clustering federated learning method based on a prototype network to improve the user clustering effect. The method clusters user groups based on data distribution differences, realizes personalized federated learning training, can be applied to the user class distribution heterogeneity scenario, and improves the user clustering effect of the clustering federated learning method.

[0005] The present disclosure provides a prototype network-based iterative clustering federated learning method (PN-ICFL), comprising: step S1, a user end receives a global prototype network of the current round sent by a server end; step S2, the user end trains the global prototype network according to a local sample data set and determines a user embedding representation vector and a user category distribution, wherein each user has one user embedding representation vector; step S3, the user end sends the trained global prototype network, the user embedding representation vector and the user category distribution to the server end, so that the server end performs the following operations: determining a model distance based on the trained global prototype network according to the user embedding representation vector and the user category distribution; determining a user clustering result according to the model distance, and then performing global model parameter aggregation to obtain the latest global model parameters, wherein the global model comprises the global prototype network model and a plurality of global category prototype matrices; and step S4, steps S1 to S3 are cyclically executed for T rounds until the global prototype network trained by the prototype network-based iterative clustering federated learning method meets a preset convergence condition, wherein T is an integer greater than 1.

[0006] According to an embodiment of the present disclosure, the server end is further configured to perform the following operations: obtaining an initial global prototype network; and pre-training the initial global prototype network using a public sample data set to obtain the global prototype network.

[0007] According to an embodiment of the present disclosure, the user embedding representation vector comprises a category prototype of each category of sample data set in the local sample data set in the global prototype network.

[0008] According to an embodiment of the present disclosure, the server end further comprises a plurality of clustering clusters, and the determination of the model distance based on the trained global prototype network comprises: determining a model distance between the user and the clustering cluster according to the user category distribution, the category prototype of each category of sample data set in the local sample data set in the global prototype network, and the global category prototype matrix in the clustering cluster.

[0009] According to an embodiment of the present disclosure, the server end further comprises the following operations: determining the shortest model distance between the user and the clustering cluster based on the principle of the shortest model distance; determining a target clustering cluster according to the shortest model distance; determining the user clustering result according to the target clustering cluster; and performing global model parameter aggregation according to the user clustering result to obtain the latest global model parameters.

[0010] According to an embodiment of the present disclosure, the user end performs local updating according to a local sample data set, and training the global prototype network includes: determining a number of meta-learning tasks according to a meta-learning training method; dividing the local sample data set according to the number of meta-learning tasks; selecting sample data from the divided local sample data set to form support set data and query set data; and training the global prototype network according to the support set data and the query set data.

[0011] According to an embodiment of the present disclosure, a user embedding representation vector is calculated for each user, and the server end can determine a model distance based on the trained global prototype network according to the user embedding representation vector and the user category distribution; and determine a user clustering result according to the model distance. Because the user embedding representation vector and the user category distribution are considered in the process of calculating the model distance, and the user clustering is performed according to the obtained model distance, the problem of unbalanced and inconsistent user category distribution can be effectively addressed, so it can be applied to a user distribution heterogeneous scene to realize personalized federated training. At least partially overcome the problem of low clustering accuracy in the related art due to not considering the class distribution heterogeneity between users, and achieve the technical effects of optimizing the user clustering effect and improving the performance of personalized model training. BRIEF DESCRIPTION OF DRAWINGS

[0012] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure, taken in conjunction with the accompanying drawings, in which:

[0013] Figure 1 A system architecture diagram of the prototype network-based iterative clustering federated learning method according to an embodiment of the present disclosure is schematically shown;

[0014] Figure 2 A flowchart of the prototype network-based iterative clustering federated learning method according to an embodiment of the present disclosure is schematically shown;

[0015] Figure 3 A diagram of the model distance based on the prototype network according to an embodiment of the present disclosure is schematically shown;

[0016] Figure 4 A framework diagram of the prototype network-based iterative clustering federated learning method according to an embodiment of the present disclosure is schematically shown;

[0017] Figure 5 A local test sample data set according to an embodiment of the present disclosure is schematically shown;

[0018] Figure 6 A curve diagram of the average test accuracy changing with the number of communication rounds in a small sample data scene according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0019] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It is to be understood, however, that the description is merely exemplary and is intended to provide a thorough understanding of the present disclosure. In the following detailed description of embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure. However, it would be apparent to those skilled in the art that the present disclosure can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring aspects of the present disclosure.

[0020] The terms used herein are merely used to describe specific embodiments and are not intended to limit the present disclosure. The terms "include" and "have" and the like used herein indicate the presence of the described features, steps, operations, and / or components but do not preclude the presence or addition of one or more other features, steps, operations, or components.

[0021] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present specification, and should not be interpreted in an idealized or excessively formal manner.

[0022] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should generally be interpreted to include at least one of each item enumerated, in the sense of including, e.g., at least one of A, at least one of B, at least one of C, combinations thereof, etc. In the case of using expressions similar to "at least one of A, B, or C, etc.", it should generally be interpreted to include at least one of each item enumerated, in the sense of including, e.g., at least one of A, at least one of B, at least one of C, combinations thereof, etc.

[0023] With the awakening of public awareness of data privacy and the introduction of relevant laws, the data privacy and security problem of machine learning has gradually become prominent, which makes it very difficult to collect a large amount of labeled data sets. The emergence of federated learning makes it possible for end users to jointly train machine learning models using local data. In the paradigm of traditional federated learning algorithms, all users jointly train a unique global model in a distributed manner, which is then deployed to all end users. However, the data heterogeneity problem between users makes it impossible to train a global model that meets the data distribution of all users. Therefore, in recent years, some personalized federated learning methods have been proposed one after another.

[0024] In real scenarios, personalized bias such as region, culture, and gender may lead to different data distributions of users. Clustered federated learning considers this factor and regards user groups as being generated by multiple different global feature distributions, and then clusters users according to the similarity of user data distribution to achieve personalized training at the cluster level. Existing clustered federated learning algorithms can be roughly divided into two categories, namely hierarchical clustered federated learning algorithms and iterative clustered federated learning algorithms. The hierarchical clustered federated learning algorithm can include the CFL (Clustered Federated Learning) framework published in IEEE Transactions on neural networks and learning systems in 2020, the CIF-FL (Class Imbalance-Aware Clustered Federated Learning) framework published in DASFAA 2020, and the IFCA (Iterative Federated Clustering Algorithm) framework published in NIPS 2020. These algorithms all use certain techniques to achieve user clustering and personalized training without directly accessing user data. However, the existing hierarchical clustered federated learning algorithm requires multi-stage federated training, has high computational cost, many hyperparameters, and poor real-time performance. The iterative method IFCA framework conforms to the training paradigm of the traditional FedAvg (Federated Learning) algorithm, and since it requires end users to perform local testing on all global cluster models, it also incurs additional communication cost. The current clustered federated learning method has not yet considered the problem of heterogeneous class distribution between users, i.e., the problem of class distribution imbalance and inconsistency (also known as Label Non-IID). In addition, in the small sample data scenario where user samples are scarce, the existing above-mentioned methods cannot perform excellent user clustering effect and cannot meet the requirements of personalized federated learning.

[0025] In view of this, this disclosure provides a personalized federated learning method, specifically, an iterative clustering federated learning method based on prototype networks, which is applicable to heterogeneous user distribution scenarios and optimizes the clustering effect on users. The method may include: Step S1, the user terminal receives the current round of global prototype network sent by the server; Step S2, the user terminal trains the global prototype network and determines the user embedding representation vector and user category distribution based on the local sample dataset, wherein each user has a user embedding representation vector; Step S3, the user terminal sends the trained global prototype network, user embedding representation vector, and user category distribution to the server, so that the server performs the following operations: determining the model distance based on the trained global prototype network according to the user embedding representation vector and user category distribution; determining the user clustering result according to the model distance; and aggregating the global model parameters according to the user clustering result to obtain the latest global model parameters, wherein the global model includes the global prototype network and multiple global class prototype matrices; Step S4, repeating Steps S1 to S3 for T rounds until the global prototype network trained using the iterative clustering federated learning method based on the prototype network satisfies the preset convergence condition, wherein T is an integer greater than 1.

[0026] It should be noted that the collection, storage, use, processing, transmission, provision, disclosure, and application of user personal information in this disclosed technical solution comply with relevant laws and regulations, necessary confidentiality measures have been taken, and it does not violate public order and good morals. In this disclosed technical solution, user authorization or consent has been obtained before acquiring or collecting user personal information.

[0027] Figure 1 The diagram schematically illustrates a system architecture diagram of an iterative clustering federated learning method based on a prototype network according to an embodiment of the present disclosure.

[0028] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a client server 104, and a cloud server 105.

[0029] Terminal devices 101, 102, and 103 can be various electronic devices in public or independent environments, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0030] Various communication client applications can be installed on terminal devices, such as applications that cluster users based on federated learning models, shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).

[0031] Users can perform operations through the client applications of terminal devices 101, 102, and 103, such as item recommendation and item recognition. Based on these operations, terminal devices 101, 102, and 103 can send a request to the user server 104 to cluster users, so that the user server 104 can train the item recommendation model and item recognition model based on the federated learning model according to the iterative clustering federated learning method based on the prototype network.

[0032] The client server 104 can be connected to the terminal devices 101, 102, 103 and the cloud server 105 via wired or wireless communication links or fiber optic cables, etc.

[0033] The client server 104 and the cloud server 105 can be servers providing various services. In one embodiment, the client server 104 can receive the current-round global prototype network sent by the cloud server; the client server 104 trains the current-round global prototype network based on the local sample dataset and determines the user embedding vector and user category distribution; the client server 104 uploads the trained global prototype network and the determined user embedding vector and user category distribution to the cloud server 105; the cloud server 105 can determine the model clustering based on the trained global prototype network according to the user embedding vector and user category distribution, and determine the user clustering result according to the model distance; based on the user clustering result, global model parameters are aggregated to obtain the latest global model parameters. The above method is executed T times in a loop until the federated learning model trained using the iterative clustering federated learning method based on the prototype network meets the preset convergence condition. The client server 104 can also feed back the user clustering result to the terminal devices 101, 102, and 103.

[0034] It should be noted that the iterative clustering federated learning method based on prototype networks provided in this disclosure can generally be executed by the client server 104. The iterative clustering federated learning method based on prototype networks provided in this disclosure can also be executed by a server or server cluster that is different from the client server 104 and is capable of communicating with terminal devices 101, 102, 103 and / or the client server 104.

[0035] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0036] The following will be based on Figure 1 The described scene, through Figures 2 to 6 A detailed description is provided of the federated learning method based on a prototype network according to the disclosed embodiments.

[0037] Figure 2 A flowchart of a prototype network-based federated learning method according to an embodiment of the present disclosure is shown.

[0038] As shown in Figure 2 The prototype network-based federated learning method of this embodiment includes steps S1-S4.

[0039] In step S1, the user end receives the global prototype network of the current round sent by the server end.

[0040] In step S2, the user end trains the global prototype network according to the local sample data set and determines the user embedding representation vector and the user category distribution, wherein each user has one user embedding representation vector.

[0041] In step S3, the user end sends the trained global prototype network, the user embedding representation vector, and the user category distribution to the server end, so that the server end performs the following operations: determines the model distance based on the trained global prototype network according to the user embedding representation vector and the user category distribution; determines the user clustering result according to the model distance; and performs global model parameter aggregation according to the user clustering result to obtain the latest global model parameters, wherein the global model includes the global prototype network and a plurality of global category prototype matrices.

[0042] In step S4, steps S1-S3 of T rounds are cyclically executed until the global prototype network trained by the prototype network-based iterative clustering federated learning method meets the preset convergence condition, wherein T is an integer greater than 1.

[0043] According to an embodiment of the present disclosure, the prototype network-based federated learning method can perform multiple rounds. The global prototype network of the current round can be the global prototype network of the current round downloaded or received by the user end from the server end in the training process of each round.

[0044] According to an embodiment of the present disclosure, the local sample data set can be a multi-classification data set, and the local sample data set can include user interests and hobbies, user behavior operation data on a terminal device, feature data of multiple complex types of objects, etc. The local data set can also be adaptively adjusted according to actual application scenarios.

[0045] According to an embodiment of the present disclosure, the user embedding representation vector can be a class prototype of each class sample data set in the first training sample data set in the global prototype network. The user category distribution can be the category distribution of the local sample data set. The learning method can construct a user embedding representation vector for each user based on the user class prototype output by the global prototype network, which is conducive to realizing personalized federated training of users.

[0046] According to an embodiment of the present disclosure, the user end can also train the received prototype network to update the global prototype network, and upload the updated global prototype network to the server end.

[0047] According to an embodiment of the present disclosure, the model distance can be the distance between the user and the clustering cluster, used to measure the data (feature) distribution difference between the user and the clustering cluster. In the case of the shortest model distance, the clustering cluster corresponding to the shortest model distance can be taken as the user clustering result after clustering the user.

[0048] According to an embodiment of the present disclosure, the prototype network-based federated learning method provided by the embodiment of the present disclosure can also be used to train other models, for example, various item recommendation models, image recognition models, text recognition models, etc.

[0049] According to an embodiment of the present disclosure, the preset convergence condition can be judged according to the loss function. In the case that the loss result of the loss function represents the convergence condition, it can be considered that the preset convergence condition is met. In an embodiment of the present disclosure, the prototype network can be defined as h θ : Wherein D and M are the original sample feature size and the prototype network space feature size respectively, and θ is the parameter of the prototype network. The loss function can be as shown in formula (1).

[0050]

[0051] Wherein, represents the global class prototype matrix of the jth cluster, is the class prototype of the kth class in the cluster.{S1,…,S K is the current clustering division. Based on the original optimization target of the prototype network, when the machine learning task is multi-classification, the loss function F j (θ, E j , S j ) corresponding to each cluster can be defined as formula (2).

[0052]

[0053] Wherein, h θ (x) is the feature representation of the original sample x in the prototype network space, d(,) function is a distance measurement function, is the set of the kth class samples in the local data set of all users in the current cluster S j , and are the class prototypes of the k-th and k'-th classes in the j-th cluster, respectively. Then, assuming that the distance metric function d(,) is the square of the Euclidean distance, the model parameters θ in formula (1) are alternately optimized using the idea of the Expectation Maximization (EM) algorithm, E 1 ,…,E k and the latent variables {S1,…,S K}.

[0054] According to an embodiment of the present disclosure, the preset convergence condition can also be a loss function corresponding to the federated learning model. When the loss result of the loss function corresponding to the federated learning model indicates convergence, the training of the federated learning model by the federated learning method based on the prototype network can also be ended.

[0055] According to an embodiment of the present disclosure, a preset number of iterations can also be set. When the preset number of iterations is looped, the training of the federated learning model by the federated learning method based on the prototype network can also be ended. The preset number of iterations can also be adaptively adjusted according to actual needs.

[0056] According to an embodiment of the present disclosure, after the execution of the federated learning method based on the prototype network and the iterative clustering is ended, the user clustering result and the model parameters of the trained prototype network can be output simultaneously.

[0057] According to an embodiment of the present disclosure, a user embedding representation vector is calculated for each user, and the server side can determine the model distance based on the trained global prototype network according to the user embedding representation vector and the user class distribution. The user clustering result is determined according to the model distance. Because the user embedding representation vector and the user class distribution are considered in the process of calculating the model distance, and the user clustering is divided according to the obtained model distance, the problem of unbalanced and inconsistent user class distribution can be effectively addressed. Therefore, it can be applied to the user class distribution heterogeneous scene caused by factors such as small amount of user data, identity difference or limited sample acquisition capability, and personalized federated training can be realized. At least partially overcome the problem of low clustering accuracy in related technologies due to the unconsidered class distribution heterogeneity between users, and achieve the technical effects of optimizing user clustering effect and improving personalized model training performance.

[0058] According to an embodiment of the present disclosure, in the training task of some item recommendation models, different users may have different evaluations or labels for the same thing due to regional and age differences, for example, different age groups may have different evaluations for the same movie; regional differences may also cause users to have different degrees of love for different tastes of food. By using the personalized federated training method provided in the embodiment of the present disclosure, that is, using the iterative clustering federated learning method based on the prototype network in the process of training the item recommendation model, the user groups can be clustered into different clusters from the perspective of age or region according to the evaluation habits, behavior data, and the like of the users, so as to accurately classify the users, and then the accuracy of the item recommendation model in recommending items or recommendation information can be improved.

[0059] According to an embodiment of the present disclosure, in the training task of some lightweight image recognition models or character recognition models, mobile terminal devices (for example, mobile phones) can usually only deploy lightweight neural networks due to the limited computing and storage capabilities, however, the personal data of users may have different styles due to regional, identity, or sampling device differences, and the data distribution is complex and diverse, for example, various styles of numbers, characters, plant and flower recognition, pet recognition, or other picture recognition, and the like. The model complexity of the lightweight model is limited, and it is difficult to simultaneously fit the distribution of all training data, resulting in a low prediction accuracy of the lightweight model of the mobile terminal device. By using the personalized federated training method provided in the embodiment of the present disclosure, that is, using the iterative clustering federated learning method based on the prototype network, different types of data can be modeled in the case of complex data distribution, and different types of data can be accurately clustered, thereby improving the prediction accuracy of the lightweight model.

[0060] According to an embodiment of the present disclosure, in the case where there is a confrontation user, for example, in some scenarios, under the condition of privacy constraints, when there is a behaviorally abnormal user in distributed training, such behaviorally abnormal users may perform malicious writing through incorrect intention labeling samples, and the like, which may affect the decision of the federated model finally obtained, and such users are generally referred to as confrontation users. In this case, by using the personalized federated training method provided in the embodiment of the present disclosure, that is, using the iterative clustering federated learning method based on the prototype network, the user groups can be accurately clustered into correct users and confrontation users, which can play a role in defending malicious attacks.

[0061] According to an embodiment of the present disclosure, the server end can also obtain an initial global prototype network; and the initial global prototype is trained by using a public sample data set to obtain a global prototype network.

[0062] According to embodiments of this disclosure, the initial global prototype network may include four convolutional blocks, each of which may include a convolutional layer, a batch normalization layer, and a ReLU activation function layer. The server can pre-train the prototype network using a second training sample dataset. Specifically, pre-training can be performed using a meta-learning training method, with the meta-learning task as the training unit, to obtain the prototype network parameters θ. (0) Pre-training the initial global prototype network allows it to become a spatial mapping function capable of generalizing to other related tasks. This function can ensure that samples of the same class have a relatively short Euclidean distance for subsequent federated training data. The pre-trained global prototype network can then serve as the initial parameters for an iterative clustering federated learning framework based on the prototype network.

[0063] According to embodiments of this disclosure, the user embedding representation vector can be the class prototype of each class of sample dataset in the local sample dataset in the global prototype network. Specifically, the user embedding representation vector of user i can be as shown in Equation (3).

[0064]

[0065] in, It can be as shown in formula (4).

[0066]

[0067] in, Represents the local dataset of user i The k-th class of sample subset In the prototype network θ space, the class prototype, T, can represent the iteration round number.

[0068] According to embodiments of this disclosure, the server side includes multiple clusters; determining the model distance based on the user embedding identifier and user category distribution includes: determining the model distance between the user and the cluster based on the user category distribution, the class prototype of each class of sample dataset in the local sample dataset in the trained global prototype network, and the global class prototype matrix in the cluster.

[0069] Figure 3 A schematic diagram illustrating model distance based on a prototype network according to an embodiment of the present disclosure is shown.

[0070] like Figure 3 As shown, the server can use the user embedding representation vector u of user i as a basis. i With the category distribution vector p i (y) Calculate the distance between user i and K clusters or the global cluster model, which can also be understood as calculating the distance between user i and the (global) class prototype matrix {E}.j distance d i1 distance d i2 distance d iK The specific calculation formula of the model distance can be shown in formula (5).

[0071]

[0072] wherein d ij is the model distance between the user i and the jth global cluster model, p i (y=k) is the class distribution vector of the local data set of the user i, C is the total number of classes, represents the class prototype of the kth class sample subset in the local data set of the user i in the prototype network θ space, is the kth class prototype in the jth global cluster model.

[0073] wherein the class distribution vector p i (y) = [p i (y=1), …, p i (y=K)] T The class distribution vector p i (y) can be calculated based on the empirical proportion of each class sample in the local sample data set.

[0074]

[0075] wherein, and represent the kth class sample subset and the k′th class sample subset in the local data set of the user i respectively.

[0076] Since the model distance d ij explicitly considers the class distribution p i (y=k) of the user, it can effectively deal with the scenario of class distribution imbalance and inconsistency, i.e., class distribution heterogeneity, and thus can realize personalized federated training.

[0077] According to an embodiment of the present disclosure, operation S230 can further include: determining the shortest model distance between the user and the clustering cluster based on the shortest model distance principle; determining the target clustering cluster according to the shortest model distance; determining the user clustering result according to the target clustering cluster; and performing global model parameter aggregation according to the user clustering result to obtain the latest global model parameter.

[0078] ​According to an embodiment of the present disclosure, according to the shortest model distance, the identification of the associated clustering cluster, for example, the cluster identification, can be determined, specifically, by the shortest model distance, the global class prototype matrix corresponding to the model distance can be considered as the target global class prototype matrix, because each clustering cluster can correspond to a global class prototype matrix, the clustering cluster corresponding to the target global class prototype matrix can be considered as the target clustering cluster, and the user clustering result can be the target clustering cluster. It can also be understood that the user clustering result is the clustering cluster corresponding to the sample user, and the user can be clustered into the clustering cluster.

[0079] According to an embodiment of the present disclosure, training the global prototype network according to the local sample data set comprises: determining the number of meta-learning tasks according to the meta-learning training method; dividing the local sample data set according to the number of meta-learning tasks; selecting sample data from the divided local sample data set to form support set data and query set data; and training the global prototype network according to the support set data and the query set data.

[0080] According to an embodiment of the present disclosure, when updating the global prototype network, the prototype network parameters θ, the learning rate μ, the number of iterations E, and the number of user meta-learning tasks B can be input; and the updated prototype network parameters θ, the category distribution vector p i (y) can be output. Specifically, the meta-learning task may include support set and query set In the training data set , the data set can be divided into B small sample meta-learning tasks, and the training samples used in the support set and the query set are selected from the divided data set to form support set data and query set data. According to the support set data, the class prototype is calculated based on the support set , and according to the query set data, the loss function related to the training of the prototype network is calculated based on the query set . The calculation process of the loss function can be shown in formula (7), and the prototype network is updated based on the loss function . The update process can be shown in formula (8). Finally, the user end can upload the u i , p i (y), and the updated prototype network parameters θ (t) to the server end.

[0081]

[0082]

[0083] wherein, represents the query set The sample subset with the label k, the function d(,) is a distance metric function, d(,) adopts the Euclidean distance, c k and c k′ respectively represent the support set The class prototype of the kth sample subset and the k'th sample subset in the prototype network θ space.

[0084] Figure 4 The framework schematic diagram of the iterative clustering federated learning method based on the prototype network according to the embodiments of the present disclosure is schematically shown.

[0085] As Figure 4 shown in the figure, in each round of federated training, the user end can first download the current global prototype network θ (t) , calculate the user embedding representation vector u i and perform local update (the rightmost in the figure). In this framework, the operation of the user end includes calculating the user embedding representation and locally updating the prototype network parameters, and the operation of the server end includes pre-training the prototype network, calculating the model distance between the user and the clustering cluster, estimating the clustering identification, and aggregating the model parameters. Specifically, each user can update the prototype network θ locally in the meta-learning training manner. After the server receives the user uploaded , it calculates the model distance d ij for each "user i-clustering cluster j" pair, estimates the clustering identification s i , and performs model aggregation based on the model distance and the clustering identification (the leftmost in the figure).

[0086] Figure 5 The local test sample data set according to the embodiments of the present disclosure is schematically shown. The figure contains four kinds of digital data sets, two kinds of handwritten data sets MNIST and USPS, one real street view digital data set SVHN, and one sign language digital data set SIGN. Each data set represents a global feature distribution in the clustering federated learning problem, that is, a kind of personalized bias. The local data set of each user can be generated from one of the four data sets, and the server end can also sample the users to obtain one or more data of the four data sets. The iterative clustering federated learning method based on the prototype network of the present disclosure can also be used as a preprocessing step of other federated learning-based recognition models, and can cluster the features of various types of digital, text, characters, pets, plants, etc. to improve the recognition accuracy of the recognition model.

[0087] According to the embodiments of the present disclosure, the clustering federated learning is mainly used to solve the feature distribution heterogeneity problem in data distribution heterogeneity. Feature distribution heterogeneity refers to the different sources of user data distribution in federated learning, which can also be regarded as the class conditional distribution of data, or the different feature distributions, such as Figure 5The multi-source digital data set shown includes four different forms of digital data sets, each of which can be regarded as a personalized bias. The goal of the present disclosure is to cluster the user group under the premise of unknown user real feature distribution, so that users with the same feature distribution are clustered into the same cluster for federated training to achieve personalization.

[0088] According to an embodiment of the present disclosure, the iterative clustering federated learning method based on the prototype network can also be operated as follows: input the number of clusters K, the number of users N, the number of communication rounds T, the number of local update rounds E, the local learning rate μ, the number of user meta-learning tasks B, and the common data set G; the output can be a global prototype network θ (T) , K global class prototype matrices , and the clustering division result of the user group {S1,..., S K K}. Specifically, in the training process of the iterative clustering federated learning model based on the prototype network, the server side can pre-train the initial prototype network using the public data set G to obtain θ (0) ; the server side initializes K global class prototype matrices The server side samples users to obtain a user set participating in training in the current round Specifically, the sampling strategy can also be adaptively adjusted according to actual conditions; the user downloads the current prototype network parameters θ (t) from the server side, calculates the user embedding representation u i of itself, updates the prototype network in a meta-learning training manner, which can refer to the above-mentioned method of updating the prototype network, and then the user side can upload u i , p i (y), and the updated prototype network parameters θ (t) to the server side; the server receives u i , p i (y), and the updated prototype network parameters θ (t), the model distance between the user and the cluster, estimate the user clustering identifier, and aggregate the global model parameters based on the user clustering result, the global model parameters including a global prototype network and a global class prototype matrix, the aggregating the global model parameters based on the user clustering result can include: aggregating the global class prototype matrix based on the user clustering result and aggregating the global prototype network based on the user clustering result, wherein the process of estimating the user clustering identifier can be as shown in formula (9), the process of aggregating the global class prototype matrix based on the user clustering result can be as shown in formula (10), and the process of aggregating the global prototype network can be as shown in formula (11); after determining the model distance, the clustering identifier of this round, and aggregating the model parameters based on the clustering result, the next round of federated training can be entered. After the federated training meets the convergence condition, the federated training can be ended, and a global prototype network θ (T) , K global class prototype matrices The clustering division result of the user group is {S1,…,S K}.

[0089] s i ←argmin j∈[K] d ij (9)

[0090] wherein s i represents the clustering identifier, and the argmin function is used to determine the shortest model distance.

[0091]

[0092] wherein t represents the iteration round number, represents the global class prototype matrix of the jth global cluster model in the t+1th round, is the kth class prototype in the jth global cluster model in the t+1th round, p i (y=k) and p r (y=k) respectively represent the class distribution of the user i and the user r, represents the class prototype of the user i in the prototype network θ space in the tth round, S j represents the user set of the jth clustering cluster in this round, i.e. the current clustering division.

[0093]

[0094] wherein θ (t+1) may represent the global prototype network parameter in the t+1th round, may represent the global prototype network parameter updated by the user i in the tth round, represents the sampling user set.

[0095] According to embodiments of this disclosure, the iterative clustering federated learning method based on prototype networks can output a global prototype network θ. (T) K global class prototype matrices And the clustering results of user groups {S1,…,S K During model training, user i can download the s-th generation model from the server. i Global class prototype matrix of each cluster and global prototype network parameters θ (T) The test sample x is mapped to the prototype network to obtain the feature representation h. θ (x), then based on The shortest distance principle is used to predict user categories. For new users who have not participated in federated training, when using this prototype-based iterative clustering federated learning method to cluster them, the local dataset is first used to calculate the new user's embedding vector and user category distribution. Then, the server estimates the cluster identifier for the new user based on the embedding vector and category distribution. The global class prototype matrix obtained from the cluster identifier is then sent to the user, which can be understood as feeding back the cluster corresponding to the new user to the user. This new user can then be used as a test sample in federated training. It can be noted that since the global class prototype matrix downloaded from the server contains class prototypes for all categories, the user can also predict samples with missing categories in the local dataset during the training phase.

[0096] According to embodiments of this disclosure, the user computes the user embedding representation vector u locally. i Then, it can be immediately compared with the category distribution vector p. i (y) is sent to the server. Therefore, while the server calculates the model distance and aggregates the global class prototypes using the latest clustering partition, each user can perform local updates locally. This improves the parallelism of the training process and can save training time to some extent. This disclosure example assumes that the class distribution information is not privacy-sensitive and can be uploaded to the server by the user.

[0097] Figure 6 The diagram illustrates a graph showing the average test accuracy as a function of the number of communication rounds in a small sample data scenario according to an embodiment of the present disclosure.

[0098] like Figure 6where Local model is a personalized model trained by a user based on a local dataset, and FedFoMo is a kind of personalized federated learning algorithm, which achieves SOTA results on most heterogeneous datasets at present. In this scenario, the iterative clustering federated learning model based on a prototype network (PN-ICFL) provided by the embodiments of the present disclosure has the optimal test result, and the test accuracy close to 0.7 is reached when the number of communication rounds T = 5. By comparing the average test accuracy of other algorithms on the multi-source digital dataset Figure 6 ) of the present disclosure, the superiority of the method proposed in the embodiments of the present disclosure in the small sample scenario is proved.

[0099] According to the embodiments of the present disclosure, the iterative clustering federated learning method based on a prototype network provided by the embodiments of the present disclosure models the clustering federated learning problem based on the prototype network method, and proposes a "model distance based on a prototype network". Since the model distance can be directly calculated or estimated at the server side, compared with another existing iterative algorithm IFCA, the download communication cost of each round of communication of the user in the PN-ICFL framework is lower (about 1 / K); since the calculation of the model distance directly considers the class distribution information of the user, the PN-ICFL model can effectively deal with the scenario of class distribution heterogeneity (Label Non-IID); and since the prototype network model of the meta-learning method is used, the PN-ICFL model can effectively deal with the small sample data scenario (such as Figure 6 ) as shown).

[0100] According to the embodiments of the present disclosure, since the present disclosure has the advantages of low communication volume and being suitable for small sample data and class distribution heterogeneous data scenarios, the present disclosure can be applied to the training of a mobile personalized federated learning model with limited communication capability in reality, and the user can be quickly clustered and trained according to the data characteristics of the user. In addition, the user clustering operation of the present disclosure can also be used as a preprocessing step of other related federated learning algorithms, for example, in a recommendation system, the user groups are clustered according to the data similarity to obtain different clustering clusters, which respectively represent different personalized preferences, and then different operations are performed on each clustering cluster to form a multi-stage processing.

[0101] It should be noted that, unless it is explicitly stated that there is an execution sequence between different operations or there is an execution sequence between different operations in terms of technical implementation, the execution sequence of multiple operations can not be distinguished, and multiple operations can be executed simultaneously.

[0102] It should also be noted that the directional terms mentioned in the embodiments, such as "upper", "lower", "front", "back", "left", "right", etc., are only the directions of the drawings, and are not intended to limit the protection scope of the present disclosure. Throughout the drawings, the same elements are denoted by the same or similar reference numerals. When it may cause confusion to the understanding of the present disclosure, the conventional structures or configurations will be omitted.

[0103] The shapes and the sizes of the components in the drawings do not reflect the actual sizes and proportions, but only illustrate the contents of the embodiments of the present disclosure. Furthermore, the word "comprise" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" before an element does not exclude the presence of multiple such elements.

[0104] Similarly, it should be understood that, in order to simplify the present disclosure and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present disclosure, various features of the present disclosure are sometimes grouped together in a single embodiment, figure, or description thereof. However, the method of the present disclosure should not be interpreted as reflecting the intention that the claimed present disclosure requires more features than those explicitly recorded in each claim. Rather, as reflected in the following claims, the inventive aspects are in less than all the features of the single embodiment of the preceding invention. Therefore, the claims following the specific embodiments are hereby expressly incorporated into the specific embodiments, wherein each claim itself is a separate embodiment of the present disclosure.

[0105] Those skilled in the art can understand that the features recorded in various embodiments and / or claims of the present disclosure can be combined or / and combined in various combinations, even if such combinations or combinations are not explicitly recorded in the present disclosure. In particular, the features recorded in various embodiments and / or claims of the present disclosure can be combined and / or combined in various combinations without departing from the spirit and teachings of the present disclosure. All these combinations and / or combinations fall within the scope of the present disclosure.

[0106] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A prototype network-based iterative clustering federated learning method, comprising: Step S1, a user end receiving a global prototype network sent by a server end, wherein the global prototype network is used for clustering users; Step S2, the user end training the global prototype network and determining a user embedding representation vector and a user category distribution according to a local sample data set, wherein each user has one user embedding representation vector, and the local sample data set includes user interests, user behavior operation data on a terminal device, a handwriting data set, a real street view digital data set, and a sign language digital data set; Step S3, the user end sending the trained global prototype network, the user embedding representation vector, and the user category distribution to the server end, so that the server end performs the following operations: determining a model distance based on the trained global prototype network according to the user embedding representation vector and the user category distribution, wherein the model distance includes a distance between a user and a clustering cluster; determining a user clustering result according to the shortest distance between the user and the clustering cluster, and then performing global model parameter aggregation to obtain the latest global model parameters, wherein the global model includes the global prototype network and a plurality of global category prototype matrices; Step S4, Steps S1 to S3 are cyclically executed for T rounds until the global prototype network trained by the prototype network-based iterative clustering federated learning method meets a preset convergence condition, and the obtained global prototype network is used for user clustering, wherein T is an integer greater than 1, and the federated learning method is used to train at least one of various item recommendation models, image recognition models, and text recognition models; The user embedding representation vector includes a category prototype of each category of sample data set in the local sample data set in the global prototype network. The server end further includes a plurality of clustering clusters, each corresponding to a global category prototype matrix; and the determination of the model distance between the user and the clustering cluster based on the trained global prototype network includes the determination of the model distance between the user and the clustering cluster based on the user category distribution, the category prototype of each category of sample data set in the local sample data set in the global prototype network, and the global category prototype matrix in the clustering cluster. The server end further includes the following operations: determining the shortest model distance between the user and the clustering cluster based on the shortest model distance principle; determining a target clustering cluster according to the shortest model distance; determining the user clustering result according to the target clustering cluster; and performing global model parameter aggregation according to the user clustering result to obtain the latest global model parameters.

2. The method of claim 1, wherein, The server end is further configured to perform the following operations: Obtaining an initial global prototype network; Pre-training the initial global prototype network using a public sample data set to obtain the global prototype network.

3. The method of claim 1, wherein, The user end performs local update and trains the global prototype network according to the local sample data set. According to the meta-learning training method, the number of meta-learning tasks is determined; According to the number of meta-learning tasks, the local sample data set is divided; Sample data is selected from the divided local sample data set to form support set data and query set data; According to the support set data and the query set data, the global prototype network is trained.