Federal learning method based on fairness enhancement
By performing data hierarchy, hierarchical clustering and weight adjustment based on hierarchical sensitivity in federated learning, combined with anomaly detection of autoencoders, the model deviation problem caused by data differences in federated learning is solved, which significantly improves the fairness and robustness of the model, and protects data privacy.
Patent Information
- Application Number
- CN202510058630.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-09
AI Technical Summary
In a federated learning environment, the difference in quantity and representation of data leads to model bias, affecting overall fairness, and stratified sampling and anomaly data may cause fluctuations in sample selection bias and model robustness.
The local data distribution information of the client is obtained through the server, data hierarchical and hierarchical clustering are performed, and the weight adjustment mechanism based on hierarchical sensitivity is adopted, and abnormal detection is performed using an autoencoder to ensure fair weight adjustment and weighted aggregation update of the global model.
Significantly improves the fairness and robustness of federated learning, ensures that the model performs balanced in heterogeneous data environments, and protects data privacy through local processing and encrypted transmissions.
Smart Images

Figure CN119962635A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of application of federated learning technology, and specifically relates to a federated learning method based on fairness enhancement. Background Art
[0002] The rapid development of artificial intelligence technology benefits from the complexity and availability of big data. However, as the scale of data collection and use expands, data privacy protection has become a focus of public and corporate attention. In the era of big data, how to maximize the value of data while protecting user privacy and information security has become an imminent challenge. In many scenarios, especially for data involving sensitive information, such as medical data or user personal information, data sharing between organizations is strictly restricted, which poses a huge challenge to centralized machine learning methods. Federated Learning (FL), as a new distributed machine learning paradigm, trains global models without sharing original data, which not only protects privacy but also efficiently utilizes decentralized data resources, providing a solution that takes into account both data privacy and model performance.
[0003] In a federated learning environment, each participant (client) may hold data of different magnitudes and different data distributions. When some participants have more or more representative data than others, the training process may be affected by the data characteristics of these "powerful parties", causing the model to tend to optimize the performance of these parties while ignoring or underperforming the performance of "data disadvantaged parties". This situation will cause model bias problems, making the model lack fairness and robustness when facing an unbalanced data environment. Therefore, how to enhance the fairness of the model while ensuring privacy protection has become an important direction in federated learning research.
[0004] Currently, more and more research works are focused on enhancing fairness in federated learning, mainly focusing on two aspects: data enhancement and robust model aggregation. On the one hand, for clients with fewer data samples, data enhancement technology can improve data diversity and thus reduce model bias; on the other hand, by adopting differentiated aggregation strategies, the update of the global model can be optimized according to the heterogeneous characteristics of client data, making it more fair to all participants. However, how to further improve the fairness and robustness of the model in a complex heterogeneous data environment still has the following problems:
[0005] 1. Differences in the distribution of local sensitive data. In a multi-client environment, there are significant differences in the quantity and representativeness of data. Especially when sensitive attributes are dominated by the "dominant party", it is easy to cause model bias and affect overall fairness.
[0006] 2. Sample selection bias caused by stratified sampling. Although stratified sampling enhances the representativeness of sensitive data, the sensitive attributes and sample diversity of each data layer still show unique training characteristics. This difference may lead to inconsistent performance of the model in different data layers.
[0007] 3. Model fairness fluctuations. In federated learning, the performance and fairness of the model will fluctuate with the changes in the existing participant data. In particular, abnormal data can greatly undermine the robustness of the federated model. Summary of the invention
[0008] In order to solve the above technical problems, the present invention provides a fairness-enhanced federated learning method, comprising:
[0009] S1: The server obtains the local data distribution information of the client and sends the global model to all clients as the initial model for this round of federated learning;
[0010] S2: Each client classifies local data according to predefined key attributes and preprocesses the data to ensure its integrity and accuracy;
[0011] S3: Perform difference measurement on the classified data and use Gower distance on each client to calculate the similarity between data points, and stratify the data through hierarchical clustering to form multiple data layers;
[0012] S4: The client extracts samples from each data layer in proportion to generate a local training set, and trains the local data according to the global model to calculate the loss and gradient;
[0013] S5: The server optimizes the parameters of the global model using a weight adjustment mechanism based on layer sensitivity according to the gradients and losses uploaded by the client;
[0014] S6: The client reconstructs the local data through the autoencoder and calculates the reconstruction error Εrror i , judge abnormal data according to the set threshold threshold, if the reconstruction error Error i >threshold, the data is marked as abnormal. After the abnormal data is identified, the server integrates this information into the fairness weight adjustment to ensure that the contribution of each client is fairly considered during the global aggregation process;
[0015] S7: The server calculates the local model parameters θ according to the local model parameters uploaded by the client. i , using the fairness indicator β i The weighted aggregation algorithm is used to update the global model;
[0016] S8: The server sends the updated global model to the client, and the client performs the next round of local training based on the model, repeating the above steps until the global model converges.
[0017] Beneficial effects of the present invention:
[0018] The present invention performs stratified sampling on data and adjusts weights based on hierarchical sensitivity, making the model more balanced in a heterogeneous data environment and significantly improving the fairness of federated learning.
[0019] The present invention can effectively identify and process abnormal data through the autoencoder anomaly detection mechanism, reduce its negative impact on model training, and thus improve the robustness of the model; the entire training process is performed locally, and only encrypted model gradients and parameters are uploaded to protect user data from leakage, thereby ensuring the data security of the participants. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flowchart of a fairness-enhanced federated learning method of the present invention;
[0021] Figure 2 Schematic diagram of the autoencoder architecture in the present invention;
[0022] Figure 3 This is a diagram of an outlier detection module of the present invention;
[0023] Figure 4 It is a fair aggregation graph of the present invention. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] A fairness-enhanced federated learning method, the method comprising:
[0026] S1: global model initialization and client data processing;
[0027] S2: Gower distance calculation and data stratification:
[0028] S3: Hierarchical clustering sampling and local model training;
[0029] S4: Weight adjustment and optimization based on hierarchical sensitivity;
[0030] S5: Dynamic fairness adjustment and anomaly detection;
[0031] S6: Model iteration and global aggregation update;
[0032] A specific implementation method of a fairness-enhanced federated learning method, such as Figure 1 As shown, it includes the following six steps:
[0033] S1: The server obtains the local data distribution information of the client and sends the global model to all clients as the initial model for this round of federated learning;
[0034] S2: Each client classifies local data according to predefined key attributes and performs certain preprocessing on the data to ensure its integrity and accuracy.
[0035] S3: Perform difference measurement on the classified data and use Gower distance on each client to calculate the similarity between data points, and stratify the data through hierarchical clustering to form multiple data layers;
[0036] S4: The client extracts samples from each data layer in proportion to generate a local training set, and trains the local data according to the global model to calculate the loss and gradient;
[0037] S5: The server optimizes the parameters of the global model using a weight adjustment mechanism based on layer sensitivity according to the gradients and losses uploaded by the client;
[0038] S6: The server sends the updated global model to the client, and the client performs the next round of local training based on the model, repeating the above steps until the global model converges.
[0039] In this embodiment, the process of layering standards and client data processing includes:
[0040] S11: Define tiering criteria:
[0041] To ensure fairness, the data processing process is performed locally on each client, and each client performs a preliminary classification of the data based on four key sensitive attributes (gender S, age Α, race R, and economic level E).
[0042] The specific steps are:
[0043] Gender S: male S1 and female S2;
[0044] Age Α: divided into A1 = "under 18 years old", A2 = "18-35 years old", A3 = "36-55 years old", A4 = "18 years old and above";
[0045] Race R: Black / African R1 and White / European R2;
[0046] Economic level E: low income E1, middle income E2, high income E3;
[0047] S12: Data preprocessing:
[0048] In the data preprocessing stage, it is necessary to determine the format of the client's local data, that is, to confirm whether the data is continuous data or categorized data, and to use appropriate processing methods for different types of data. The following are the detailed steps and corresponding formulas:
[0049] 1. Continuous data processing:
[0050] (1) Singular Value Decomposition (SVD):
[0051] For continuous data, singular value decomposition (SVD) is first performed to achieve dimensionality reduction and feature extraction. The mathematical representation of singular value decomposition is as follows:
[0052] Assume data matrix Its singular value decomposition is:
[0053] X=U∑V T
[0054] in, is a left singular vector matrix; It is a diagonal matrix, and the elements on its diagonal are singular values; is a right singular vector matrix.
[0055] By retaining the largest k singular values and the corresponding eigenvectors, we can get the reduced-dimensional data matrix:
[0056]
[0057] Among them, k is the dimension after dimensionality reduction, which is used to extract the most important features and reduce data redundancy and noise. 2. Classification data processing:
[0058] Suppose there is a categorical variable C whose value set is {c1,c2,...,c m}, then the process of One-Hot encoding can be expressed as:
[0059] C→[b1,b2,...,b i ]
[0060] Among them, b i ∈{0,1} represents the encoding of a categorical variable, and only one value is 1 and the rest are 0.
[0061] In this embodiment, the classified data is subjected to difference measurement and each client uses the Gower distance to calculate the similarity between data points, and the data is layered through hierarchical clustering to form multiple data layers. The specific steps are as follows:
[0062] S21: For categorical data, if two objects are the same in attribute k, the difference measure is 0, and if they are different, it is 1; for numerical data, the absolute difference of the objects divided by the range of the attribute is used as the difference measure.
[0063]
[0064] R k =max(x k )-min(x k )
[0065] S22: Calculate the similarity between objects using Gower distance.
[0066]
[0067] Among them, D ij is the Gower distance between object i and object j; n is the number of samples of the attribute; is the difference measure between object i and object j on attribute k.
[0068] S3: Based on the calculated similarity measure, a hierarchical clustering algorithm is applied to stratify the data to form multiple data layers, each of which contains data points with high similarity.
[0069] Each client extracts samples from different data layers in a certain proportion for the generation of local training sets. The specific sampling ratio is based on the formula:
[0070]
[0071] Among them, n sample,l is the number of samples drawn in layer l; N l is the total number of data points in layer l; N is the total number of data points (samples) in the dataset, n totalsample is the total number of points in the entire dataset.
[0072] S4: Level sensitivity weight adjustment and optimization:
[0073] To improve the fairness and accuracy of the model in a heterogeneous data environment, the server introduces a dynamic weight adjustment mechanism based on hierarchical sensitivity. The process is as follows:
[0074] S41: Initial sensitivity parameter setting:
[0075] The sensitivity parameter α of each data layer is initially set to reflect the importance of the layer in the training process. The initial weight formula is:
[0076]
[0077] Among them, sensitivity i is the sensitivity index of the layer; n i is the number of samples in the i-th layer; is the total number of samples in all strata.
[0078] S42: Dynamic weight adjustment:
[0079] In each round of iteration, based on the loss value of each data layer under the current model, its weight is dynamically adjusted, and the update formula is:
[0080]
[0081] Among them, L i (θ t ) is the layer i in the current model parameter θ t The loss under t+1 represents the model parameters of the t+1th iteration, and η is the learning rate.
[0082] S43: Weight update and cross validation:
[0083] After each iteration, cross-validation is performed to evaluate the performance of the model at each data layer. Based on the feedback from cross-validation, the weight of each layer is recalculated. The specific calculation formula is as follows:
[0084]
[0085] Among them, q represents the weight adjustment parameter, |L i (θ t )| is the layer i in the current model parameter θ t is the absolute value of the loss under , and ε is a small constant used to prevent division by zero errors.
[0086] S5: Anomaly Detection and Fairness Weight Adjustment:
[0087] In order to ensure the fairness of the model among clients and enhance the robustness of the model, an anomaly detection module based on autoencoders is adopted, such as Figure 2 and 3 The specific steps are as follows:
[0088] S51: Use the autoencoder to reconstruct the data and calculate the reconstruction error.
[0089]
[0090] in, represents the reconstruction error of the data, x i is the original data point, Data points reconstructed by the autoencoder.
[0091] S52: Data abnormality judgment:
[0092] Set the anomaly detection threshold threshold, when the reconstruction error Error i >threshold, the data is marked as abnormal. After the abnormal data is identified, the server integrates this information into the fairness weight adjustment to ensure that the contribution of each client is fairly considered during the global aggregation process.
[0093] S6: Global model aggregation and update:
[0094] like Figure 4 As shown in the figure, the server uses the fairness indicator weights to perform weighted aggregation updates on the global model based on the local model parameters uploaded by each client. The update formula for the global model parameters after aggregation is:
[0095]
[0096] Among them, β i represents the fairness weight of the i-th client, θ i Represents the client's local model parameters.
[0097] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A fairness-enhanced federated learning method, characterized in that: include: S1: The server obtains the local data distribution information of the client and sends the global model to all clients as the initial model for this round of federated learning; S2: Each client classifies local data according to predefined key attributes and preprocesses the data to ensure its integrity and accuracy; S3: Perform difference measurement on the classified data and use Gower distance on each client to calculate the similarity between data points, and stratify the data through hierarchical clustering to form multiple data layers; S4: The client extracts samples from each data layer in proportion to generate a local training set, and trains the local data according to the global model to calculate the loss and gradient; S5: The server optimizes the parameters of the global model using a weight adjustment mechanism based on layer sensitivity according to the gradients and losses uploaded by the client; S6: The client reconstructs the local data through the autoencoder and calculates the reconstruction error Εrror i , judge abnormal data according to the set threshold threshold, if the reconstruction error Error i >threshold, the data is marked as abnormal. After the abnormal data is identified, the server integrates this information into the fairness weight adjustment to ensure that the contribution of each client is fairly considered during the global aggregation process; S7: The server updates the local model parameters θ according to the client's upload. i , using the fairness indicator β i The weighted aggregation algorithm is used to update the global model; S8: The server sends the updated global model to the client, and the client performs the next round of local training based on the model, repeating the above steps until the global model converges.
2. The fairness-enhanced federated learning method according to claim 1, characterized in that: Each client classifies local data according to predefined key attributes and pre-processes the data to ensure its integrity and accuracy, including: S21: Define stratification criteria: To ensure fairness, the data processing process is performed locally on each client, and each client preliminarily categorizes the data according to four key sensitive attributes; the four key sensitive attributes include: gender S, age Α, race R, and economic level E; Each client performs a preliminary classification of data based on four key sensitive attributes, including: Gender S: male S1 and female S2; Age Α: divided into A1 = "under 18 years old", A2 = "18-35 years old", A3 = "36-55 years old", A4 = "18 years old and above"; Race R: Black / African R1 and White / European R2; Economic level E: low income E1, middle income E2, high income E3; S12: Data preprocessing: In the data preprocessing stage, it is necessary to determine the format of the client local data and use different processing methods for different types of data; The data format includes: continuous data or categorical data; Different processing methods are used for different types of data, including: Continuous data processing: For continuous data, singular value decomposition (SVD) is first performed to achieve dimensionality reduction and feature extraction; Assume data matrix Its singular value decomposition is: X=U∑V T in, represents a left singular vector matrix; represents a diagonal matrix, whose diagonal elements are singular values; represents a right singular vector matrix; T represents the transpose of the matrix; By retaining the largest k singular values and the corresponding eigenvectors, we can get the reduced-dimensional data matrix: Among them, X k Represents the data matrix after dimensionality reduction; U k Represents the distribution of data in the first k feature directions; k represents the dimension after dimensionality reduction, which is used to extract the most important features and reduce data redundancy and noise; V k The submatrix representing the first k right singular vectors; Categorical data processing: Assume that the categorical variable C has a value set of {c1, c2, …, c m }, One-Hot encoding is used for processing, and the process is expressed as: C→[b 1, b2,...,b i ] Among them, b i ∈{0,1} represents the encoding of a categorical variable, and only one value is 1 and the rest are 0.
3. The fairness-enhanced federated learning method according to claim 1, characterized in that: The classified data is measured for differences and each client uses the Gower distance to calculate the similarity between data points, including: Difference measure: For categorical data, if two objects are the same in attribute k, the difference measure is 0, and if they are different, it is 1; for numerical data, the absolute difference of the objects divided by the range of the attribute is used as the difference measure; R k =max(x k )-min(x k ) Calculate similarity: Among them, D ij represents the Gower distance between object i and object j; n represents the number of samples of the attribute; represents the difference measure between object i and object j on attribute k; R k Represents the attribute k of a race object.
4. The fairness-enhanced federated learning method according to claim 1, characterized in that: Based on the calculated similarity measure, a hierarchical clustering algorithm is applied to stratify the data to form multiple data layers, including: After using Gower distance to calculate the similarity of data points, a hierarchical clustering algorithm is applied to stratify the data to form multiple data layers, each of which contains data points with high similarity. The specific steps are as follows: First, initialize each layer: each data point is taken as an independent cluster C. Initially, there are n clusters in total, and each cluster contains only one data point. Calculate the similarity between all data points to form an initial similarity matrix S. According to the similarity matrix S, find a pair of clusters with the highest similarity, merge them into a new cluster, and update the similarity matrix at the same time. Repeat the above process until all data points are merged into one cluster. Each cluster merging operation will generate a new data layer. Calculate the similarity between data points, including: S ij =1-D ij Among them, S ij represents the similarity between object i and object j, D ij Represents the similarity distance between object i and object j.
5. The fairness-enhanced federated learning method according to claim 1, characterized in that: The client extracts samples from each data layer in proportion to generate a local training set, including: Among them, n sample,l Indicates the number of samples drawn from layer l; N l represents the total number of data points in layer l; N represents the total number of data points in the dataset, n totalsample Represents the total number of points in the entire dataset.
6. The fairness-enhanced federated learning method according to claim 1, characterized in that: Compute losses and gradients, including: in, represents the global loss, N represents the total number of data points in the dataset, and y i represents the true value of the i-th sample, represents the predicted value of the i-th sample, Represents the loss function of a single sample, used to measure the predicted value and the true value y i The error between It means to find the gradient of the model parameter θ. It means to find the partial derivative with respect to a specific variable.
7. The fairness-enhanced federated learning method according to claim 1, characterized in that: The server optimizes the parameters of the global model using a weight adjustment mechanism based on layer sensitivity based on the gradients and losses uploaded by the client, including: S51: Initially set a sensitivity parameter α of each data layer, and calculate an initial weight reflecting the importance of the layer in the training process based on the sensitivity parameter α; The initial weights include: Among them, ω i represents the initial weight, sensitivity i Sensitivity index of presentation layer; n i represents the number of samples in the i-th layer; is the total number of samples in all layers; n j represents the number of samples in the jth layer; S52: In each iteration, based on the loss value of each data layer under the current model, dynamically adjust and update its weight; The update formula is: Among them, θ t+1 represents the model parameters of the t+1th iteration; L i (θ t ) indicates that layer i has the current model parameter θ t The loss under; η represents the learning rate; represents the dynamically adjusted weight value of the i-th layer; L represents the total number of layers; Represents the current model parameter θ t The gradient value of the loss function at the i-th layer; S53: Perform cross validation after each iteration to evaluate the performance of the model at each data layer. The specific steps are as follows: S531: In each data layer, the local data is divided into training set and validation set in proportion to ensure the diversity and representativeness of the data; S532: Use the training set to perform multiple rounds of iterative optimization on the model and calculate the loss L of the model on the training set. i (θ t ), and update the model parameters, use the validation set to evaluate the trained model, and calculate the loss on the validation set to evaluate the performance of the model on this data layer; Recalculate the weights of each layer based on the feedback from the validation set And adjust it in combination with the absolute value of the loss to get the adjusted weight in, represents the weight value of the i-th layer after dynamic adjustment; q represents the weight adjustment parameter, |L i (θ t )| represents layer i in the current model parameter θ t The absolute value of the loss under ε is , and ε is a constant used to prevent division by zero errors; represents the weight of the i-th layer after combining the absolute value of the loss of the layer and the weight adjustment parameter, L j (θ t ) indicates that the current model parameter θ t The loss value of the next j-th layer; S533: Summarize the verification results of all data layers and adjust the weights according to the Update global model parameters: Among them, θ t+1 represents the model parameters of the t+1th iteration; L i (θ t ) indicates that layer i has the current model parameter θ t The loss under; η represents the learning rate; represents the dynamically adjusted weight value of the i-th layer; L represents the total number of layers; Represents the current model parameter θ t The gradient value of the loss function at the i-th layer; S534: Repeat the above steps until the validation set loss reaches the convergence condition and the final global model is obtained.
8. The fairness-enhanced federated learning method according to claim 1, characterized in that: The client reconstructs the local data through the autoencoder and calculates the reconstruction error Εrror i ,include: Among them, x i represents the original data point; Data points reconstructed for the autoencoder; Represents x i and The reconstruction loss between them.
9. The fairness-enhanced federated learning method according to claim 1, characterized in that: Using the fairness indicator β i The global model is updated using a weighted aggregation algorithm, including: in, represents the global model parameters of the current round after weighted aggregation; β i represents the fairness weight of the i-th client; θ i represents the local model parameters of the client; n represents the total number of clients participating in the federated learning process.
Citation Information
Cited By
Asset management coding model modeling method based on federated learning
CN120542266A
A federated learning-based asset management coding model modeling method
CN120542266B