A federated learning method and system based on fine-grained layer sparsification and similarity-aware aggregation

By employing a federated learning approach that combines fine-grained layer sparsity and similarity-aware aggregation, the problems of high communication overhead and poor adaptability in federated learning for medical image analysis are addressed, achieving efficient model updates and key symptom detection.

CN120632609BActive Publication Date: 2026-07-31SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SOUTH CHINA UNIV OF TECH
Filing Date
2025-04-29
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In the field of medical image analysis, federated learning suffers from high communication overhead and poor model adaptability under non-independent and identically distributed data. In particular, how to reduce communication overhead and improve the detection accuracy of key diseases while ensuring model performance is a key challenge.

Method used

A federated learning method with fine-grained layer sparsity and similarity-aware aggregation is adopted. By finely filtering the parameters of each layer of the deep neural network, only key parameters are transmitted, and a similarity matrix is ​​constructed using Euclidean distance for model updates, which is dynamically adjusted to adapt to the data distribution of each client.

Benefits of technology

It effectively reduces the amount of communication data, improves the model's adaptability to non-independent and identically distributed data, enhances the detection accuracy of key diseases, and protects patient privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632609B_ABST
    Figure CN120632609B_ABST
Patent Text Reader

Abstract

This invention discloses a federated learning method and system based on fine-grained layer sparsity and similarity-aware aggregation. The method includes: training a personalized local model using a local private dataset and extracting feature maps from a specified feature extraction layer; calculating the sparsity of the feature maps to obtain feature sparsity; calculating the rate of change of the local model parameters during training, setting sparsity ratios for different layers of the local model to obtain a sparse mask matrix, sparsifying the local model to obtain a sparsified model; uploading the feature sparsity and the sparsified model to a server, so that the server constructs a similarity matrix, calculates a similarity index, weights the local model parameters of each client according to the similarity index, updates the local model parameters, and distributes them back to each client. This invention can effectively reduce communication overhead while improving the performance of personalized models, and is particularly suitable for scenarios with high data privacy protection requirements, such as medical image analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a federated learning method and system based on fine-grained layer sparsity and similarity-aware aggregation, belonging to the field of federated learning technology. Background Technology

[0002] In recent years, artificial intelligence technology has been increasingly applied in the medical field, with more and more medical image analysis tasks relying on large-scale local models to improve diagnostic accuracy. However, unlike natural image analysis, medical image analysis has always faced the challenge of "small sample size," making it difficult for researchers to accurately capture the true data distribution and hindering medical institutions from building robust and reliable medical image analysis models. The ideal solution to this problem is to integrate medical image data from multiple institutions into a large-scale dataset to train high-quality machine learning models. However, due to strict privacy policies that limit cross-institutional data sharing—for example, the HIPAA Act severely restricts the exchange of personal health data and images—this approach is difficult to implement in actual clinical practice. Federated learning, which protects patient privacy while supporting collaborative model training among medical institutions, has gradually become an important tool in the field of medical image analysis. However, medical images typically have high resolution and complex features; to accurately extract medical information, the model needs to include a large number of parameters. After each local training, the client (i.e., the medical institution) needs to upload a large number of updated parameters to the server, which dramatically increases communication overhead, becoming a major bottleneck restricting the efficient operation of federated learning systems. Therefore, how to reduce communication overhead while ensuring model performance has become a key issue for the application of federated learning in the medical field.

[0003] Current work on personalized federated learning in model compression mainly relies on quantization and sparsity techniques. Quantization methods reduce the amount of data transmitted by decreasing the precision of model parameters, thereby reducing communication overhead. However, in the medical field, medical image data is complex and high-resolution; low-precision quantization often results in the loss of crucial pathological information, affecting diagnostic accuracy. Sparsity methods, such as the TopK strategy, transmit only the local model parameters with the greatest variation to further reduce communication overhead. However, in cases where data is not independent and identically distributed, the features learned by each client during training differ significantly, and they may also have significant differences in their parameter selection for parameters with large gradient changes, making it difficult for the server to align these updates when aggregating the model. Furthermore, although hospitals have similar data categories for major diseases, the sample size for each disease often varies significantly, with some hospitals having very scarce data for key diseases. Traditional methods fail to fully utilize this limited but extremely important sample information, resulting in poor model performance in detecting key diseases. Therefore, there is an urgent need to propose a novel sparsity strategy that can reduce communication costs while addressing data heterogeneity and class imbalance, thereby improving the accuracy of key disease detection while ensuring model performance. Summary of the Invention

[0004] In view of this, the present invention provides a federated learning method, apparatus, system and storage medium based on fine-grained layer sparsity and similarity-aware aggregation, which retains complete parameter accuracy and avoids the loss of key information due to low bit quantization. The hierarchical dynamic sparsity strategy can more meticulously reflect the differences of each layer in different clients, avoiding the loss of important parameters and index misalignment caused by data heterogeneity.

[0005] The first objective of this invention is to provide a federated learning method based on fine-grained layer sparsity and similarity-aware aggregation.

[0006] The second objective of this invention is to provide a federated learning device based on fine-grained layer sparsity and similarity-aware aggregation.

[0007] The third objective of this invention is to provide a federated learning system based on fine-grained layer sparsity and similarity-aware aggregation.

[0008] A fourth objective of this invention is to provide a computer-readable storage medium.

[0009] The first objective of this invention can be achieved by adopting the following technical solution:

[0010] A federated learning method based on fine-grained layer sparsity and similarity-aware aggregation, applied to a client, includes:

[0011] Personalized local model training is performed using a local private dataset, and feature maps are extracted from a specified feature extraction layer.

[0012] Calculate the sparsity of the feature map to obtain the feature sparsity;

[0013] Calculate the rate of change of the local model parameters during training, and set the sparsity ratio for different layers of the local model according to the rate of change to obtain a sparse mask matrix;

[0014] The local model is sparsified using a sparse mask matrix to obtain a sparsified model.

[0015] The feature sparsity and sparse model are uploaded to the server so that after the server collects the feature sparsity and sparse model of all clients, it constructs a similarity matrix based on Euclidean distance, calculates the similarity index, weights the local model parameters of each client according to the similarity index, updates the local model parameters, and distributes the updated model parameters back to each client.

[0016] Furthermore, the feature map is extracted from the specified feature extraction layer as follows:

[0017] ;

[0018] in, For feature maps, For feature extraction layer, For local model parameters, Indicates the first One input sample, For the first The bias vector of the layer.

[0019] Furthermore, the calculation of the sparsity of the feature map to obtain the feature sparsity specifically includes:

[0020] The sparsity of each sample in the local private dataset is calculated as follows:

[0021] ;

[0022] in, and These are the height and width of the feature map, respectively;

[0023] Take the average value as the client In the passage The overall sparsity on the surface is as follows:

[0024] ;

[0025] in, The number of samples in the local private dataset. For the client A sample from a local private dataset.

[0026] Furthermore, the rate of change of the local model parameters during training is calculated as follows:

[0027] ;

[0028] in, For the rate of change, for The parameter set of the layer, for The amount of change in the layer parameters, , and They are respectively The state of the layer before and after the update.

[0029] Furthermore, the step of setting a sparsity ratio based on the rate of change for different layers of the local model to obtain a sparse mask matrix specifically includes:

[0030] The sparsity ratio is set according to the different layers of the local model based on the rate of change. When the rate of change of parameters in a certain layer is higher than the preset rate of change, a lower sparsity ratio is set for that layer, and the absolute value of the parameters is calculated. Quantiles as clipping thresholds ,when The absolute value of the layer's parameters is greater than the clipping threshold. When the mask value is 1, the corresponding mask value is 1; otherwise, it is 0, resulting in a sparse mask matrix. ;

[0031] The sparsification of the local model using a sparse mask matrix is ​​as follows:

[0032] ;

[0033] in, For the client Local model parameters.

[0034] Furthermore, the construction of the similarity matrix based on Euclidean distance and the calculation of the similarity index specifically include:

[0035] The similarity matrix is ​​constructed based on Euclidean distance, as shown in the following equation:

[0036] ;

[0037] in, For the client In the passage Feature sparsity, For the client In the passage Feature sparsity, For the client The feature sparsity vector, For the client The feature sparsity vector;

[0038] Based on the similarity matrix, the distribution similarity index for each client is calculated as follows:

[0039] ;

[0040] in, For the client Distribution similarity index, For the client Mean similarity with all other clients.

[0041] Furthermore, the step of weighting the local model parameters of each client according to the similarity index and updating the local model parameters specifically includes:

[0042] The local model parameters for each client are weighted according to a similarity index, as follows:

[0043] ;

[0044] in, For the client Distribution similarity index, and For clients local model and global model The accuracy on the current client validation set, where t is the t-th round of training. Used to quantify the performance difference between the two. This represents the proportion of the global model's contribution to the local model.

[0045] Update the local model parameters for each client as follows:

[0046] ;

[0047] in, For the client Updated local model parameters.

[0048] The second objective of this invention can be achieved by adopting the following technical solution:

[0049] A federated learning device based on fine-grained layer sparsity and similarity-aware aggregation, applied to a client, the device comprising:

[0050] The feature map extraction module is used to perform personalized local model training using a local private dataset and extract feature maps from a specified feature extraction layer.

[0051] The first calculation module is used to calculate the sparsity of the feature map and obtain the feature sparsity.

[0052] The second calculation module is used to calculate the rate of change of the local model parameters during the training process. Based on the rate of change, the sparsity ratio is set for different layers of the local model to obtain a sparse mask matrix.

[0053] The sparsification module is used to sparsify the local model using a sparse mask matrix to obtain a sparsified model.

[0054] The local model parameter update module is used to upload feature sparsity and sparse models to the server. After the server collects the feature sparsity and sparse models of all clients, it constructs a similarity matrix based on Euclidean distance, calculates the similarity index, weights the local model parameters of each client according to the similarity index, updates the local model parameters, and distributes the updated model parameters back to each client.

[0055] The third objective of this invention can be achieved by adopting the following technical solution:

[0056] A federated learning system based on fine-grained layer sparsity and similarity-aware aggregation, the system comprising: A client and a server, the server respectively connected to... One client is connected;

[0057] The client is used to execute the federated learning method described above;

[0058] The server is used to construct a similarity matrix based on Euclidean distance after collecting the feature sparsity and sparse models of all clients, calculate the similarity index, weight the local model parameters of each client according to the similarity index, update the local model parameters, and distribute the updated model parameters back to each client.

[0059] The fourth objective of this invention can be achieved by adopting the following technical solution:

[0060] A computer-readable storage medium storing a program that, when executed by a processor, implements the above-described federated learning method.

[0061] The present invention has the following advantages over the prior art:

[0062] 1. This invention proposes fine-grained layer sparsity, which involves finely filtering the parameters of each layer in a deep neural network and transmitting only the parameters most critical to the model's prediction results, thereby significantly reducing the amount of communication data. This is particularly suitable for bandwidth-constrained medical scenarios.

[0063] 2. Compared with traditional methods, this invention improves the aggregation method of federated learning. Through similarity awareness, it can dynamically adjust the model update strategy, making the model more consistent with the data distribution of each client and improving the model's adaptability to non-independent and identically distributed data.

[0064] 3. This invention utilizes the natural sparsity of neural networks to represent the client's original data, which not only protects patient privacy but also accurately reflects the statistical characteristics of the data distribution of each hospital, effectively preventing the risk of sensitive information leakage. Attached Figure Description

[0065] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art 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 the structures shown in these drawings without creative effort.

[0066] Figure 1 This is a schematic diagram of the federated learning system architecture based on fine-grained layer sparsity and similarity-aware aggregation in Embodiment 1 of the present invention.

[0067] Figure 2 This is a flowchart of the federated learning method based on fine-grained layer sparsity and similarity-aware aggregation in Embodiment 1 of the present invention.

[0068] Figure 3 This is a structural block diagram of the federated learning device based on fine-grained layer sparsity and similarity-aware aggregation according to Embodiment 2 of the present invention. Detailed Implementation

[0069] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0070] Example 1:

[0071] like Figure 1As shown, this embodiment provides a federated learning system based on fine-grained layer sparsity and similarity-aware aggregation. The system includes... Clients and servers ,server As a central server, respectively with Connecting multiple clients A client set consists of 1 client. Number The client has a local private dataset ,in Represents a data sample set. This represents the corresponding set of category labels; to learn this classification task, each client also has a neural network model as a local model, whose parameters are denoted as... .

[0072] like Figure 2 As shown, this embodiment provides a federated learning method based on fine-grained layer sparsity and similarity-aware aggregation. This method is mainly implemented through the aforementioned client and specifically includes the following steps:

[0073] S201. Perform personalized local model training using a local private dataset and extract feature maps from the specified feature extraction layer.

[0074] In this embodiment, each client Using local private datasets Perform personalized training to optimize its local model. ReLU is used to extract feature maps from a specified feature extraction layer, as shown in the following formula:

[0075] ;

[0076] in, For feature maps, For feature extraction layer, For local model parameters, Indicates the first One input sample, For the first The bias vector of a layer can help the model converge faster.

[0077] S202. Calculate the sparsity of the feature map to obtain the feature sparsity.

[0078] All clients calculate the sparsity of each sample in their local private dataset, as follows:

[0079] ;

[0080] in, and These represent the height and width of the feature map, respectively.

[0081] Take the average value as the client In the passage The overall sparsity on the surface is as follows:

[0082] ;

[0083] in, The number of samples in the local private dataset. For the client A sample from a local private dataset.

[0084] Therefore, the client The sparsity vector calculated based on local data is This vector reflects the sparsity of the client's features on the selected important channels and serves as its privacy-preserving distribution representation. Subsequently, each client uploads the calculated sparsity vector to the server for subsequent similarity analysis without sharing any original data.

[0085] S203. Calculate the rate of change of the local model parameters during the training process, and set the sparsity ratio for different layers of the local model according to the rate of change to obtain a sparse mask matrix.

[0086] In this embodiment, all clients calculate the rate of change of their local model parameters during training. Let the parameter set of a certain layer be... The states of this layer before and after the parameter update are as follows: and Then the parameter change of this layer is Normalizing it yields the rate of change:

[0087] ;

[0088] Finally, the set of parameter change rates for each layer is: The sparsity ratio is set according to the rate of change for different layers of the model. When the rate of change of parameters in a certain layer exceeds the preset rate of change, it indicates that the layer has undergone significant adjustments during local training. The client will then set a lower sparsity ratio for that layer, and calculate the absolute values ​​of the parameters. Quantiles as clipping thresholds ,when The absolute value of the layer's parameters is greater than the clipping threshold. When the mask value is 1, the corresponding mask value is 1; otherwise, it is 0, resulting in a sparse mask matrix. .

[0089] S204. Sparsify the local model using a sparse mask matrix to obtain a sparsed model.

[0090] In this embodiment, all clients use a sparse mask matrix to sparsify the local model, as shown in the following equation:

[0091] ;

[0092] S205. Upload the feature sparsity and sparsification model to the server.

[0093] All clients will use feature sparsity and sparsification model After uploading to the server, the server collects the feature sparsity and sparsified models from all clients, and then constructs a similarity matrix based on Euclidean distance, as shown below:

[0094] ;

[0095] in, For the client In the passage Feature sparsity, For the client In the passage Feature sparsity, For the client The feature sparsity vector, For the client The feature sparsity vector.

[0096] A reference client is randomly selected, and then the Euclidean distances of other clients relative to that reference client are calculated. Specifically, clients are first randomly selected. As a reference client, its distribution representation is then calculated. The Euclidean distance between the distributions of other clients is used to generate a similarity vector. In this vector, if A lower value indicates that the client With the client The data distributions are quite similar; at the same time, if and If the values ​​are close, then the client can be inferred. and The data distribution is also similar.

[0097] The server calculates the Distribution Similarity Index (DSI) for each client based on the similarity matrix, representing the degree of similarity between different clients, as shown in the following formula:

[0098] ;

[0099] in, For the client Distribution similarity index, For the client Mean similarity with all other clients.

[0100] The server weights the local model parameters of each client according to a similarity index and updates the local model parameters as follows:

[0101] ;

[0102] in, For the client Distribution similarity index, and For clients local model and global model The accuracy on the current client validation set, where t is the t-th round of training. Used to quantify the performance difference between the two. This indicates the proportion of the global model's contribution to the local model.

[0103] The server updates the local model parameters for each client as follows:

[0104] ;

[0105] in, For the client Updated local model parameters.

[0106] The server distributes the updated local model parameters back to each client, repeating steps S201~S205 until convergence.

[0107] It should be noted that although the method operations of the above embodiments are described in a specific order, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the described steps may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0108] Example 2:

[0109] like Figure 3As shown, this embodiment provides a federated learning device based on fine-grained layer sparsity and similarity-aware aggregation, which is applied to the client and includes a feature map extraction module 301, a first calculation module 302, a second calculation module 303, a sparsity module 304, and a local model parameter update module 305. The specific functions of each module are as follows:

[0110] The feature map extraction module 301 is used to perform personalized local model training using a local private dataset and extract feature maps from a specified feature extraction layer.

[0111] The first calculation module 302 is used to calculate the sparsity of the feature map and obtain the feature sparsity.

[0112] The second calculation module 303 is used to calculate the rate of change of the local model parameters during the training process, and to set the sparsity ratio according to the rate of change for different layers of the local model to obtain a sparse mask matrix.

[0113] The sparsification module 304 is used to sparsify the local model using a sparse mask matrix to obtain a sparsified model.

[0114] The local model parameter update module 305 is used to upload the feature sparsity and sparse model to the server, so that after the server collects the feature sparsity and sparse model of all clients, it constructs a similarity matrix based on Euclidean distance, calculates the similarity index, weights the local model parameters of each client according to the similarity index, updates the local model parameters, and distributes the updated model parameters back to each client.

[0115] It should be noted that the device provided in this embodiment is only an example of the above-described division of functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure can be divided into different functional modules to complete all or part of the functions described above.

[0116] Example 3:

[0117] This embodiment provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the federated learning method of Embodiment 1 above, as follows:

[0118] Personalized local model training is performed using a local private dataset, and feature maps are extracted from a specified feature extraction layer. The sparsity of the feature maps is calculated to obtain feature sparsity. The rate of change of the local model parameters during training is calculated, and a sparsity ratio is set for different layers of the local model based on the rate of change to obtain a sparse mask matrix. The local model is sparsified using the sparse mask matrix to obtain a sparsified model. The feature sparsity and the sparsified model are uploaded to the server, so that after the server collects the feature sparsity and the sparsified model from all clients, it constructs a similarity matrix based on Euclidean distance, calculates a similarity index, weights the local model parameters of each client according to the similarity index, updates the local model parameters, and distributes the updated model parameters back to each client.

[0119] It should be noted that the computer-readable storage medium in this embodiment can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor device, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.

[0120] In this embodiment, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used or combined with an instruction execution device, apparatus, or device. In this embodiment, the computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable storage medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use or combined with an instruction execution device, apparatus, or device. The computer program contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0121] The computer-readable storage medium described above can be used to write computer programs for executing this embodiment in one or more programming languages ​​or combinations thereof. These programming languages ​​include object-oriented programming languages—such as Java, Python, and C++—and conventional procedural programming languages—such as C or similar programming languages. The program can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0122] In summary, this invention provides an efficient and feasible federated learning solution for privacy-sensitive tasks such as medical image analysis by reducing communication overhead, enhancing personalized modeling capabilities, and improving privacy protection. It has been verified to perform excellently on multiple medical datasets.

[0123] The above description is merely a preferred embodiment of the present invention. It will be apparent to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects. The scope of the present invention is defined by the appended claims rather than the foregoing description, and thus all variations falling within the meaning and scope of the equivalents of the claims are intended to be included within the present invention.

Claims

1. A federated learning method based on fine-grained layer sparsity and similarity-aware aggregation, applied to a client, characterized in that... The method includes: Personalized local model training is performed using a local private dataset, and feature maps are extracted from a specified feature extraction layer. Calculate the sparsity of the feature map to obtain the feature sparsity; Calculate the rate of change of the local model parameters during training, and set the sparsity ratio for different layers of the local model according to the rate of change to obtain a sparse mask matrix; The local model is sparsified using a sparse mask matrix to obtain a sparsified model. The feature sparsity and sparse model are uploaded to the server so that after the server collects the feature sparsity and sparse model of all clients, it constructs a similarity matrix based on Euclidean distance, calculates the similarity index, weights the local model parameters of each client according to the similarity index, updates the local model parameters, and distributes the updated model parameters back to each client. The step of weighting the local model parameters of each client according to a similarity index and updating the local model parameters specifically includes: The local model parameters for each client are weighted according to a similarity index, as follows: ; in, For the client Distribution similarity index, and Clients respectively local model and global model The accuracy on the current client validation set, where t is the t-th round of training. Used to quantify the performance difference between the two. This represents the proportion of the global model's contribution to the local model. Update the local model parameters for each client as follows: ; in, For the client Updated local model parameters.

2. The federated learning method of claim 1, wherein, The feature map is extracted from the specified feature extraction layer as follows: ; in, For feature maps, For feature extraction layer, For local model parameters, Indicates the first One input sample, For the first The bias vector of the layer.

3. The federated learning method of claim 1, wherein, The calculation of the sparsity of the feature map, to obtain the feature sparsity, specifically includes: The sparsity of each sample in the local private dataset is calculated as follows: ; wherein, and are the height and width of the feature map, respectively. Taking the average as the client On the channel Overall sparsity on the channel, as follows: ; in, The number of samples in the local private dataset. For the client A sample from a local private dataset.

4. The federated learning method of claim 1, wherein, The rate of change of the local model parameters during training is calculated as follows: ; wherein, is a rate of change, is a parameter set of the layer, is a parameter change amount of the layer, , and are a state before and after the layer update, respectively.

5. The federated learning method of claim 1, wherein, The process of setting a sparsity ratio based on the rate of change for different layers of the local model to obtain a sparse mask matrix specifically includes: The sparsity ratio is set according to the different layers of the local model based on the rate of change. When the rate of change of parameters in a certain layer is higher than the preset rate of change, a lower sparsity ratio is set for that layer, and the absolute value of the parameters is calculated. Quantiles as clipping thresholds ,when The absolute value of the layer's parameters is greater than the clipping threshold. When the mask value is 1, the corresponding mask value is 1; otherwise, it is 0, resulting in a sparse mask matrix. ; The sparsification of the local model using a sparse mask matrix is ​​as follows: ; wherein, is the local model parameter for the client .

6. The federated learning method of claim 1, wherein, The construction of the similarity matrix based on Euclidean distance and the calculation of the similarity index specifically include: The similarity matrix is ​​constructed based on Euclidean distance, as shown in the following equation: ; in, For the client In the passage Feature sparsity, For the client In the passage Feature sparsity, For the client The feature sparsity vector, For the client The feature sparsity vector; Based on the similarity matrix, the distribution similarity index for each client is calculated as follows: ; wherein, is the distribution similarity index for the client is the distribution similarity index for the client is the distribution similarity index for the client is the distribution similarity index for the client 7. A federated learning device based on fine-grained layer sparsification and similarity-aware aggregation, applied to a client, characterized in that, The device includes: The feature map extraction module is used to perform personalized local model training using a local private dataset and extract feature maps from a specified feature extraction layer. The first calculation module is used to calculate the sparsity of the feature map and obtain the feature sparsity. The second calculation module is used to calculate the rate of change of the local model parameters during the training process. Based on the rate of change, the sparsity ratio is set for different layers of the local model to obtain a sparse mask matrix. The sparsification module is used to sparsify the local model using a sparse mask matrix to obtain a sparsified model. The local model parameter update module is used to upload feature sparsity and sparse model to the server. After the server collects the feature sparsity and sparse model of all clients, it constructs a similarity matrix based on Euclidean distance, calculates the similarity index, weights the local model parameters of each client according to the similarity index, updates the local model parameters, and distributes the updated model parameters back to each client. The step of weighting the local model parameters of each client according to a similarity index and updating the local model parameters specifically includes: The local model parameters for each client are weighted according to a similarity index, as follows: ; in, For the client Distribution similarity index, and Clients respectively local model and global model The accuracy on the current client validation set, where t is the t-th round of training. Used to quantify the performance difference between the two. This represents the proportion of the global model's contribution to the local model. Update the local model parameters for each client as follows: ; wherein, for the client updated local model parameters.

8. A federated learning system based on fine-grained layer sparsification and similarity-aware aggregation, characterized in that, The system includes a client and a server, the server being connected to a client, respectively; The client is used to execute the federated learning method according to any one of claims 1-6; The server is used to construct a similarity matrix based on Euclidean distance after collecting the feature sparsity and sparse models of all clients, calculate the similarity index, weight the local model parameters of each client according to the similarity index, update the local model parameters, and distribute the updated model parameters back to each client.

9. A computer readable storage medium storing a program, characterized in that, When the program is executed by the processor, it implements the federated learning method according to any one of claims 1-6.