A model decoupling federated learning method and system based on frequency analysis
By decoupling the image classification model into a common feature layer and a personalized classification layer, and by utilizing frequency analysis and dynamic clustering techniques, the model accuracy and convergence issues in Non-IID data scenarios are addressed, achieving efficient image classification and privacy protection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2026-04-10
- Publication Date
- 2026-07-31
AI Technical Summary
In non-independent identically distributed (Non-IID) data scenarios, federated learning faces problems such as poor global model return capability and parameter update conflicts, resulting in decreased model accuracy and low convergence efficiency.
By dividing the image classification model into a common feature layer and a personalized classification layer, and adopting a model decoupling federated learning method based on frequency analysis, the parameter update amount is transformed to the frequency domain using Discrete Cosine Transform (DCT), client clustering is performed based on low-frequency feature vectors, and dynamic clustering is performed by combining affinity propagation algorithm (AP) to eliminate update direction conflicts and upload only the parameters of the common feature layer.
It significantly improves the classification accuracy and convergence efficiency of the model in Non-IID data scenarios, enhances privacy protection, improves the robustness and accuracy of the model, and adapts to different degrees of data heterogeneity.
Smart Images

Figure CN122021811B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and distributed machine learning technology, and in particular to a model decoupling federated learning method and system based on frequency analysis. Background Technology
[0002] Federated Learning (FL), as a privacy-preserving distributed machine learning framework, allows participating parties to jointly train a model without sharing the original data. However, in practical applications, the data from different clients often exhibit statistical heterogeneity (i.e., non-independent and identically distributed, Non-IID), which poses a significant challenge to federated learning algorithms (such as FedAvg). This is especially true in Non-IID scenarios, where the data distributions of each client differ significantly, making it difficult for a single global model to capture the local features of all clients, resulting in poor generalization ability and decreased model accuracy. Furthermore, during parameter aggregation, the gradients or parameter update directions calculated by different clients based on heterogeneous data may be completely opposite (e.g., one wants to increase a certain weight, while another wants to decrease it). If this divergence is not reconciled during the aggregation phase, it can lead to an "update cancellation effect," resulting in decreased convergence efficiency and even hindering model performance improvement. Summary of the Invention
[0003] To overcome the problems of poor global model return capability and parameter update conflict in federated learning under non-independent and identically distributed (Non-IID) data scenarios, this invention proposes a model decoupling federated learning method based on frequency analysis. By improving the model's adaptability to local heterogeneous data through model structure and local segmented training, the classification accuracy of the model in non-independent and identically distributed (Non-IID) data scenarios is improved.
[0004] This invention proposes a model decoupling federated learning method based on frequency analysis, comprising the following steps: S1. Determine the image classification model deployed on the client and divide the image classification model into a common feature layer and a personalized classification layer; S2. Each client receives the update amount of the common parameters and adds it to the local common feature layer; the initial value of the update amount of the common parameters is 0. S3. Each client performs segmented training on the common feature layer and personalized classification layer of the image classification model on the local dataset {image samples; recognition results}. S4. Determine whether the update count of the common parameter update quantity has reached the set value; If yes, then the training ends; No, proceed to step S5; S5. Each client uploads the parameter update amounts of the common feature layer before and after local training and aggregates them. The server assigns the aggregated parameter update amounts to the common parameter update amounts and then returns to step S2. In step S5, the clients are first clustered, and then the average value of the parameter update amount within the cluster is taken as the common parameter update amount corresponding to the cluster. In step S2, each cluster client receives the common parameter update amount corresponding to its cluster and superimposes it onto the local common feature layer. The method for clustering clients in step S5 is as follows: calculate the parameter update amount of the common feature layer of each client before and after the most recent local training and flatten it into a one-dimensional signal; perform frequency domain transformation on the flattened parameter update amount to obtain frequency domain data; extract a set proportion of data from the frequency domain data as low-frequency feature vectors according to the order of frequency from low to high; and cluster clients based on the low-frequency feature vectors.
[0005] Preferably, the method for clustering clients based on low-frequency feature vectors in step S5 is as follows: first, calculate the cosine similarity between any two clients based on the low-frequency feature vectors, and then use the affinity propagation algorithm to cluster the clients based on the cosine similarity.
[0006] Preferably, the flattened parameter update is converted into frequency domain data using discrete cosine transform, and the calculation formula is as follows: ; ; Where F(j,i) is the i-th value in the frequency domain data of the j-th client. Let be the i-th value in the flattened parameter update quantity of the j-th client, N be the number of parameters in the flattened parameter update quantity, and c(i) be the compensation coefficient.
[0007] Preferably, the output layer of the image classification model is used as the personalized classification layer, and the remaining layers are used as the common feature layer.
[0008] Preferably, the method for segmented training of the image classification model on the local dataset {image samples; recognition results} in step S3 is as follows: first, freeze the common feature layer, and update the personalized classification layer N0 times on the local dataset; then freeze the personalized classification layer, and update the common feature layer N1 times on the local dataset, where N1>N0.
[0009] The present invention proposes an image classification method based on model decoupling federated learning. First, the image classification model on the client is trained using the frequency analysis-based model decoupling federated learning method. Then, the image to be identified is input into the client, and the image classification model performs image recognition and outputs the recognition result.
[0010] The present invention proposes an image classification system based on model decoupling federated learning, comprising a memory and a processor. The memory stores a computer program, and the processor is connected to the memory. The processor is used to execute the computer program to implement the image classification method based on model decoupling federated learning.
[0011] The present invention proposes a storage medium storing a computer program, which, when executed, is used to implement the image classification method based on model decoupling federated learning.
[0012] The advantages of this invention are: (1) The present invention proposes a model decoupling federated learning method based on frequency analysis, which improves the model's adaptability to local heterogeneous data through a personalized mechanism of model decoupling (dividing a common feature layer and a personalized classification layer). Simultaneously, due to parameter decoupling, the client only uploads the parameters of the common feature layer, while the personalized classification layer remains local. Attackers can only obtain incomplete model information, increasing the difficulty of inferring user privacy data from model parameters and enhancing privacy protection.
[0013] (2) This invention clusters clients with similar update directions by client clustering, so that clients in the same cluster can jointly optimize the common feature layer, eliminating the "cancellation effect" caused by opposite update directions, and significantly improving the convergence efficiency and final accuracy of the model.
[0014] (3) This invention clusters based on low-frequency feature similarity, avoiding high-frequency noise and training randomness interference, and can accurately measure the similarity of client model update direction, thereby aggregating client models with consistent update direction, solving the problem that different clients have inconsistent update directions of common layer parameters due to data heterogeneity, which leads to a decrease in model performance after aggregation.
[0015] (4) Combining the characteristics of deep neural networks prioritizing the learning of low-frequency information and the fact that noise is mostly concentrated in high frequencies, this invention introduces Discrete Cosine Transform (DCT) to transform the model update difference to the frequency domain and extract low-frequency components as client features. Utilizing DCT to extract low-frequency energy from parameter updates effectively filters out high-frequency interference caused by training randomness and data noise. Compared to directly comparing model parameters, clustering based on low-frequency components better reflects the client's true optimization direction and more fundamentally captures the similarity of the client's optimization direction, making clustering more accurate and significantly improving the robustness and accuracy of clustering.
[0016] (5) The present invention adopts the affinity propagation (AP) algorithm, which does not require pre-specifying the number of clusters and can automatically adjust the cluster structure according to the dynamic changes during the training process, adapting to different degrees of data heterogeneity.
[0017] (6) Collaborative Training Mechanism Combining Parameter Decoupling and AP Dynamic Clustering: This invention proposes a decoupled architecture of "intra-cluster shared feature layer + locally retained classification layer," and combines it with the affinity propagation (AP) algorithm for dynamic clustering. This method ensures that clients within the same cluster have similar update directions, eliminates conflicts (gradient cancellation) during common layer parameter aggregation, and preserves the client's individual capabilities, effectively solving the problem of decreased generalization performance caused by Non-IID data.
[0018] (7) In this invention, only the output layer is used as the personalized classification layer, which increases the model parameter aggregation ratio and shortens the local training time of the personalized classification layer, which is beneficial to improving the model convergence speed.
[0019] (8) The present invention proposes an image classification method based on model decoupling federated learning, which trains the image classification model based on the invention's training method, thereby ensuring the accuracy and robustness of the image classification task. Attached Figure Description
[0020] Figure 1 This is a flowchart of a model decoupling federated learning method based on frequency analysis proposed in this invention. Figure 2 Here is a flowchart of the method for clustering clients; Figure 3 This is a schematic diagram of the data distribution of the CIFAR-10 dataset; Figure 4 Update the PCA projection for 10 client models; Figure 5 A similarity heatmap among 10 client-side models; Figure 6(a) shows the convergence comparison of the ablation experiment training; Figure 6(b) shows a comparison of the test results of the ablation experiment. Detailed Implementation
[0021] 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 only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0022] like Figure 1 As shown, the proposed model decoupling federated learning method based on frequency analysis in this embodiment includes the following steps S1-S5.
[0023] S1. Determine the image classification model deployed on the client and divide the image classification model into a common feature layer and a personalized classification layer; initialize the client.
[0024] The common feature layer is used to extract general features, while the personalized classification layer is used to adapt to local specific tasks. In practice, the output layer of the image classification model can be used as the personalized classification layer, and the remaining layers can be used as the common feature layer.
[0025] The image classification model can use any existing classification model.
[0026] S2. Each client receives the update amount of the common parameters and adds it to the local common feature layer; the initial value of the update amount of the common parameters is 0. S3. Each client trains the image classification model in segments on the local dataset {image samples; recognition results}, that is, it trains the common feature layer and the personalized classification layer in sequence.
[0027] Specifically, in this step, the common feature layer is first frozen, and the personalized classification layer is trained using only the local dataset; when the personalized classification layer is updated a set number of times N0, the personalized classification layer is frozen, and the common feature layer is trained using only the local dataset until the common feature layer is updated a set number of times N1.
[0028] In practice, N1 can be set to N0 because a higher number of common feature layers leads to slower training convergence. In subsequent embodiments, N0=3 and N1=7.
[0029] S4. Determine whether the parameter aggregation count has reached the set value N2; the parameter aggregation count is the number of times the common parameter update quantity has been updated. If yes, then the training ends; If not, proceed to step S5.
[0030] S5. Each client uploads the parameter update amounts of the common feature layer before and after local training and aggregates them. The server assigns the aggregated parameter update amounts to the common parameter update amounts and then returns to step S2.
[0031] Specifically, the parameter update volume on the server is aggregated by taking the average value.
[0032] Thus, the common feature layer used to extract general features is shared and aggregated among clients within the same cluster; the personalized classification layer used to adapt to local specific tasks is trained only on the client, and is not uploaded to the server or shared among clients.
[0033] In practical implementation, the clients can be further clustered, and aggregation is performed only on the common feature layers of clients within the same cluster. Thus, in step S5, the clients are first clustered, and then the average parameter update amount within each cluster is taken as the common parameter update amount for that cluster; in step S2, each cluster client receives the common parameter update amount corresponding to its cluster and adds it to its local common feature layer. In this scheme, the clustering in adjacent aggregations is independent of each other.
[0034] like Figure 2 As shown, step S5 can specifically involve the following steps to cluster the client.
[0035] S51. Calculate the parameter update amount of the common feature layer of each client before and after the most recent local training. Update the parameter amount Flattening the signal into a one-dimensional form, let the parameter update after flattening be denoted as... , The total amount of data is denoted as N; S52. Use Discrete Cosine Transform (DCT) to update the flattened parameters. The data is transformed into frequency domain data F. Based on the order of frequency from low to high, a set proportion (e.g., 1 / 4) of the data is extracted from the frequency domain data F as a low-frequency feature vector.
[0036] Let the parameter update amount of the j-th client be denoted as Its frequency domain data is denoted as F(j); for The i-th value is F(j,i), and F(j,i) is the i-th value of F(j); the DCT transformation formula is as follows: ; ; Where N is the parameter update amount The number of parameters, i.e., the total number of nodes in the common feature layer; c(i) is the compensation coefficient, used to ensure that the frequency domain data F(j) is an orthogonal matrix.
[0037] In this step, the extracted low-frequency feature vector is: ; This indicates rounding down from N / 4.
[0038] S53. Cluster the clients based on low-frequency feature vectors to achieve client clustering.
[0039] In specific implementation, in step S53, the cosine similarity between any two clients can be calculated based on low-frequency feature vectors, and then the clients are clustered based on the cosine similarity. The clustering algorithm can specifically adopt the affinity propagation algorithm (AP), which can automatically infer the optimal number of clusters based on the data structure and is suitable for handling complex non-convex cluster structures. In step S53, according to the output of the AP algorithm, clients with similar update directions can be grouped into the same cluster.
[0040] The image classification model and training method described above are verified in the following specific embodiments.
[0041] This embodiment conducts experiments on three benchmark visual datasets: CIFAR-10, CIFAR-100, and Fashion-MNIST. To simulate real-world data heterogeneity, this embodiment employs a Pathological Non-IID setting, where each client contains only a very small number of categories (e.g., 2 categories) of data, thereby creating a strong label skew, making local data unrepresentative of the global distribution. This represents an extreme case of statistical heterogeneity.
[0042] In this embodiment, the training data is sorted by category label and divided into 400 equally sized data shards on a single benchmark visual dataset. This embodiment simulates joint training by 100 clients, with each client randomly assigned 4 shards. Therefore, most clients possess data from only a few categories (e.g., for CIFAR-10, each client has at most 4 out of 10 categories), resulting in a severe label distribution skew. This setup rigorously tests the algorithm's ability to aggregate knowledge from structurally dissimilar local distributions. The data distribution of CIFAR-10 is as follows... Figure 3 As shown.
[0043] In this embodiment, the image classification model employs a lightweight backbone architecture to simulate the typical resource-constrained edge environment in wireless systems (such as IoT sensors). Specifically, on the Fashion-MNIST dataset, the image classification model uses a compact 3-layer MLP (200-200-10 neurons) with the ReLU activation function; on the CIFAR-10 / 100 dataset, the image classification model uses the LeNet-5 architecture, which contains two convolutional blocks (…). Convolution, BatchNorm Max pooling), followed by two fully connected layers (120 and 84 units).
[0044] In this embodiment, the benchmark algorithm employs several representative federated learning (FL) algorithms: Global federated learning methods include: FedAvg – used as a standard benchmark using weighted averaging; FedProx – adds a proximal regularization term; MOON – utilizes model contrastive learning; and FedGen – employs generative learning for data-free distillation.
[0045] Personalized federated learning (decoupling and architecture) includes: FedRep – decoupling the model into a shared encoder and a private decision head; FedPer – maintaining the localization of personalized layers while sharing the base layer; and FedBN – mitigating feature shift by maintaining the localization of the BatchNorm layer.
[0046] Clustering and neighbor-based federated learning include: CFL – clustering clients based on updated cosine similarity; kNN-Per – combining global representations with local k-nearest neighbors.
[0047] In this embodiment, the environment is set as follows: All algorithms were implemented using PyTorch on a server equipped with an Intel Core i7-12700KF CPU and an NVIDIA GeForce RTX 4070 Super GPU (12GB). For optimization, SGD with a momentum of 0.5 and a cross-entropy loss function were used. The learning rate for the Fashion-MNIST dataset was set to... The learning rate on the CIFAR-10 / 100 dataset is set to .
[0048] During training, let the number of times the model parameters are aggregated be . Each client executes per round. In each local period, the common feature layer is trained for 7 epochs, and the personalized classification layer is trained for 3 epochs; training batch size. .
[0049] To ensure the stability of clustering convergence, this embodiment introduces a method before activating the spectral clustering mechanism. The warm-up period for the final round. The report results reflect the average test accuracy of all clients after the final round (calculated as: number of correctly classified test cases / test case size), as shown in Table 1 below.
[0050] Table 1: Comparison of Image Classification Test Accuracy
[0051] The method of the present invention (DecFedSpec) combines steps S1-S5 and uses steps S51-S53 for clustering.
[0052] As can be seen from Table 1, the method of the present invention (DecFedSpec) achieved the highest average accuracy (77.02%) and consistently outperformed the benchmark method on Fashion-MNIST and CIFAR-100.
[0053] In the highly challenging CIFAR-100 task, traditional global federated learning and simple clustering methods (such as CFL) suffered severe model collapse, with accuracy approaching random guessing (approximately 10%). This confirms that forcing a single global representation fails under extreme heterogeneity.
[0054] While decoupling-based methods (such as FedRep) significantly recover performance, the method of this invention further outperforms the strong benchmark FedRep by 1.42% on CIFAR-100.
[0055] As can be seen, the spectral clustering strategy of the present invention effectively solves the gradient conflict within the shared encoder (a problem ignored by FedRep), thereby achieving robust representation learning.
[0056] In this embodiment, the model update dynamics of 10 representative clients are also visualized. Figure 4 The PCA projection of the client updates is shown. It is evident that the updates do not converge to a single global direction, but rather exhibit significant deviations. Some clients even demonstrate orthogonal or opposite update vectors, confirming the destructive perturbation that can occur if simple averaging is applied.
[0057] Figure 5 This bias was quantified using pairwise cosine similarity heatmaps. The high positive similarity (red area) between clients 0-4 and 5-9 indicates they have similar data distributions and optimization objectives, validating intra-cluster consistency. The dark blue area between the two groups (negative similarity)... This foreshadows a fundamental conflict, namely, inter-cluster conflict. Figure 5 The obvious block diagonal structure validates the effectiveness of spectral clustering, ensuring that aggregation occurs only within consistent red blocks, thereby maximizing constructive interference.
[0058] In this embodiment, ablation experiments were also conducted on the CIFAR-100 dataset.
[0059] The baseline model employs the global federated learning method FedAvg; Ablation Model 1 (FedAvg+Decoupled) omits clustering compared to the method of this invention (DecFedSpec), namely steps S51-S53; Ablation Model 2 (FedAvg+Cluster) eliminates model decoupling compared to the method of this invention (DecFedSpec).
[0060] The ablation experiment results are shown in Figures 6(a) and 6(b). The results show that FedAvg and the “FedAvg+clustering” variant completely fail on CIFAR-100, with accuracy approaching randomness. This indicates that under extreme Non-IID settings, clustering alone cannot resolve feature misalignment caused by the shared classifier head. Decoupling the personalized head is a prerequisite for convergence. Based on the decoupled architecture FedAvg+Decoupled, the proposed method (DecFedSpec) introduces DCT-based spectral clustering, resulting in an additional performance improvement of 0.96%. It is evident that, unlike temporal clustering which may be sensitive to noise, the frequency-domain clustering method of this invention robustly filters high-frequency perturbations, constructing a more homogeneous optimization subspace for the shared encoder.
[0061] Of course, those skilled in the art will recognize that the present invention is not limited to the details of the exemplary embodiments described above, but also includes the same or similar structures that can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered illustrative and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0062] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
[0063] The technologies, shapes, and structures not described in detail in this invention are all known technologies.
Claims
1. A model decoupling federated learning method based on frequency analysis, characterized in that, Includes the following steps: S1. Determine the image classification model deployed on the client and divide the image classification model into a common feature layer and a personalized classification layer; S2. Each client receives the update amount of the common parameters and adds it to the local common feature layer; the initial value of the update amount of the common parameters is 0. S3, Each client has local dataset {image samples; Based on the recognition results, the common feature layer and personalized classification layer of the image classification model are trained in segments; S4. Determine whether the update count of the common parameter update quantity has reached the set value; If yes, then the training ends; No, proceed to step S5; S5. Each client uploads the parameter update amounts of the common feature layer before and after local training and aggregates them. The server assigns the aggregated parameter update amounts to the common parameter update amounts and then returns to step S2. In step S5, the clients are first clustered, and then the average value of the parameter update amount within the cluster is taken as the common parameter update amount corresponding to the cluster. In step S2, each cluster client receives the common parameter update amount corresponding to its cluster and superimposes it onto the local common feature layer. In step S5, the method for clustering the clients is as follows: calculate the parameter update amount of the common feature layer of each client before and after the most recent local training and flatten it into a one-dimensional signal; perform frequency domain transformation on the flattened parameter update amount to obtain frequency domain data; according to the order of frequency from low to high, extract a set proportion of data from the frequency domain data as low-frequency feature vectors. based on Low-frequency feature vectors are used to cluster clients; In step S3, the local dataset {image samples; The method for segmented training of the image classification model based on the recognition results is as follows: First, freeze the common feature layer and update the personalized classification layer N0 times on the local dataset; then freeze the personalized classification layer and update the common feature layer N1 times on the local dataset, where N1>N0.
2. The model decoupling federated learning method based on frequency analysis as described in claim 1, characterized in that, In step S5, the method for clustering clients based on low-frequency feature vectors is as follows: First, the cosine similarity between any two clients is calculated based on the low-frequency feature vectors. Then, the clients are clustered based on the cosine similarity using the affinity propagation algorithm.
3. The model decoupling federated learning method based on frequency analysis as described in claim 1, characterized in that, The flattened parameter update values are converted into frequency domain data using discrete cosine transform, and the calculation formula is as follows: Where F(j,i) is the i-th value in the frequency domain data of the j-th client. Let be the i-th value in the flattened parameter update quantity of the j-th client, N be the number of parameters in the flattened parameter update quantity, and c(i) be the compensation coefficient.
4. The model decoupling federated learning method based on frequency analysis as described in claim 1, characterized in that, The output layer of the image classification model serves as the personalized classification layer, while the remaining layers serve as the common feature layer.
5. An image classification method based on model decoupling federated learning, characterized in that, First, the image classification model on the client is trained using the frequency analysis-based model decoupling federated learning method as described in any one of claims 1-4; then, the image to be recognized is input into the client, and the image classification model performs image recognition and outputs the recognition result.
6. An image classification system based on model decoupling federated learning, characterized in that, It includes a memory and a processor. The memory stores a computer program, and the processor is connected to the memory. The processor is used to execute the computer program to implement the image classification method based on model decoupling federated learning as described in claim 5.
7. A storage medium, characterized in that, The system contains a computer program that, when executed, is used to implement the image classification method based on model decoupling federated learning as described in claim 5.