Federal learning reliability enhancement method and system based on assembled projection head
By assembling the projection head and gradient descent optimization federated learning method, the problems of uneven data distribution and communication delay are solved, faster data processing and higher model training efficiency are achieved, data security and privacy are ensured, and more accurate models are generated.
Patent Information
- Application Number
- CN202510474808.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-07-29
AI Technical Summary
Traditional federated learning systems have challenges of inefficiency and insufficient real-time performance in data distribution and communication delay problems, affecting the effectiveness of model training and user privacy security.
Through initialization modules, module fine-tuning, mechanism prediction, strategy generation and training steps, combined with projection head assembly and gradient descent optimization, data parallel processing and parameter update are realized, and Gaussian distributed sampling and multi-learning rate training are adopted to optimize model performance and resource utilization.
It speeds up data processing speed, improves feature extraction efficiency, enhances the system's fault tolerance and data security, reduces communication delay and synchronization error, improves the efficiency and accuracy of model training, and generates more accurate models.
Smart Images

Figure CN120387528A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine learning, and particularly relates to a method and system for enhancing the reliability of federated learning based on an assembled projection head. Background Technique
[0002] Federated learning allows multiple devices or computing nodes to perform model training without sharing raw data. In federated learning, the model is trained on local devices, and only the updated parameters of the model are aggregated to a central server for aggregation.
[0003] With the rapid progress of big data and artificial intelligence technologies, federated learning, as a cutting-edge distributed machine learning method, is gradually emerging. Its uniqueness lies in its ability to achieve cross-device and cross-organization model training without directly sharing raw data, thus effectively protecting user privacy and data security. Traditional federated learning systems are not perfect, and they face many challenges in practical applications. Uneven data distribution may lead to low model training efficiency, and communication latency will affect the real-time performance of model updates. Therefore, it is necessary to improve and optimize them. Summary of the Invention
[0004] The purpose of the present invention is to provide a method and system for enhancing the reliability of federated learning based on an assembled projection head to solve the problems raised in the above background technique.
[0005] To achieve the above purpose, the present invention provides the following technical solution: A method for enhancing the reliability of federated learning based on an assembled projection head, and the steps of the method are as follows:
[0006] A1, Initialization module, realized by initializing the module of the projection line;
[0007] A2, Module fine-tuning, fine-tuning the local module; [[ID=!27]]
[0008] (Gradient descent iteration process);
[0009] A3, Mechanism prediction, by predicting the fused mechanism;
[0010] A4, Policy generation, by parameter setting, obtaining the policy for generating the projection head;
[0011] A5, Training, by continuous learning and saving parameters;
[0012]
[0013] (x(t), y(t)) is a data batch sampled from the dataset D.
[0014] Preferably, the steps in A2 include: setting the learning rate, local fine-tuning, and parameter update.
[0015] Preferably, the steps in A4 include: initializing the parameter distribution, sampling the parameters of multiple projection heads, and constructing the projection head network.
[0016] Preferably, the steps in A5 include:
[0017] B1, data loading, generating and loading the local data;
[0018] B2, fine-tuning the projection head, fine-tuning each projection head;
[0019]
[0020] θproj,i represents the parameter of the i-th projection head,
[0021] η is the learning rate,
[0022] Li is the loss function of the i-th projection head,
[0023] θproj,iLi is the gradient of the loss function with respect to the parameter. The superscripts (t) and (t + 1) represent the parameter states before and after the update respectively;
[0024] B3, training, training by adopting different learning rates;
[0025] B4, parameter saving, saving the updated parameters.
[0026] Preferably, the steps of projection head initialization and parameter sampling also include:
[0027] C1, determining the parameter range and distribution, in the projection head initialization stage, determining the parameters and sampling through the Gaussian distribution;
[0028] r i~N(μ,σ2)fori=1,2,…,n
[0029] where ri represents the i-th generated random number, and n represents the number of random numbers to be generated;
[0030] C2, generating Gaussian distribution random numbers, using a Gaussian distribution random number generator to generate a series of random numbers according to the set mean and standard deviation;
[0031] C3, parameter assignment and initialization, assigning the generated Gaussian distribution random numbers to the corresponding parameters in the projection head;
[0032] C4. Verification and adjustment: Check the performance of the projection head through simulation tests and actual projection effect evaluation methods; adjust the mean and standard deviation of the Gaussian distribution.
[0033] C5. Save initialization parameters: Save the initialized parameters to the configuration file of the projection head.
[0034] Preferably, the steps of performing gradient descent using multiple learning rates are as follows:
[0035] D1. Determine the fine-tuning range: Identify and select the layers or parameters in the model that need to be fine-tuned.
[0036] D2. Set the learning rate range: Select a series of different learning rates for the gradient descent process.
[0037] D3. Model initialization: Load the pre-trained model and keep most of its parameters unchanged, only initialize the selected fine-tuning part.
[0038] D4. Data preparation: Prepare the dataset for fine-tuning.
[0039] D5. Model evaluation and saving: Evaluate the performance of the fine-tuned model at each learning rate using the validation set and save the model parameters to a file.
[0040] Preferably, the steps of predicting variance to estimate uncertainty are as follows:
[0041] E1. Define the research purpose: Determine the prediction model for which uncertainty needs to be estimated and its application scenario.
[0042] E2. Data collection and preprocessing: Clean, organize, and standardize the historical data collected related to the prediction model.
[0043] E3. Build the prediction model: Select a suitable prediction model according to the research purpose and data characteristics.
[0044] E4. Calculate the prediction variance: Calculate the variance of the prediction results based on the output of the prediction model and the characteristics of the data.
[0045] E5. Evaluate the uncertainty: Interpret the degree of uncertainty represented by the prediction variance.
[0046] Preferably, the system consists of a data preprocessing module, a federated learning module, a projection head assembly module, a reliability enhancement module, an evaluation and optimization module, and a user interface module.
[0047] Preferably, 1.
[0048] The beneficial effects of the present invention are as follows:
[0049] By implementing parallel processing of data, the present invention not only speeds up the data processing speed, but also improves the efficiency of feature extraction, thereby greatly enhancing the data processing ability of the federated learning system. This means that the system can process more data in a shorter time, providing a solid data foundation for subsequent model training, improving the fault tolerance of the system, ensuring the security and privacy of data, and optimizing the utilization of resources, enabling the system to maintain stable operation in the face of various challenges. By reducing communication latency and synchronization errors, the efficiency and accuracy of model training are significantly improved, which means that the system can reach the convergence state faster and generate a more accurate model, thus providing a better service experience for users. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a schematic flowchart of the method of the present invention;
[0051] Figure 2 It is a schematic flowchart of the training process of the present invention;
[0052] Figure 3 It is a schematic flowchart of the projection head initialization and parameter sampling process of the present invention;
[0053] Figure 4 It is a schematic flowchart of the process of performing gradient descent with multiple learning rates of the present invention;
[0054] Figure 5 It is a schematic flowchart of the process of predicting variance estimation uncertainty of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0055] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0056] As Figures 1 to 5 shown, the embodiment of the present invention provides a method for enhancing the reliability of federated learning based on an assembled projection head. The steps of the method are as follows:
[0057] A1, an initialization module, implemented by initializing the module of the projection line;
[0058] Python
[0059] class ProjectionHeadAssembler:
[0060] def
[0061] __init__ (
[0063] *self*
[0064] ,
[0065] *num_heads*
[0066] = 100):
[0067] self.num_heads = num_heads
[0068] self.prior_sampler = PriorSampler()
[0069] def initialize_heads(
[0070] *self*
[0071] ,
[0072] *prior_params* ):
[0074] heads = []
[0075] for
[0076] i
[0077] in
[0078] range(self.num_heads):
[0079] # Sample parameters from the prior distribution
[0080] params = self.prior_sampler.sample(prior_params)
[0081] # Construct the projection head
[0082] head = ProjectionHead(params)
[0083] heads.append(head)
[0084] return
[0085] heads
[0086] A2, Module fine-tuning, fine-tune the local modules;
[0087] Python
[0088]
[0089] Python
[0090] def __init__(self, learning_rates=[1e-3, 5e-4, 1e-4]):
[0091] Python
[0092] self.learning_rates = learning_rates
[0093] Python
[0094] self.optimizer = AdaptiveOptimizer()
[0095] Python
[0096] def fine_tune(self, head, local_data):
[0097] Python
[0098] for lr in self.learning_rates:
[0099] Python
[0100] # Set the learning rate
[0101] Python
[0102] self.optimizer.set_lr(lr)
[0103] Python
[0104] # Local fine-tuning
[0105] Python
[0106] loss = self.train_step(head, local_data)
[0107] Python
[0108] # Update parameters
[0109] Python
[0110] self.optimizer.step(loss)
[0111] Python
[0112] return head
[0113] (Gradient descent iteration process);
[0114] A3, mechanism prediction, by predicting the fused mechanism;
[0115]
[0116] A4, strategy generation, by parameter setting, obtaining the strategy for generating the projection head;
[0117]
[0118] A5, training, by continuous learning and saving parameters.
[0119]
[0120]
[0121] (x(t), y(t)) is a batch of data sampled from the dataset D.
[0122] By implementing parallel data processing, not only the data processing speed is accelerated, but also the efficiency of feature extraction is improved, thus significantly enhancing the data processing ability of the federated learning system. This means that the system can process more data in a shorter time, providing a solid data foundation for subsequent model training, improving the fault tolerance of the system, ensuring the security and privacy of data, while optimizing the utilization of resources, enabling the system to maintain stable operation in the face of various challenges. By reducing communication latency and synchronization errors, the efficiency and accuracy of model training are significantly improved, which means that the system can reach the convergence state faster, generate a more accurate model, and thus provide a better service experience for users.
[0123] Among them, the steps in A2 include: setting the learning rate, local fine-tuning, and parameter update.
[0124] By locally fine-tuning to optimize the model performance for a specific dataset, and parameter update to integrate the results of each local model, the training efficiency and model accuracy of the federated learning system are improved.
[0125] Among them, the steps in A4 include: initializing the parameter distribution, sampling the parameters of multiple projection heads, and constructing the projection head network.
[0126] By sampling the parameters of multiple projection heads to achieve diversified processing, and constructing the projection head network to strengthen data feature extraction, the data processing and feature learning capabilities of the federated learning system are enhanced.
[0127] Among them, the steps in A5 include:
[0128] B1, data loading, generating and loading local data;
[0129] B2, fine-tuning the projection head, fine-tuning each projection head;
[0130]
[0131] θproj,i represents the parameter of the i-th projection head,
[0132] η is the learning rate,
[0133] Li is the loss function of the i-th projection head,
[0134] θproj,iLi is the gradient of the loss function with respect to the parameter. The superscripts (t) and (t + 1) represent the parameter states before and after the update respectively;
[0135] B3, training, training by adopting different learning rates;
[0136] B4, parameter saving, saving the updated parameters.
[0137] By first loading local data to provide a basis for subsequent processing, fine-tuning each projection head to adapt to different data features, and training with different learning rates, the aim is to improve the model performance.
[0138] Among them, the steps of projection head initialization and parameter sampling also include:
[0139] C1, determining the parameter range and distribution, in the projection head initialization stage, determining the parameters and sampling through the Gaussian distribution;
[0140] C2, generating Gaussian distribution random numbers, using a Gaussian distribution random number generator to generate a series of random numbers according to the set mean and standard deviation;
[0141] r i ∼ N(μ,σ2)fori = 1,2,…,n
[0142] Among them, ri represents the i-th generated random number, and n represents the number of random numbers to be generated;
[0143] C3, parameter assignment and initialization, assigning the generated Gaussian distribution random numbers to the corresponding parameters in the projection head;
[0144] C4, verification and adjustment, checking the performance of the projection head through methods such as simulation testing and actual projection effect evaluation; adjusting the mean and standard deviation of the Gaussian distribution;
[0145] C5. Save the initialization parameters and save the initialized parameters to the configuration file of the projection head.
[0146] Determine the parameters by Gaussian distribution sampling and assign values. Adjust the performance through simulation tests and actual evaluations to ensure the performance optimization of the projection head, laying a solid foundation for subsequent data processing and model training.
[0147] Among them, the steps of performing gradient descent using multiple learning rates are as follows:
[0148] D1. Determine the fine-tuning range, identify and select the layers or parameters in the model that need to be fine-tuned;
[0149] D2. Set the learning rate range and select a series of different learning rates for the gradient descent process;
[0150] D3. Initialize the model, load the pre-trained model, and keep most of its parameters unchanged, only initialize the selected fine-tuning part;
[0151] D4. Prepare the data, prepare the dataset for fine-tuning;
[0152] D5. Evaluate and save the model, evaluate the performance of the fine-tuned model at each learning rate using the validation set and save the model parameters to a file.
[0153] By being able to accurately identify and fine-tune the key parts of the model, while using different learning rates to optimize the gradient descent process, finally evaluate and save the optimal model parameters, thereby improving the flexibility and accuracy of model training.
[0154] Among them, the steps of estimating uncertainty of the prediction variance are as follows:
[0155] E1. Clarify the research purpose, determine the prediction model for which uncertainty needs to be estimated and its application scenario;
[0156] E2. Collect and preprocess the data, clean, sort, and standardize the historical data related to the prediction model;
[0157] E3. Build the prediction model, select a suitable prediction model according to the research purpose and data characteristics;
[0158] E4. Calculate the prediction variance, calculate the variance of the prediction results according to the output of the prediction model and the characteristics of the data;
[0159] E5. Evaluate the uncertainty, interpret the degree of uncertainty represented by the prediction variance.
[0160] By ensuring the accurate estimation of the uncertainty of the prediction results, providing a scientific basis for decision-making, improving the reliability and practicality of the prediction model, and helping to better grasp the confidence level of the prediction results in practical applications.
[0161] Among them, the system is composed of a data preprocessing module, a federated learning module, a projection head assembly module, a reliability enhancement module, an evaluation and optimization module, and a user interface module.
[0162] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device.
[0163] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for enhancing the reliability of federated learning based on an assembled projection head, characterized in that: The steps of this method are as follows: A1, Initialization module, achieved by initializing the module of the projection line; A2, Module fine-tuning, fine-tuning the local module; Gradient descent iteration process: A3, Mechanism prediction, predicting the fused mechanism; A4, Strategy generation, obtaining the strategy for generating the projection head through parameter settings; A5, Training, continuously learning and saving parameters; is a data batch sampled from the dataset D.
2. A method for enhancing the reliability of federated learning based on an assembled projection head according to claim 1, wherein: The steps in A2 include: setting the learning rate, local fine-tuning, and parameter update.
3. A method for enhancing the reliability of federated learning based on an assembled projection head according to claim 1, characterized in that: The steps in A4 include: initializing the parameter distribution, sampling the parameters of multiple projection heads, and constructing the projection head network.
4. A method for enhancing the reliability of federated learning based on an assembled projection head according to claim 1, characterized in that: The steps in A5 include: B1, Data loading, generating and loading local data; B2, Fine-tuning the projection head, fine-tuning each projection head; θproj,i represents the parameter of the i-th projection head; η is the learning rate; $L_i$ is the loss function of the $i$-th projection head, $\nabla L_i$ is the gradient of the loss function with respect to the parameters, and the superscripts $(t)$ and $(t + 1)$ represent the parameter states before and after the update, respectively; B3, Conducting training, training by adopting different learning rates; B4, Parameter saving, saving the updated parameters.
5. A method for enhancing the reliability of federated learning based on an assembled projection head according to claim 1, characterized in that: It also includes the steps of projection head initialization and parameter sampling: C1, Determining the parameter range and distribution, determining the parameters and sampling through the Gaussian distribution in the projection head initialization stage; C2, Generating Gaussian distribution random numbers, using a Gaussian distribution random number generator to generate a series of random numbers according to the set mean and standard deviation; r i~N(μ,σ2)fori=1,2,…,n where r i represents the i-th generated random number, and n represents the number of random numbers to be generated; C3, Parameter assignment and initialization, assigning the generated Gaussian distribution random numbers to the corresponding parameters in the projection head; C4, Verification and adjustment, checking the performance of the projection head through methods of simulation testing and actual projection effect evaluation; adjusting the mean and standard deviation of the Gaussian distribution; C5, Saving the initialization parameters, saving the initialized parameters to the configuration file of the projection head.
6. A method for enhancing the reliability of federated learning based on an assembled projection head according to claim 1, characterized in that: The steps of using multiple learning rates for gradient descent are: D1, Determining the fine-tuning range, identifying and selecting the layers or parameters in the model that need to be fine-tuned; D2, Setting the learning rate range, selecting a series of different learning rates for the gradient descent process; D3, Model initialization, loading the pre-trained model and keeping most of its parameters unchanged, only initializing the selected fine-tuning part; D4, Data preparation, preparing the dataset for fine-tuning; D5, Model evaluation and saving, evaluating the performance of the fine-tuned model at each learning rate using the validation set and saving the model parameters to a file.
7. A method for enhancing the reliability of federated learning based on an assembled projection head according to claim 1, characterized in that: The steps of predicting variance to estimate uncertainty are: E1, Clarifying the research purpose, determining the prediction model for which uncertainty needs to be estimated and its application scenario; E2, Data collection and preprocessing, cleaning, sorting, and normalizing the historical data related to the prediction model; E3, Constructing the prediction model, selecting a suitable prediction model according to the research purpose and data characteristics; E4, Calculating the prediction variance, calculating the variance of the prediction result according to the output of the prediction model and the characteristics of the data; E5, Evaluating the uncertainty, interpreting the degree of uncertainty represented by the prediction variance.
8. A federated learning reliability enhancement system based on an assembled projection head according to claim 1, characterized in that: The system consists of a data preprocessing module, a federated learning module, a projection head assembly module, a reliability enhancement module, an evaluation and optimization module, and a user interface module.