Hierarchical double-branch aggregation personalized federal learning method for small sample scene
By employing a hierarchical, dual-branch, aggregated personalized federated learning approach, we have addressed the issues of insufficient model expressive power and poor adaptability to distribution shifts in small-sample scenarios, thereby achieving stronger personalized model adaptability and generalization capabilities.
Patent Information
- Application Number
- CN202511118158.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-11
- Publication Date
- 2025-11-14
AI Technical Summary
In small-sample scenarios, existing personalized federated learning methods lack effective modeling of neural network hierarchical structures, resulting in insufficient model expressive and transfer capabilities. At the same time, they rely too heavily on prior assumptions and are difficult to adapt to the frequently changing distribution shifts in federated environments.
A hierarchical dual-branch aggregation personalized federated learning method is adopted. By initializing the perceptual branch supernetwork and the representation branch supernetwork, hierarchical aggregation weights are generated. Combined with the importance matrix and the few-sample meta-learning strategy, the model parameter difference and client selection are optimized to achieve refined aggregation of personalized models.
It improves the model's adaptability and generalization ability under heterogeneous client data, enhances the model's robustness and generalization ability, adapts to the data distribution and inter-class differences of different clients, and optimizes the model aggregation strategy.
Smart Images

Figure CN120952206A_ABST
Abstract
Description
Technical Field
[0001] This invention designs personalized federated learning, few-shot learning, and hypernetworks. Specifically, it relates to a hierarchical, two-branch, aggregated personalized federated learning method for few-shot scenarios. Background Technology
[0002] Federated Learning (FL) has garnered significant attention due to its advantages in privacy protection and distributed training. Personalized Federated Learning (pFL), as an important branch of Federated Learning, aims to learn models that conform to the individual characteristics of each client while preserving privacy, thus addressing the issue of data heterogeneity among clients.
[0003] However, in the context of few-shot learning, existing personalized federated learning methods still face two main challenges. First, there is a lack of effective modeling of the hierarchical structure of neural networks. Many existing methods fail to fully utilize the hierarchical characteristics of neural networks, resulting in an insufficient trade-off between personalization and generalization, thus limiting the model's expressive and transfer capabilities. Second, there is an over-reliance on prior assumptions, leading to weak generalization ability. Although some emerging methods introduce inductive biases at the representation layer level, most methods rely on fixed assumptions, making it difficult to adapt to the frequently changing distribution shifts in federated environments.
[0004] No effective solutions have yet been proposed to address the problems in the relevant technologies. Summary of the Invention
[0005] To address the problems in related technologies, this invention proposes a hierarchical dual-branch aggregation personalized federated learning method for small-sample scenarios, characterized by overcoming the aforementioned technical problems existing in existing related technologies. The specific technical solution adopted by this invention is as follows:
[0006] A hierarchical dual-branch aggregation personalized federated learning method for few-sample scenarios is characterized by the following steps:
[0007] S1. The server initializes the importance matrix, the perceptual branch hypernetwork, and the representation branch hypernetwork.
[0008] S2. The server generates an embedding vector based on the client identifier of the target client in this round of training, and uses it as the input of the dual-branch supernetwork module to generate hierarchical aggregation weights. and
[0009] S3. The perception aggregation weight and the representation aggregation weight are weighted and fused to obtain the fused hierarchical aggregation weight;
[0010] S4. Based on the fused aggregate weights, the server calculates the model parameter difference between the current client and other clients, and then... Update the value at the corresponding position in the importance matrix A;
[0011] S5. Based on the updated importance matrix, the server selects several reference clients for the current client and collects the corresponding local model parameters as the reference client model Θ. i ;
[0012] S6. The server utilizes the generated hierarchical aggregation weight W i and the reference client model Θ i ,pass Obtain the personalized aggregated model parameters The model is then distributed to the target client.
[0013] S7. The target client, based on the received personalized model... The model is trained on a local dataset using a few-sample meta-learning strategy, and the local model parameters are updated accordingly.
[0014] S8. The server receives the update amount of the model parameters sent by the target client, and optimizes the client embedding vector and the parameters of the dual-branch hypernetwork based on the update amount.
[0015] S9. Repeat the above steps until the training termination condition is met.
[0016] Furthermore, the generation of hierarchical aggregation weights in S2 includes the following steps:
[0017] S21. The server generates an embedding vector v based on the target client's client identifier. i The intermediate feature vector z is generated through a fully connected network. i ;
[0018] S22, the intermediate feature vector z i The data are respectively input into the perceptual branch supernetwork and the representation branch supernetwork, and then... Generate hierarchical aggregation weights and
[0019] Furthermore, the weighted fusion in S3 includes the following steps:
[0020] S31, The server, based on the average Euclidean distance between the current client and other client models, through... The fusion coefficient α was obtained. i ;
[0021] S32. Based on the fusion coefficient, perform weighted fusion of the perceptual aggregation weight and the representation aggregation weight. The final hierarchical aggregation weight W is obtained. i ;
[0022] Furthermore, the S7 process employs a few-shot meta-learning strategy for training, which includes the following steps:
[0023] S71. Based on the small sample (N-way K-shot) settings, the client divides the local dataset into a support set and a query set;
[0024] S72. The feature encoding module deployed on the client maps the samples in the support set and query set to embedding vectors, and forms sample pairs with the query vector and N support vectors respectively.
[0025] S73. The similarity metric function deployed on the client calculates the similarity score for each sample pair.
[0026] S74. Optimize the model by constructing a cross-entropy loss function based on the similarity score: The model is encouraged to output the true class (y) on the query sample. q The prediction result with the highest similarity score.
[0027] S75. According to the loss function, the parameters of the feature encoding module and the similarity measurement function are updated locally using gradients.
[0028] S76. After multiple training rounds, the client calculates the model parameter update and sends it to the server.
[0029] The beneficial effects of this invention are as follows:
[0030] This invention proposes a hierarchical bi-branch aggregation personalized federated learning method for small-sample scenarios, and designs a novel personalized federated learning framework suitable for heterogeneous and insufficient data scenarios. This method introduces a bi-branch supernetwork structure, focusing on both perception and representation features separately, effectively improving the model's adaptability to heterogeneous client data and enhancing personalized generalization ability. The designed relation perception module achieves structure-independent category discrimination through an adaptive similarity function, possessing stronger generalization ability and robustness, adapting to different client data distributions and inter-class differences. The proposed client selection strategy based on a perception-representation hierarchical aggregation mechanism and parameter difference-driven approach constructs a more refined and differentiated personalized model, optimizing the model aggregation strategy. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Figure 1 This is an architecture diagram of the hierarchical dual-branch aggregation personalized federated learning method for small sample scenarios in this invention. Detailed Implementation
[0032] To further illustrate the various embodiments, the present invention provides accompanying drawings, which are part of the disclosure of the present invention. These drawings are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementation methods and the advantages of the present invention. The components in the drawings are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0033] According to embodiments of the present invention, a hierarchical dual-branch aggregation personalized federated learning method for small-sample scenarios is provided. The invention will now be further described in conjunction with the accompanying drawings and specific embodiments, such as... Figure 1 As shown, according to an embodiment of the present invention, a hierarchical dual-branch aggregation personalized federated learning method for small sample scenarios includes the following steps:
[0034] Step S1: The server initializes the importance matrix, the perceptual branch hypernetwork, and the representation branch hypernetwork;
[0035] This also includes the following steps:
[0036] [1] Initialize the importance matrix A as an N×N matrix of A = diag(1,…,1), where N represents the number of clients;
[0037] [2] Initialize the structures of the perceptual branch supernetwork and the representation branch supernetwork, wherein both supernetworks are CNN architectures with the same input but different structures. Specifically, the perceptual branch structure is shallower and has fewer parameters, while the representation branch is deeper and is used to model more complex feature representation capabilities.
[0038] Step S2: The server generates an embedding vector based on the client identifier of the target client in this round of training, which is used as the input of the dual-branch supernetwork module to generate l-level aggregation weights. and
[0039] This also includes the following steps:
[0040] [1] The client identifier of the target client is embedded into an embedding vector v through an embedding layer. i The client identifier is in ont-hot encoded form;
[0041] [2] Embedding vector v i An intermediate feature vector z is generated using a fully connected network. i , as input to subsequent supernetworks;
[0042] [3] The intermediate feature vector z i The data are respectively input into the perceptual branch supernetwork and the representation branch supernetwork, and then... Distributed generation of hierarchical aggregation weights and
[0043] Step S3: Perform weighted fusion of the perception aggregation weight and the representation aggregation weight to obtain the fused hierarchical aggregation weight;
[0044] This also includes the following steps:
[0045] [1] The server calculates the fusion coefficient based on the average Euclidean distance between the target client and the reference client model. Where θ i Let θ be the model parameters for the target client. j These are the model parameters for the reference client;
[0046] [2] Based on the fusion coefficient, through The perceptual aggregation weights and the representation aggregation weights are weighted and fused to obtain the final hierarchical aggregation weight W. i ;
[0047] Step S4: Based on the merged aggregate weights, the server calculates the importance of the target client relative to other clients, and then... Update the value at the corresponding position in the importance matrix A. Where L is the number of model layers. This represents the aggregation weight of the l-th layer in client j when it participates in the aggregation of client i. As a threshold for determining the magnitude of aggregate weights;
[0048] Step S5: Based on the updated importance matrix A, the server selects the k most important client models as reference clients for the target client, and collects the corresponding local model parameters as the reference client model Θ. i ;
[0049] Step S6: The server utilizes the generated hierarchical aggregation weight W i and the reference client model Θ i ,pass Achieve layer-by-layer aggregation to obtain personalized aggregated model parameters. The model is then distributed to the target client.
[0050] This also includes the following steps:
[0051] [1] The layer-by-layer aggregation is represented as in This represents the model parameters of the l-th layer after personalized aggregation. This represents the parameters of the l-th layer of the n-th model in the reference client model. This represents the aggregate weight of the l-th layer of the n-th model in the reference client model for the target client i.
[0052] Step S7: The target client, based on the received personalized model... The model is trained on a local dataset using a few-sample meta-learning strategy, and the local model parameters are updated accordingly.
[0053] This also includes the following steps:
[0054] [1] Based on the small sample settings of C-wayK-shot, the client divides the local dataset into a support set and a query set;
[0055] [2] Feature encoding module fθ deployed on the client i (·) Transfer samples x from the query set q Mapped to query embedding vector v q and the query embedding vector and C i Each of the 3 supporting embedding vectors forms a sample pair, where C i Represents the number of categories contained in the local dataset of client i;
[0056] [3] Similarity measurement function deployed on the client pass
[0057] g([v q ,v (c) ];φ i ),c∈1,…,C i Calculate the similarity score for each sample pair. This represents the similarity score obtained when the query embedding vector is in category c;
[0058] [4] The cross-entropy loss function is constructed based on the similarity score to optimize the model. The model is encouraged to output the true class (y) on the query sample. q The prediction result with the highest similarity score.
[0059] [5] Based on the loss function, the parameters of the feature encoding module and the similarity measurement function are locally updated to obtain the updated model parameters θ of the feature encoding module. i and the similarity measurement function model parameter φ i ;
[0060] [6] After multiple training rounds, the client calculates the update amount Δθ of the model parameters of the feature encoding module. i And send it to the server.
[0061] Step S8: The server receives the update amount Δθ of the model parameters of the feature encoding module sent by the target client. i And optimize the client embedding vector and the dual-branch hypernetwork parameters based on the update amount;
[0062] Step S9: Repeat the above steps until the training termination condition is met.
Claims
1. A hierarchical, dual-branch, aggregated, personalized federated learning method for small-sample scenarios, characterized in that, The method includes the following steps: S1. The server initializes the importance matrix, the perceptual branch hypernetwork, and the representation branch hypernetwork. S2. The server generates an embedding vector based on the client identifier of the target client in this round of training, and uses it as the input of the dual-branch supernetwork module to generate hierarchical aggregation weights. and S3. The perception aggregation weight and the representation aggregation weight are weighted and fused to obtain the fused hierarchical aggregation weight; S4. Based on the fused aggregate weights, the server calculates the model parameter difference between the current client and other clients, and then... Update the value at the corresponding position in the importance matrix A; S5. Based on the updated importance matrix, the server selects several reference clients for the current client and collects the corresponding local model parameters as the reference client model Θ. i ; S6. The server utilizes the generated hierarchical aggregation weight W i and the reference client model Θ i ,pass Obtain the personalized aggregated model parameters The model is then distributed to the target client. S7. The target client, based on the received personalized model... The model is trained on a local dataset using a few-sample meta-learning strategy, and the local model parameters are updated accordingly. S8. The server receives the update amount of the model parameters sent by the target client, and optimizes the client embedding vector and the parameters of the dual-branch hypernetwork based on the update amount. S9. Repeat the above steps until the training termination condition is met.
2. The hierarchical dual-branch aggregation personalized federated learning method for small sample scenarios according to claim 1, characterized in that, The generation of hierarchical aggregation weights in S2 includes the following steps: S21. The server generates an embedding vector v based on the target client's client identifier. i The intermediate feature vector z is generated through a fully connected network. i ; S22, the intermediate feature vector z i The data are respectively input into the perceptual branch supernetwork and the representation branch supernetwork, and then... Generate hierarchical aggregation weights and 3. The hierarchical dual-branch aggregation personalized federated learning method for small sample scenarios according to claim 1, characterized in that, The weighted fusion in S3 includes the following steps: S31, The server, based on the average Euclidean distance between the current client and other client models, through... The fusion coefficient α was obtained. i ; S32. Based on the fusion coefficient, perform weighted fusion of the perceptual aggregation weight and the representation aggregation weight. The final hierarchical aggregation weight W is obtained. i .
4. The hierarchical dual-branch aggregation personalized federated learning method for small sample scenarios according to claim 1, characterized in that, The S7 employs a few-sample meta-learning strategy for training, which includes the following steps: S71. Based on the small sample (N-way K-shot) settings, the client divides the local dataset into a support set and a query set; S72. The feature encoding module deployed on the client maps the samples in the support set and query set to embedding vectors, and forms sample pairs with the query vector and N support vectors respectively. S73. The similarity metric function deployed on the client calculates the similarity score for each sample pair. S74. Optimize the model by constructing a cross-entropy loss function based on the similarity score: The model is encouraged to output the true class (y) on the query sample. q The prediction result with the highest similarity score. S75. According to the loss function, the parameters of the feature encoding module and the similarity measurement function are updated locally using gradients. S76. After multiple training rounds, the client calculates the model parameter update and sends it to the server.