Model optimization methods, systems, and apparatus based on federated learning framework

By pruning and perturbating gradient parameters within the federated learning framework, and dynamically adjusting the privacy budget, the problems of privacy leakage and low resource utilization are solved, resulting in faster model convergence and higher accuracy, while reducing system resource requirements.

CN117057445BActive Publication Date: 2026-01-06HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310987628.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-07
Publication Date
2026-01-06
Estimated Expiration
2043-08-07

AI Technical Summary

Technical Problem

Existing federated learning frameworks suffer from privacy breaches and low system resource utilization, particularly in the case of excessive computational burden, accuracy loss, and slow convergence during model training.

Method used

By receiving the aggregation parameters from the server on the client, determining the first gradient parameters based on the local parameters and the training set, and performing pruning and perturbation processing to obtain the second gradient parameters, updating the local parameters, and sending them to the server for aggregation, the process continues until the global model reaches the accuracy requirement or the number of iterations reaches the target. The privacy budget value is dynamically adjusted to reduce the impact of noise accumulation.

Benefits of technology

It improves the convergence speed and accuracy of the global model, reduces system resource requirements, enhances system resource utilization, and protects client data privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117057445B_ABST
    Figure CN117057445B_ABST
Patent Text Reader

Abstract

The application relates to a model optimization method, system and device based on a federal learning framework, computer equipment, a storage medium and a computer program product. The method comprises the following steps: receiving an aggregated parameter sent by a server, taking the aggregated parameter as a local parameter, determining a first gradient parameter based on the local parameter and a local training set; clipping and perturbing the first gradient parameter based on an updated privacy budget value to obtain a second gradient parameter; updating the local parameter based on the second gradient parameter to obtain an updated local parameter; sending the updated local parameter to the server, so that the server aggregates the updated local parameter to obtain an updated aggregated parameter, and optimizes a global model based on the updated aggregated parameter; receiving the updated aggregated parameter sent by the server; repeating the above steps until the accuracy of the global model reaches a requirement or the number of global iterations reaches a pre-set target number, and obtaining an optimized global model. The method can improve the utilization rate of system resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data security technology, and in particular to a model optimization method, system, apparatus, computer device, storage medium, and computer program product based on a federated learning framework. Background Technology

[0002] Federated learning, as an emerging machine learning framework, allows for distributed model training by fully utilizing datasets provided by participating parties without them sharing local private datasets. However, the distributed approach to model training in federated learning raises several security concerns, the most significant being the privacy breach of participating parties' local data. Attackers can use inference attacks on participating parties' models to determine whether a particular sample belongs to the model's training dataset, resulting in the leakage of participating parties' data privacy.

[0003] Currently, existing technologies primarily protect data through encryption-based and randomization-based privacy protection methods. However, encryption-based methods, which encrypt and decrypt model parameters, impose additional computational burdens on both the client and the central server, and may result in a loss of computational accuracy. Randomization-based privacy protection methods mainly use differential privacy mechanisms to protect user privacy. However, due to noise introduced by multiple participants in local gradients, this noise accumulates with each global iteration, leading to decreased model accuracy and slow convergence. Consequently, more system resources are required for model training, resulting in low system resource utilization. Summary of the Invention

[0004] Therefore, it is necessary to provide a model optimization method, system, device, computer equipment, computer-readable storage medium, and computer program product based on a federated learning framework that can improve system resource utilization in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a model optimization method based on a federated learning framework, applied to a client within the federated learning framework, the method comprising:

[0006] Receive the aggregated parameters sent by the server in the federated learning framework, determine the aggregated parameters as local parameters, and determine the first gradient parameters based on the local parameters and the local training set;

[0007] Based on the updated privacy budget value after updating the preset privacy budget value, the first gradient parameters are pruned and perturbed to obtain the second gradient parameters;

[0008] The local parameters are updated based on the second gradient parameters to obtain the updated local parameters;

[0009] The updated local parameters are sent to the server so that the server can aggregate the updated local parameters to obtain updated aggregate parameters. Based on the updated aggregate parameters, a model optimization of the global model is completed.

[0010] The server receives updated aggregation parameters from the server and repeats the above steps until the accuracy of the global model reaches the required level or the number of global iterations reaches the preset target number. The server then completes global training and obtains the final optimized global model.

[0011] In one embodiment, the step of pruning and perturbing the first gradient parameter based on the updated privacy budget value after updating the preset privacy budget value to obtain the second gradient parameter includes:

[0012] Get updated privacy budget value and preset gradient cropping value;

[0013] Based on the preset gradient clipping value and the local parameters, the first gradient parameters are clipped to obtain the initial second gradient parameters;

[0014] Based on the updated privacy budget value and the preset gradient clipping value, the initial second gradient parameters are perturbed to obtain the second gradient parameters.

[0015] In one embodiment, obtaining the updated privacy budget value includes:

[0016] Based on the federated learning framework, determine the privacy budget value, the preset privacy boundary value, the preset budget adjustment rate, and the preset privacy leakage threshold, and obtain the privacy leakage value in the federated learning framework;

[0017] Based on the privacy leakage value, the preset privacy boundary value, the preset budget adjustment rate, and the preset privacy leakage threshold, the preset privacy budget value is updated to obtain an updated privacy budget value.

[0018] In one embodiment, obtaining privacy-leaking values ​​in the federated learning framework includes:

[0019] Obtain the model structure of the local model, and based on the model structure and the local parameters, determine the local model used for sample loss calculation;

[0020] Based on the local model, determine the average loss corresponding to each class of samples in the local training set.

[0021] Obtain a test set, mix the test set and the local training set to obtain a privacy leakage assessment dataset, and determine the sample category of each sample in the privacy leakage assessment dataset;

[0022] Based on the local model and the privacy leakage assessment dataset, determine the sample loss corresponding to each sample in the privacy leakage assessment dataset;

[0023] The privacy leakage value is determined based on the difference between the sample loss corresponding to each sample and the average loss corresponding to the sample category of the sample.

[0024] Secondly, this application provides a model optimization method based on a federated learning framework, applied to a server within the federated learning framework, the method comprising:

[0025] An aggregation parameter is determined and sent to each client in the federated learning framework, so that each client determines the aggregation parameter as a local parameter, updates the local parameter, and obtains an updated local parameter.

[0026] Receive the updated local parameters sent by each of the clients, determine the number of samples in the local training set of each client, and accumulate the number of samples corresponding to each client to obtain the total number of samples.

[0027] Based on the number of samples corresponding to each client and the total number of samples, the updated local parameters are aggregated to obtain the updated aggregate parameters.

[0028] Based on the updated aggregation parameters, a global model optimization is performed. The updated aggregation parameters are then distributed to each client. The above steps are repeated until the accuracy of the global model reaches the required level or the number of global iterations reaches the preset target number, resulting in the final optimized global model.

[0029] Thirdly, this application provides a model optimization system based on a federated learning framework, the system comprising a server and multiple clients;

[0030] The server sends the aggregation parameters to each of the clients;

[0031] Each client receives the aggregation parameters sent by the server and determines the aggregation parameters as local parameters;

[0032] Each client determines its own first gradient parameter based on the local parameters and the local training set.

[0033] Each client, based on the updated privacy budget value after updating the preset privacy budget value, performs cropping and perturbation processing on the first gradient parameter to obtain the second gradient parameter;

[0034] Each client updates its local parameters based on the second gradient parameters to obtain updated local parameters corresponding to each client, and sends the updated local parameters to the server.

[0035] The server receives updated local parameters sent by each client, aggregates the updated local parameters to obtain updated aggregate parameters, and performs a model optimization of the global model based on the updated aggregate parameters.

[0036] The server distributes the updated aggregation parameters to each client, repeating the above steps until the accuracy of the global model reaches the required level or the number of global iterations reaches the preset target number, thus obtaining the final optimized global model.

[0037] Fourthly, this application provides a model optimization apparatus based on a federated learning framework, the apparatus comprising:

[0038] The parameter receiving module is used to receive aggregated parameters sent by the server in the federated learning framework, determine the aggregated parameters as local parameters, and determine the first gradient parameters based on the local parameters and the local training set.

[0039] The gradient determination module is used to perform cropping and perturbation processing on the first gradient parameters based on the updated privacy budget value after updating the preset privacy budget value, so as to obtain the second gradient parameters.

[0040] The parameter update module is used to update the local parameters based on the second gradient parameters to obtain updated local parameters;

[0041] The parameter aggregation module is used to send the updated local parameters to the server, so that the server can aggregate the updated local parameters to obtain updated aggregated parameters, and perform a model optimization of the global model based on the updated aggregated parameters.

[0042] The first model optimization module is used to receive the updated aggregation parameters sent by the server, repeat the above steps until the accuracy of the global model reaches the requirement or the number of global iterations reaches the preset target number, and the server completes global training to obtain the final optimized global model.

[0043] Fifthly, this application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described above.

[0044] Sixthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0045] In a seventh aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method.

[0046] The aforementioned model optimization method, system, apparatus, computer device, storage medium, and computer program product based on the federated learning framework, by determining the aggregated parameters sent by the server in the federated learning framework as local parameters, determining the first gradient parameters based on the local parameters and the local training set, and pruning and perturbing the first gradient parameters to obtain the second gradient parameters, can apply differential privacy mechanisms to the local parameters, thereby achieving privacy protection for client data. By updating the local parameters based on the second gradient parameters and sending the updated local parameters to the server, the server can aggregate the updated local parameters sent by each client to obtain the aggregated updated aggregate parameters. By updating the preset privacy budget value to obtain an updated privacy budget value, and using the updated privacy budget value to prune and perturb the first gradient parameters to obtain the second gradient, it can replace the fixed privacy budget with a dynamic privacy budget, reducing the impact of differential privacy mechanisms on the convergence and accuracy of the federated learning framework in model optimization, thereby improving the convergence speed and accuracy of the global model, reducing the system resources required for model optimization, and thus improving the utilization rate of system resources. Attached Figure Description

[0047] Figure 1 This is a diagram illustrating the application environment of a model optimization method based on a federated learning framework in one embodiment.

[0048] Figure 2 This is a flowchart illustrating a model optimization method based on a federated learning framework in one embodiment.

[0049] Figure 3 This is a flowchart illustrating the second gradient parameter determination step in one embodiment;

[0050] Figure 4 This is a flowchart illustrating a model optimization method based on a federated learning framework in another embodiment.

[0051] Figure 5 This is a structural block diagram of a model optimization device based on a federated learning framework in one embodiment;

[0052] Figure 6 This is a structural block diagram of a model optimization device based on a federated learning framework in another embodiment;

[0053] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0055] The model optimization method based on the federated learning framework provided in this application can be applied to, for example... Figure 1 In the application environment shown, the federated learning framework includes a server 102 and multiple clients 104. The server 102 communicates with each client 104 via a network. Client 104 receives the aggregated parameters sent by the server 102 in the federated learning framework and then determines the aggregated parameters as local parameters. Client 104 determines the first gradient parameters belonging to its local model based on the local parameters and its local training set. Client 104 performs pruning and perturbation processing on the local first gradient parameters according to the updated privacy budget value after a preset privacy budget value, obtaining the second gradient parameters. Client 104 uses the second gradient parameters to update the local parameters, obtaining updated local parameters. Client 104 sends the updated local parameters to the server 102, so that the server 102 performs aggregation processing on the updated local parameters, obtaining updated aggregated parameters. Server 102 performs one optimization of the global model based on the updated aggregated parameters. Clients receive the updated aggregated parameters distributed by the server 102 and repeat the above steps until the accuracy of the global model reaches the required level or the number of global iterations reaches the preset target number, obtaining the final optimized global model.

[0056] In one embodiment, such as Figure 2 As shown, a model optimization method based on a federated learning framework is provided, which is then applied to... Figure 1 Taking the client in [the document] as an example, the steps are as follows:

[0057] Step 202: Receive the aggregation parameters sent by the server in the federated learning framework, determine the aggregation parameters as local parameters, and determine the first gradient parameters based on the local parameters and the local training set.

[0058] Federated learning is an emerging machine learning framework that allows participants to train their local models without sharing their own private datasets, fully utilizing the datasets provided by each participant. Aggregate parameters are sent from the server to the client within the federated learning framework. In the first iteration, the aggregate parameters are initialized by the federated learning framework. In the nth iteration (where n is a positive integer greater than 1), the aggregate parameters are updated after aggregating the local parameters. The aggregate parameters are the model parameters of the server's global model, while the local parameters are the model parameters of the client's local model. The local training set is the data used to train the local model on the client. The first and second gradient parameters are also model parameters within the client's local model. The formula for determining the first gradient parameter is:

[0059] (1)

[0060] In formula (1) For local parameters of client c; Represents the first gradient parameter; gi represents the i-th global federated iteration round; For the local training set of client c The total number of samples; For the i-th sample data in the local training set, This is the loss function.

[0061] Optionally, the client receives the aggregation parameters sent by the server in the federated learning framework, and then determines the aggregation parameters as its own local parameters. The client uses the determined local parameters and local training set. According to the formula Obtain the first gradient parameters from the client.

[0062] Step 204: Based on the updated privacy budget value after updating the preset privacy budget value, the first gradient parameters are pruned and perturbed to obtain the second gradient parameters.

[0063] The preset privacy budget value can be pre-set by the federated learning framework or set in real-time before training the global model. After setting the preset privacy budget value, it is updated after each iteration, making the privacy budget value dynamically changing. This reduces the impact of differential privacy mechanisms on the convergence and accuracy of the federated learning framework model, improving the convergence speed and accuracy of the global model. Applying differential privacy mechanisms to the local model parameters on each client can protect client data privacy. The differential privacy mechanism mainly includes two steps: gradient clipping and gradient perturbation.

[0064] One of the main purposes of pruning is to constrain the gradient parameters within a specific range, ensuring that the difference between gradient parameters trained on two neighboring datasets does not exceed twice a pre-set threshold. This allows us to obtain sensitivity, which can then be used to set noise parameters for differential privacy. Perturbation involves using the updated privacy budget value corresponding to the current client and applying a Gaussian mechanism to perturb the pruned gradient parameters, thus obtaining the second gradient parameters. The formula for calculating the second gradient parameters is:

[0065] (2)

[0066] In formula (2) These are the second gradient parameters; These are the gradient parameters after clipping. This indicates that the mean is 0 and the variance is . Gaussian distribution sampling results; The privacy budget spent by client c during this gradient perturbation; This represents the gradient clipping value.

[0067] Optionally, the client first performs a clipping process on the first gradient parameter based on the updated privacy budget value after the preset privacy budget value is updated. The clipped gradient parameter is then perturbed according to formula (2) to obtain the second gradient parameter.

[0068] Step 206: Update the local parameters based on the second gradient parameters to obtain the updated local parameters.

[0069] The formula used in updating local parameters is as follows:

[0070] (3)

[0071] In formula (3), Indicates the learning rate; This indicates that local parameters are being updated; Indicates local parameters; This represents the second gradient parameter.

[0072] Optionally, the client, based on the second gradient parameters obtained by pruning and perturbating the first gradient parameters, uses the formula... Update the client's local parameters to obtain the updated local parameters.

[0073] Step 208: The updated local parameters are sent to the server so that the server can aggregate the updated local parameters to obtain the updated aggregate parameters. Based on the updated aggregate parameters, a model optimization of the global model is completed.

[0074] The formula for the polymerization process is as follows:

[0075] (4)

[0076] In formula (4) This indicates that client c is updating local parameters. ; This indicates an update to the aggregation parameters; For the local training set of client c The total number of samples; This is the total number of samples obtained by accumulating the samples in the local training sets of each client. The global model consists of model parameters and model structure. Before optimization, the model parameters in the global model are the initial model parameters. After obtaining the updated aggregation parameters, the updated aggregation parameters are used to optimize the initial model parameters, resulting in the optimized global model. The global model can specifically be a classification model, a prediction model, a clustering model, or an anomaly detection model.

[0077] The purpose of the global model is determined by the model structure of each client's local model, and the model structure of each local model depends on the type of task that needs to be completed.

[0078] Step 210: Receive the updated aggregation parameters sent by the server, repeat the above steps until the accuracy of the global model reaches the requirement or the number of global iterations reaches the preset target number, the server completes global training, and obtains the final optimized global model.

[0079] Here, repeating the above steps refers to repeating steps 202 to 208. Achieving the required accuracy means that the global model's accuracy in prediction or classification reaches the set standard. Reaching the preset target number of global iterations means that the number of repetitions reaches the preset target number.

[0080] In one embodiment, a task request carrying a task to be executed is obtained; a local model for executing the task is determined based on the task type; the local model is distributed to each client so that each client can train the local model and obtain updated local parameters; the updated local parameters of each client are aggregated to obtain updated aggregate parameters; based on the obtained updated aggregate parameters, a model optimization of the global model is completed; the server distributes the updated aggregate parameters to each client, and the above steps are repeated until the accuracy of the global model reaches the requirement or the number of global iterations reaches the preset target number, to obtain the final optimized global model; the task to be executed is executed using the final optimized global model to obtain the execution result.

[0081] The training process of the local model includes determining the first gradient parameters, the second gradient parameters, and the updated local parameters. For example, in a sample classification task, the server initially distributes the local model for sample classification to each client. Each client then continuously trains its distributed model, obtaining updated local parameters. The server then aggregates these updated local parameters to obtain updated aggregate parameters. Based on these updated aggregate parameters, the global model is optimized once. The server then distributes the updated aggregate parameters to each client, repeating the above steps until the global model's accuracy reaches the required level or the number of global iterations reaches a pre-set target number, resulting in the final optimized global model. The optimized global model is then used to classify the samples to be classified, thus obtaining the classification results. By training the model within a federated learning framework, the training speed and accuracy can be improved, while also protecting the data security of each local model. This reduces the system resources required for model optimization, improving system resource utilization and enabling faster task completion while protecting the security of the data involved in the task.

[0082] Optionally, the client sends the updated local parameters to the server, so that the server can apply the formula... The server performs aggregation processing on the updated local parameters sent by each client, enabling it to optimize the initial model parameters in the global model based on the updated aggregated parameters, thereby achieving a single optimization of the global model. The client receives the updated aggregated parameters sent by the server and repeats steps 202 to 208 until the accuracy of the global model reaches the required level or the number of iterations of the global model reaches a pre-set target number, ultimately obtaining the optimized global model.

[0083] In the aforementioned model optimization method based on the federated learning framework, the aggregated parameters sent by the server in the federated learning framework are determined as local parameters. The first gradient parameters are then determined based on the local parameters and the local training set. The first gradient parameters are pruned and perturbed to obtain the second gradient parameters. This allows the application of differential privacy mechanisms to the local parameters, thereby protecting the privacy of client data. The local parameters are updated based on the second gradient parameters, and the updated local parameters are sent to the server. This enables the server to aggregate the updated local parameters sent by each client, resulting in the aggregated updated aggregated parameters. Finally, an updated privacy budget value is obtained by updating the preset privacy budget value. This updated privacy budget value is then used to prune and perturb the first gradient parameters to obtain the second gradient. This allows the use of a dynamic privacy budget instead of a fixed privacy budget, reducing the impact of differential privacy mechanisms on the convergence and accuracy of the federated learning framework in model optimization. This improves the convergence speed and accuracy of the global model, reduces the system resources required for model optimization, and thus enhances the utilization of system resources.

[0084] In one embodiment, such as Figure 3 As shown, based on the updated privacy budget value after updating the preset privacy budget value, the first gradient parameters are pruned and perturbed to obtain the second gradient parameters, including:

[0085] Step 302: Obtain the updated privacy budget value and preset gradient clipping value.

[0086] Specifically, the updated privacy budget value is determined based on the preset privacy budget value, preset privacy boundary value, preset budget adjustment rate, and preset privacy leakage threshold pre-set by the federated learning framework. The preset gradient pruning value is also pre-set.

[0087] Step 304: Based on the preset gradient clipping value and local parameters, the first gradient parameters are clipped to obtain the initial second gradient parameters.

[0088] The formula for the cropping process is as follows:

[0089] (5)

[0090] In formula (5) This indicates the preset gradient clipping value; This indicates the calculation of the 2-norm of a matrix; Indicates the first gradient parameter; These are the gradient parameters after clipping, which are also the initial second gradient parameters; The loss function; These are local parameters for client c.

[0091] Optionally, after obtaining the preset gradient clipping values ​​set by the federated learning framework, the client substitutes the preset gradient clipping values ​​and local parameters into the formula. The initial second gradient parameters are solved to obtain the initial second gradient parameters.

[0092] Step 306: Based on the updated privacy budget value and the preset gradient clipping value, the initial second gradient parameters are perturbed to obtain the second gradient parameters.

[0093] The perturbation process involves adjusting the initial second gradient parameters after clipping. Gradient perturbation is performed using the current client's updated privacy budget value and preset gradient clipping value. A Gaussian mechanism is then used to perturb the initial second gradient parameters, yielding the second gradient parameters. The formula for calculating the second gradient parameters is as follows: .

[0094] Optionally, the client sets the initial second gradient parameters after clipping. Gradient perturbation is performed by using the current client's updated privacy budget value and preset gradient clipping value, and the initial second gradient parameters are perturbed using a Gaussian mechanism to obtain the second gradient parameters.

[0095] In this embodiment, the first gradient parameter is clipped using a preset gradient clipping value and local parameters, and then the initial second gradient parameter is perturbed using a Gaussian mechanism to obtain the second gradient parameter. This makes it impossible for attackers to infer user privacy from the model using differential privacy protection, thereby protecting the user's privacy data in the model.

[0096] In one embodiment, obtaining the updated privacy budget value includes:

[0097] Based on the federated learning framework, the preset privacy budget value, preset privacy boundary value, preset budget adjustment rate, and preset privacy leakage threshold are determined, and the privacy leakage value in the federated learning framework is obtained.

[0098] Based on the privacy leakage value, preset privacy boundary value, preset budget adjustment rate, and preset privacy leakage threshold, the preset privacy budget value is updated to obtain the updated privacy budget value.

[0099] Among them, the preset privacy boundary value and the preset budget adjustment rate are preset privacy leakage thresholds. These are pre-set by the federated learning framework, and the privacy leakage value is calculated based on the sample loss.

[0100] exist In this case, the formula used to update the privacy budget value is:

[0101] (6)

[0102] exist In this case, the formula used to update the privacy budget value is:

[0103] (7)

[0104] In the above formula, Indicates the value of privacy breach; This indicates a preset privacy disclosure threshold; This indicates the preset privacy boundary value; Indicates the preset budget adjustment rate; This indicates a preset privacy budget value, which can be pre-set by the Federated Learning Framework; This indicates an update to the privacy budget value. Formula (6) is based on the privacy leak value. If the value is too high, we need to reduce the privacy budget to meet the user's desired level of privacy protection. Formula (7) is based on the privacy leakage value. Using a low privacy budget, while offering high privacy protection, exceeds the user's set requirements. Higher privacy protection means larger gradient perturbations, but this can also reduce model accuracy and convergence. Therefore, a larger privacy budget is needed to mitigate these side effects.

[0105] Optionally, the client, based on the preset privacy boundary value, preset budget adjustment rate, preset privacy leakage threshold, and privacy leakage value pre-set in the federated learning framework, determines the updated privacy budget value after updating the preset privacy budget value according to formula (6) when the privacy leakage value is greater than the sum between the preset privacy boundary value and the preset privacy leakage threshold. When the privacy leakage value is less than the difference between the preset privacy boundary value and the preset privacy leakage threshold, the client determines the updated privacy budget value after updating the preset privacy budget value according to formula (7).

[0106] In this embodiment, the preset privacy budget value is updated based on the privacy leakage value, the preset privacy boundary value, the preset budget adjustment rate, and the preset privacy leakage threshold to obtain the updated privacy budget value. This allows for the updating of the privacy budget value and the use of a dynamic privacy budget instead of a fixed privacy budget. This reduces the impact of the differential privacy mechanism on the convergence and accuracy of the model during model training in the federated learning framework, thereby improving the convergence speed and accuracy of the global model. Consequently, it reduces the system resources required for model optimization and improves the utilization rate of system resources.

[0107] In one embodiment, determining the privacy breach value includes:

[0108] Obtain the model structure of the local model, and based on the model structure and local parameters, determine the local model to be used for sample loss calculation.

[0109] The average loss for each class of samples in the local training set is determined based on the local model.

[0110] Obtain the test set, mix the test set and the local training set to obtain the privacy leakage assessment dataset, and determine the sample category of each sample in the privacy leakage assessment dataset.

[0111] Based on the local model and the privacy breach assessment dataset, the sample loss corresponding to each sample in the privacy breach assessment dataset is determined.

[0112] The privacy leakage value is determined based on the difference between the sample loss corresponding to each sample and the average loss corresponding to the sample category.

[0113] The local model structure is the model structure distributed by the server to each client during the initial stage of model training. The local model consists of the model structure and model parameters. When distributing the local model structure to each client, the appropriate local model structure is assigned based on the task to be performed. For example, if a sample classification task needs to be performed, the model structure for sample classification can be distributed to each client. Then, the client's local parameters are combined with the received local model structure to obtain the local model used for sample classification.

[0114] Average loss It is by using the local training set The samples in the training set are sequentially input into the local model that has already undergone local iteration, where n is the total number of categories of the samples in the local training set. This represents the average loss for the nth class of samples. The average loss can be used as a threshold for classifying members.

[0115] Hybrid processing refers to mixing the local training set on the client side. and local test sets The order is then randomly shuffled to obtain the privacy breach assessment dataset. .

[0116] Sample loss is assessed by evaluating datasets from privacy breaches. The current sample d is retrieved sequentially to obtain the current sample d and its class label. For example, (d, y) indicates that the class label of the current sample d is class y. This is then input into the local model, and the class label is determined by the output of the local model, which is derived from the privacy leakage assessment dataset. By taking the current sample d in sequence and inputting it into the local model, the sample loss of the current sample d can be obtained.

[0117] The privacy leakage value *pl* is determined based on the difference between the sample loss corresponding to each sample and the average loss corresponding to the sample's class. The variables TP, TN, FP, and FN are initialized to 0. TP indicates that the current sample is predicted to belong to the local training set, and it actually belongs to the local training set; TN indicates that the current sample is predicted not to belong to the local training set, and it actually does not belong to the local training set; FP indicates that the current sample is predicted to belong to the local training set, but it actually does not belong to the local training set; FN indicates that the current sample is predicted not to belong to the local training set, but it actually belongs to the local training set. The privacy leakage value *pl* is determined when the sample loss of the current sample *d* is less than the average loss *loss(y)* corresponding to the sample class *y* of the current sample *d*, and the current sample... In the case where the sample loss of the current sample d is less than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample In the case where the sample loss of the current sample d is greater than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample In the case where the sample loss of the current sample d is greater than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample In the case of TP, FN is incremented by 1. If TP equals 0, the privacy leakage value pl is 0; otherwise, pl is calculated using the following formula:

[0118] (8)

[0119] As can be seen from formula (8), when TP equals 0, FP and FN are divided by 0. To avoid this situation, it is necessary to determine in advance whether TP is 0. Since TP represents the count of correct predictions, TP being 0 means that the inference attack method correctly identifies 0 training samples. Therefore, when TP equals 0, pl is set to 0.

[0120] Optionally, the client determines the local model used for calculating sample loss based on the model structure distributed to each client by the server and the client's local parameters. The client will then use its local training set. The samples in the local training set are sequentially input into the local model that has already undergone local iterations to obtain the average loss for each class of samples in the local training set. The client inputs the local training set... and local test sets The dataset is mixed and its order is randomly shuffled to obtain a privacy breach assessment dataset. The client assesses the privacy breach dataset. The current sample d is retrieved sequentially to obtain the current sample d and its class label. These are then input into the local model to obtain the sample loss for the current sample d. The client initializes the variables TP, TN, FP, and FN to 0. The current sample loss is determined when the current sample loss is less than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample... In the case where the sample loss of the current sample d is less than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample In the case where the sample loss of the current sample d is greater than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample In the case where the sample loss of the current sample d is greater than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample In the case of TP, FN is incremented by 1. If TP equals 0, the privacy leakage value pl is 0; otherwise, the formula for calculating pl is... .

[0121] In this embodiment, the accuracy of sample classification inference can be improved by using the average loss of each class of samples in the local training set of the client instead of the average loss of all sample classes as the member classification threshold.

[0122] In one embodiment, such as Figure 4 As shown, a model optimization method based on a federated learning framework is provided, which is then applied to... Figure 1 Taking the server in the example, the following steps are included:

[0123] Step 402: Determine the aggregation parameters and send them to each client in the federated learning framework, so that each client can determine the aggregation parameters as local parameters, update the local parameters, and obtain updated local parameters.

[0124] The initial aggregation parameters can be randomly generated. The aggregation parameters for the nth round (where n is a positive integer greater than 1) are obtained by aggregating the local parameters sent by each client.

[0125] Optionally, the server determines the aggregation parameters and sends them to each client, so that the client can determine the received aggregation parameters as local parameters and update the local parameters to obtain updated local parameters.

[0126] Step 404: Receive the updated local parameters sent by each client, determine the number of samples in the local training set of each client, and accumulate the number of samples corresponding to each client to obtain the total number of samples.

[0127] The total number of samples is the sum of the number of samples in the local training set of each client.

[0128] Step 406: Based on the number of samples corresponding to each client and the total number of samples, the updated local parameters are aggregated to obtain the updated aggregate parameters.

[0129] Optionally, the server determines the number of samples and the total number of samples corresponding to each client, and aggregates the updated local parameters sent by each client to obtain updated aggregate parameters for optimizing the global model.

[0130] Step 408: Based on the updated aggregation parameters, complete one model optimization of the global model, distribute the updated aggregation parameters to each client, and repeat the above steps until the accuracy of the global model reaches the requirement or the number of global iterations reaches the preset target number, to obtain the final optimized global model.

[0131] The global model is a machine learning model. Therefore, the accuracy of the global model with classification and prediction functions can be calculated by giving the global model a validation dataset and using the formula: accuracy = number of correctly classified samples / total number of samples. The global model accuracy is then repeatedly iterated until the accuracy of the global model reaches the required level or the number of global iterations reaches the preset target number. This completes the optimization of the global model and yields the final optimized global model.

[0132] Optionally, the server optimizes the initial model parameters in the global model based on the updated aggregation parameters, and repeats the global iteration until the global model accuracy reaches the required level or the number of global iterations reaches the preset target number, thus obtaining the optimized global model.

[0133] In this embodiment, by determining the aggregation parameters and sending them to each client, each client can treat the aggregation parameters as local parameters and update them. The server can then perform aggregation processing based on the updated local parameters sent by each client to obtain the updated aggregation parameters. This allows the global model to be optimized using the aggregation parameters, and global iterations can be repeated to obtain the final optimized global model.

[0134] In one embodiment, a model optimization system based on a federated learning framework is provided. The system includes a server and multiple clients, and performs the following steps when the system is in operation:

[0135] The server sends the aggregation parameters to each client.

[0136] Each client receives the aggregation parameters sent by the server and determines the aggregation parameters as local parameters.

[0137] Each client determines its own first gradient parameters based on its local parameters and local training set.

[0138] Each client performs cropping and perturbation processing on the first gradient parameters based on the updated privacy budget value after updating the preset privacy budget value, to obtain the second gradient parameters.

[0139] Each client updates its local parameters based on the second gradient parameters, obtaining the updated local parameters for each client, and then sends the updated local parameters to the server.

[0140] The server receives updated local parameters from each client, aggregates these updated local parameters, and obtains updated aggregate parameters. Based on these updated aggregate parameters, the server performs a global model optimization.

[0141] The server will update the aggregation parameters and distribute them to each client, repeating the above steps until the accuracy of the global model reaches the required level or the number of global iterations reaches the preset target number, thus obtaining the final optimized global model.

[0142] Optionally, in the federated learning framework, the server first sends the aggregated parameters to each client. Each client, upon receiving the aggregated parameters from the server, determines them as its local parameters. Then, each client uses its local parameters and local training set to solve for its local first gradient parameters, obtaining its own first gradient parameters. Each client updates its preset privacy budget value, obtaining an updated privacy budget value. Based on this updated privacy budget value, it then prunes and perturbs the first gradient parameters, obtaining its own second gradient parameters. Each client updates its own local parameters based on the second gradient parameters, obtaining updated local parameters, and sends these updated local parameters to the server. The server receives the updated local parameters from each client and aggregates the received updated local parameters to obtain updated aggregated parameters. The server uses the updated aggregated parameters to optimize the global model and distributes the updated aggregated parameters to each client. This process is repeated until the global model's accuracy reaches the required level or the number of iterations reaches the target number, resulting in an optimized global model.

[0143] In this embodiment, by determining the aggregated parameters sent by the server in the federated learning framework as local parameters, and determining the first gradient parameters based on the local parameters and the local training set, and then pruning and perturbing the first gradient to obtain the second gradient parameters, differential privacy mechanisms can be applied to the local parameters, thereby protecting the privacy of client data. By updating the local parameters based on the second gradient parameters and sending the updated local parameters to the server, the server can aggregate the updated local parameters sent by each client to obtain the aggregated updated aggregated parameters. By updating the preset privacy budget value to obtain an updated privacy budget value, and then using the updated privacy budget value to prune and perturb the first gradient parameters to obtain the second gradient, a dynamic privacy budget can be used instead of a fixed privacy budget. This reduces the impact of differential privacy mechanisms on the convergence and accuracy of the federated learning framework in model optimization, thereby improving the convergence speed and accuracy of the global model, reducing the system resources required for model optimization, and thus improving the utilization rate of system resources.

[0144] This application also provides an application scenario in which the above-described model optimization method based on the federated learning framework is applied. Specifically, the application of the model optimization method based on the federated learning framework in this scenario is as follows:

[0145] The federated learning framework pre-sets a privacy budget value for each client. Preset privacy leakage threshold Preset privacy boundary values and preset privacy budget adjustment rate Each client receives aggregated parameters from the central server. and update local parameters. The client is based on its local training set and local parameters. The first gradient parameters are calculated using the gradient descent method. Specifically, for the first gradient parameter of client c... The calculation process is as follows: Each client applies a differential privacy mechanism to its local model parameters to protect client data privacy. This mainly includes two steps: gradient clipping and gradient perturbation. First, the first gradient parameters... Gradient clipping is performed to obtain the initial second gradient parameters after clipping. . Specifically, The calculation process is as follows: Then, the initial second gradient parameters after clipping are perturbed using the current client's updated privacy budget value. The initial second gradient parameters are perturbed using a Gaussian mechanism to obtain the second gradient parameters. . Specifically, The calculation process is as follows: Each client uses the gradient descent algorithm to update its local parameters, thus obtaining the updated local parameters. And will update local parameters Uploaded to the central server. Specifically, The calculation process is as follows: Each client uses an improved membership inference attack method to expose privacy-leaking values ​​of the local model. Perform calculations and based on Value and the previous privacy budget Privacy budget used for the next gradient perturbation Adjustments and updates will be made. Specifically, in In this case, the formula used to update the privacy budget value is: .exist In this case, the formula used to update the privacy budget value is: .

[0146] Calculating privacy breach values ​​using an improved membership inference attack method. The process is as follows: The client's local training set... The samples are sequentially input into the local model that has already undergone local iterations, and the average loss for each class of samples is calculated. Hybrid local training set and test set The order is then randomly shuffled to obtain the privacy breach assessment dataset. The initial values ​​of variables TP, TN, FP, and FN are set to 0. This is derived from a privacy breach assessment dataset. We sequentially extract the current sample d, obtaining the current sample d and its class label. Then, we input these into the local model to obtain the sample loss for the current sample d. The loss is calculated when the sample loss for the current sample d is less than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample... If the current sample d's loss is less than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample... If the sample loss of the current sample d is greater than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample If the sample loss of the current sample d is greater than the average loss(y) corresponding to the sample class y of the current sample d, and the current sample... If TP equals 0, then FN is incremented by 1. If TP equals 0, then the privacy leak value pl is 0; otherwise, the formula for calculating pl is... .

[0147] The central server receives updated local parameters from various clients. The central server uses a federated average method to aggregate the local update parameters from each client, obtaining the aggregated update parameters for this global round. And send it to each client. The specific calculation steps are as follows: The process of receiving aggregation parameters from the client, obtaining updated aggregation parameters, and sending the updated aggregation parameters to each server is repeated until the accuracy of the global model reaches the required level or the number of global iterations reaches the target number, resulting in an optimized global model.

[0148] In this embodiment, by determining the aggregated parameters sent by the server in the federated learning framework as local parameters, and determining the first gradient parameters based on the local parameters and the local training set, and then pruning and perturbing the first gradient to obtain the second gradient parameters, differential privacy mechanisms can be applied to the local parameters, thereby protecting the privacy of client data. By updating the local parameters based on the second gradient parameters and sending the updated local parameters to the server, the server can aggregate the updated local parameters sent by each client to obtain the aggregated updated aggregated parameters. By updating the preset privacy budget value to obtain an updated privacy budget value, and then using the updated privacy budget value to prune and perturb the first gradient parameters to obtain the second gradient, a dynamic privacy budget can be used instead of a fixed privacy budget. This reduces the impact of differential privacy mechanisms on the convergence and accuracy of the federated learning framework in model optimization, thereby improving the convergence speed and accuracy of the global model, reducing the system resources required for model optimization, and thus improving the utilization rate of system resources.

[0149] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0150] Based on the same inventive concept, this application also provides a federated learning framework-based model optimization apparatus for implementing the above-mentioned federated learning framework-based model optimization method. The solution provided by this apparatus is similar to the implementation scheme described in the above-described method. Therefore, the specific limitations in one or more embodiments of the federated learning framework-based model optimization apparatus provided below can be found in the limitations of the federated learning framework-based model optimization method described above, and will not be repeated here.

[0151] In one embodiment, such as Figure 5 As shown, a model optimization device based on a federated learning framework is provided, comprising:

[0152] The parameter receiving module 502 is used to receive the aggregated parameters sent by the server in the federated learning framework, determine the aggregated parameters as local parameters, and determine the first gradient parameters based on the local parameters and the local training set.

[0153] The gradient determination module 504 is used to perform cropping and perturbation processing on the first gradient parameters based on the updated privacy budget value after updating the preset privacy budget value, so as to obtain the second gradient parameters.

[0154] The parameter update module 506 is used to update the local parameters based on the second gradient parameters to obtain the updated local parameters.

[0155] The parameter aggregation module 508 is used to send updated local parameters to the server so that the server can aggregate the updated local parameters to obtain updated aggregated parameters. Based on the updated aggregated parameters, the global model is optimized once.

[0156] The first model optimization module 510 is used to receive the updated aggregation parameters sent by the server, repeat the above steps until the accuracy of the global model reaches the requirement or the number of global iterations reaches the preset target number, and the server completes global training to obtain the final optimized global model.

[0157] In one embodiment, the gradient determination module includes:

[0158] The data acquisition unit is used to acquire updated privacy budget values ​​and preset gradient clipping values.

[0159] The first gradient determination unit is used to perform a clipping process on the first gradient parameters based on the preset gradient clipping value and the local parameters to obtain the initial second gradient parameters.

[0160] The second gradient determination unit is used to perturb the initial second gradient parameters based on the updated privacy budget value and the preset gradient clipping value to obtain the second gradient parameters.

[0161] In one embodiment, the data acquisition unit includes:

[0162] The data acquisition subunit is used to determine the preset privacy budget value, preset privacy boundary value, preset budget adjustment rate and preset privacy leakage threshold based on the federated learning framework, and to acquire the privacy leakage value in the federated learning framework.

[0163] The data update subunit is used to update the preset privacy budget value based on the privacy leakage value, the preset privacy boundary value, the preset budget adjustment rate, and the preset privacy leakage threshold, so as to obtain the updated privacy budget value.

[0164] In one embodiment, the data acquisition subunit includes:

[0165] The model determination subunit is used to obtain the model structure of the local model. Based on the model structure and local parameters, the local model used for sample loss calculation is determined.

[0166] The average loss calculation subunit is used to determine the average loss for each class of samples in the local training set based on the local model.

[0167] The data mixing subunit is used to obtain the test set, mix the test set and the local training set to obtain the privacy leakage assessment dataset, and determine the sample category of each sample in the privacy leakage assessment dataset.

[0168] The sample loss calculation subunit is used to determine the sample loss corresponding to each sample in the privacy leakage assessment dataset based on the local model and the privacy leakage assessment dataset.

[0169] The privacy leakage value determination subunit is used to determine the privacy leakage value based on the difference between the sample loss corresponding to each sample and the average loss corresponding to the sample category.

[0170] In one embodiment, such as Figure 6As shown, a model optimization device based on a federated learning framework is provided, comprising:

[0171] The parameter sending module 602 is used to determine the aggregation parameters and send the aggregation parameters to each client in the federated learning framework, so that each client can determine the aggregation parameters as local parameters, update the local parameters, and obtain updated local parameters.

[0172] The quantity determination module 604 is used to receive the updated local parameters sent by each client, determine the number of samples in the local training set of each client, and accumulate the sample counts of each client to obtain the total number of samples.

[0173] The data aggregation module 606 is used to aggregate the updated local parameters based on the number of samples corresponding to each client and the total number of samples, so as to obtain the updated aggregated parameters.

[0174] The second model optimization module 608 is used to perform a model optimization on the global model based on the updated aggregation parameters. The model optimization is repeated until the accuracy of the global model reaches the requirement or the number of global iterations reaches the preset target number, so as to obtain the final optimized global model.

[0175] The modules in the aforementioned model optimization device based on the federated learning framework can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.

[0176] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores aggregation parameters, local parameters, first gradient parameters, updated privacy budget values, preset privacy budget values, second gradient parameters, updated local parameters, and updated aggregation parameters. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a model optimization method based on a federated learning framework.

[0177] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0178] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0179] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0180] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0181] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0182] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0183] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0184] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A model optimization method based on a federated learning framework, characterized in that, A method applied to a client in a federated learning framework, the method comprising: receiving an aggregation parameter sent by a server in the federated learning framework, determining the aggregation parameter as a local parameter, determining a first gradient parameter based on the local parameter and a local training set; based on an updated privacy budget value after updating a preset privacy budget value, performing clipping and perturbation processing on the first gradient parameter to obtain a second gradient parameter; updating the local parameter based on the second gradient parameter to obtain an updated local parameter; sending the updated local parameter to the server to enable the server to perform aggregation processing on the updated local parameter to obtain an updated aggregation parameter, and based on the updated aggregation parameter, completing one model optimization of a global model; receiving the updated aggregation parameter sent by the server, repeating the above steps until the accuracy of the global model reaches a requirement or the number of global iterations reaches a pre-set target number, and the server completes global training to obtain a finally optimized global model; wherein the clipping and perturbation processing on the first gradient parameter based on the updated privacy budget value after updating the preset privacy budget value to obtain the second gradient parameter comprises: obtaining an updated privacy budget value and a preset gradient clipping value; performing clipping processing on the first gradient parameter based on the preset gradient clipping value and the local parameter to obtain an initial second gradient parameter; performing perturbation processing on the initial second gradient parameter based on the updated privacy budget value and the preset gradient clipping value to obtain the second gradient parameter; and the obtaining of the updated privacy budget value comprises: determining a preset privacy budget value, a preset privacy boundary value, a preset budget adjustment rate and a preset privacy leakage threshold based on the federated learning framework, and obtaining a privacy leakage value in the federated learning framework; updating the preset privacy budget value based on the privacy leakage value, the preset privacy boundary value, the preset budget adjustment rate and the preset privacy leakage threshold to obtain the updated privacy budget value; wherein the determination formula of the first gradient parameter is: , wherein, is a local parameter for the client c; denotes a first gradient parameter; gi denotes the i-th global federation iteration round; is a local training set local to the client c denotes the total number of samples of the local training set; is the i-th sample data in the local training set; is a loss function; the calculation formula of the second gradient parameter is: in, These are the second gradient parameters; These are the gradient parameters after clipping. This indicates that the mean is 0 and the variance is . Gaussian distribution sampling results; The privacy budget spent by client c during this gradient perturbation; These are gradient clipping values; the formula of the aggregation processing is: , wherein, denotes the updated local parameters of the client c, ; denotes the updated aggregated parameters; is the total number of samples in the local training set local to the client c; is the total number of samples obtained by accumulating the number of samples in the local training sets of the individual clients.

2. The method of claim 1, wherein, the obtaining of the privacy leakage value in the federated learning framework comprises: obtaining a model structure of a local model, and determining a local model used for sample loss calculation based on the model structure and the local parameter; determining an average loss corresponding to each class of samples in the local training set based on the local model; obtaining a test set, performing mixing processing on the test set and the local training set to obtain a privacy leakage evaluation data set, and determining the sample classes of each sample in the privacy leakage evaluation data set; determining a sample loss corresponding to each sample in the privacy leakage evaluation data set based on the local model and the privacy leakage evaluation data set; determining a privacy leakage value based on the difference between the sample loss corresponding to each sample and the average loss corresponding to the sample class of the sample.

3. A model optimization method based on a federated learning framework, characterized in that, A method applied to a server in a federated learning framework, the method comprising: determining an aggregation parameter and sending the aggregation parameter to each client in a federated learning framework, so that each client determines the aggregation parameter as a local parameter, updates the local parameter to obtain an updated local parameter, and the client applies the model optimization method based on the federated learning framework of claim 1 or 2; receiving the updated local parameter sent by each client, determining the number of samples in the local training set of each client, and accumulating the number of samples corresponding to each client to obtain a total number of samples; performing aggregation processing on the updated local parameter based on the number of samples corresponding to each client and the total number of samples to obtain an updated aggregation parameter; completing one model optimization of the global model based on the updated aggregation parameter, distributing the updated aggregation parameter to each client, and repeating the above steps until the accuracy of the global model reaches a requirement or the global iteration number reaches a pre-set target number, to obtain a finally optimized global model.

4. A model optimization system based on a federated learning framework, characterized in that, The system comprises a server and a plurality of clients; the client applies the model optimization method based on the federated learning framework of claim 1 or 2; and the server applies the model optimization method based on the federated learning framework of claim 3. The server sends an aggregation parameter to each client. Each client receives the aggregation parameter sent by the server and determines the aggregation parameter as a local parameter. Each client determines a first gradient parameter corresponding to each client based on the local parameter and the local training set. Each client performs clipping and perturbation processing on the first gradient parameter based on an updated privacy budget value updated from a preset privacy budget value to obtain a second gradient parameter. Each client updates the local parameter based on the second gradient parameter to obtain an updated local parameter corresponding to each client, and sends the updated local parameter to the server. The server receives the updated local parameter sent by each client, aggregates each updated local parameter to obtain an updated aggregation parameter, and completes one model optimization of the global model based on the updated aggregation parameter. The server distributes the updated aggregation parameter to each client, and repeats the above steps until the accuracy of the global model reaches a requirement or the global iteration number reaches a pre-set target number, to obtain a finally optimized global model.

5. A model optimization apparatus based on a federated learning framework, characterized in that, The device comprises: a parameter receiving module configured to receive an aggregation parameter sent by a server in a federated learning framework, determine the aggregation parameter as a local parameter, and determine a first gradient parameter based on the local parameter and a local training set; a gradient determining module configured to perform clipping and perturbation processing on the first gradient parameter based on an updated privacy budget value updated from a preset privacy budget value to obtain a second gradient parameter; a parameter updating module configured to update the local parameter based on the second gradient parameter to obtain an updated local parameter. The parameter aggregation module is configured to send the updated local parameter to the server, so that the server performs aggregation processing on the updated local parameter to obtain updated aggregated parameters, and based on the updated aggregated parameters, one model optimization of the global model is completed. The first model optimization module is configured to receive the updated aggregated parameters sent by the server, repeat the above steps until the accuracy of the global model reaches a requirement or the number of global iterations reaches a target number of times preset in advance, the server completes global training, and finally obtains an optimized global model. The first gradient parameter is clipped and disturbed based on the updated privacy budget value to obtain a second gradient parameter, including: obtaining an updated privacy budget value and a preset gradient clipping value; clipping the first gradient parameter based on the preset gradient clipping value and the local parameter to obtain an initial second gradient parameter; and disturbing the initial second gradient parameter based on the updated privacy budget value and the preset gradient clipping value to obtain the second gradient parameter; the obtaining of the updated privacy budget value includes: determining a preset privacy budget value, a preset privacy boundary value, a preset budget adjustment rate, and a preset privacy leakage threshold based on the federated learning framework, and obtaining a privacy leakage value in the federated learning framework; and updating the preset privacy budget value based on the privacy leakage value, the preset privacy boundary value, the preset budget adjustment rate, and the preset privacy leakage threshold to obtain the updated privacy budget value; The determination formula of the first gradient parameter is: , wherein, is a local parameter for the client c; denotes a first gradient parameter; gi denotes the i-th global federation iteration round; is a local training set locally to the client c is the total number of samples of the local training set; is the i-th sample data in the local training set, is a loss function; The calculation formula of the second gradient parameter is: wherein, is a second gradient parameter; is a gradient parameter after clipping processing; represents a Gaussian distribution sampling result with a mean of 0 and a variance of is a privacy budget spent by the client c at this time of gradient perturbation; is a gradient clipping value;​ The formula of the aggregation processing is: , wherein, represents updating local parameters of the client c, ; represents updating aggregated parameters; is the total number of samples in the local training set local to the client c; is the total number of samples obtained by accumulating the number of samples in the local training sets of the respective clients. 6.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-5 when the computer program is executed by the processor. The processor executes the computer program to implement the steps of the method in any one of claims 1 to 3.

7. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 3.

8. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 3.