Machine learning method, learning device, equipment, storage medium and product
By conducting homomorphic encryption training on multi-layer residual network models in federated learning networks, and using multiple rounds of parameter weighted aggregation of edge servers and central servers, the problem of large communication bandwidth burden and insufficient data protection in federated learning is solved, and efficient privacy protection machine learning is achieved.
Patent Information
- Application Number
- CN202411980862.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-29
AI Technical Summary
In federated learning networks, frequent communication between servers and remote clients leads to a large bandwidth burden on the communication network and insufficient protection of user-sensitive data, which poses risks such as model inversion attacks, member reasoning attacks and model reasoning attacks.
By loading the initial model parameters onto the multi-layer residual network model, the training data is converted into integer domain data and homomorphic encryption is performed, and the multi-layer residual network model is modeled by using encrypted training data to achieve privacy protection machine learning. At the same time, the client connects to the edge server to communicate, and uses multiple rounds of parameter weighted aggregation of the edge server and the central server to finally obtain the trained global model parameters.
It effectively reduces communication overhead, enhances the protection of user-sensitive data, prevents model inversion attacks, member reasoning attacks and model inference attacks, and achieves the goal of privacy protection machine learning.
Smart Images

Figure CN119903899A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a machine learning method, a machine learning device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In a federated learning network, the server is the core hub of the federated learning network. The server is responsible for initiating learning tasks, coordinating resources from all parties and formulating unified training strategies. After receiving the server's instructions, the remote client performs model training based on locally stored data. Therefore, the server and the remote client need to communicate frequently to exchange model parameters or gradients. On the one hand, it is easy to cause a bandwidth burden on the communication network. On the other hand, although user sensitive data can be protected by exchanging model parameters or gradients, there are still model inversion attacks, member reasoning attacks and model reasoning attacks, resulting in insufficient protection for user sensitive data.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The purpose of the present disclosure is to provide a machine learning method, a machine learning device, an electronic device, a computer-readable storage medium and a computer program product, which can at least to some extent overcome the problems in related technologies of heavy bandwidth burden of communication networks and insufficient protection of user sensitive data.
[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0006] According to one aspect of the present disclosure, a machine learning method is provided, comprising: in response to initial model parameters sent by a central server via an edge server, loading the initial model parameters into a multi-layer residual network model; converting training data into integer domain data, and performing homomorphic encryption operations on the integer domain data to obtain encrypted training data; performing adaptive optimization suitable for homomorphic encryption processing on the multi-layer residual network model to obtain a training model, performing gradient descent model training on the training model based on the encrypted training data, and iteratively updating the initial model parameters based on the number of iterations of the model training to obtain model update parameters, wherein the number of iterations of the model training is performed based on the number of local iterations; feeding back the model update parameters to the edge server, so that the edge server performs weighted aggregation on the model update parameters received from multiple clients until a model update result is generated, and feeding back the model update results to the central server, and the central server performs weighted aggregation on the model update results received from multiple edge servers to obtain trained global model parameters.
[0007] In one embodiment of the present disclosure, training data is converted into integer domain data, and a homomorphic encryption operation is performed on the integer domain data to obtain encrypted training data, including: the training data includes training image data, and the training image data is divided into multiple batches of data to be trained; the data to be trained is vectorized to obtain vectors to be trained; the vectors to be trained are converted into integer domain data; and the integer domain data is homomorphically encrypted to obtain the encrypted training data.
[0008] In one embodiment of the present disclosure, performing a homomorphic encryption operation on the integer domain data to obtain the encrypted training data includes: performing a homomorphic encryption operation on the integer domain data based on the RNS-CKKS encryption method to obtain the encrypted training data.
[0009] In one embodiment of the present disclosure, adaptive optimization suitable for homomorphic encryption processing is performed on the multi-layer residual network model to obtain a training model, including: applying Chebyshev polynomials to approximate the rectified linear unit ReLU function to convert the nonlinear operation of the ReLU function into a polynomial linear operation ReLU, so as to construct a ReLU activation layer in the multi-layer residual network model based on the linear operation ReLU; constructing the Softmax layer in the multi-layer residual network model based on homomorphic approximation using logarithmic and exponential functions as a fully connected layer to generate an intermediate model including the ReLU activation layer and the fully connected layer; and compressing the intermediate model based on dynamic quantization to obtain the training model.
[0010] In one embodiment of the present disclosure, the intermediate model is compressed based on dynamic quantization to obtain the training model, including: the ReLU activation layer and the fully connected layer in the intermediate model are compressed based on dynamic quantization to obtain the training model.
[0011] In one embodiment of the present disclosure, gradient descent model training is performed on the training model based on the encrypted training data, including: quantizing the initial model parameters in the training model to obtain quantized model parameters; inputting the encrypted training data into each layer of the training model in turn, performing forward propagation model training to output corresponding prediction results, wherein the quantized model parameters are used to provide initial weights for feature extraction operations on the encrypted training data when the encrypted training data is input into the convolutional layer of the training model; calculating an encrypted loss value based on the prediction result and a loss function; based on the encrypted loss value, performing back propagation under the framework of homomorphic encryption to calculate the loss function for the parameter gradients in each layer of the training model; updating the quantized model parameters based on the parameter gradients with the gradient descent as the goal, and iterating to obtain the model update parameters.
[0012] In one embodiment of the present disclosure, the encrypted training data is sequentially input into each layer of the training model, and further includes: for the output encrypted data corresponding to each layer of depth calculation of the training model, a bootstrap operation is performed on the output encrypted data until the gradient descent model training is completed.
[0013] In one embodiment of the present disclosure, a bootstrap operation is performed on the output encrypted data, including: encoding the output encrypted data into a standardized polynomial form; segmenting the output encrypted data in the polynomial form based on a block method and performing modulus switching to obtain switched encrypted data, so as to input the switched encrypted data into the next layer accordingly.
[0014] In one embodiment of the present disclosure, the model update parameters are fed back to the edge server so that the edge server performs weighted aggregation on the model update parameters received from multiple clients until a model update result is generated, including: feeding back the model update parameters to the edge server so that the edge server performs weighted aggregation on the model update parameters received from multiple clients to generate an intermediate update result, and feeding back the intermediate update result to the client as an iterative interaction with the edge server; when the iterative interaction with the edge server reaches a preset number of times, the model training is stopped, wherein the edge server performs weighted aggregation on all the intermediate update results obtained after the last iterative interaction to generate the model update result, and feeds it back to the central server, and the central server performs weighted aggregation on the model update results received from multiple edge servers to obtain the trained global model parameters.
[0015] In one embodiment of the present disclosure, it also includes: receiving the target model parameters sent by the central server via the edge server to update the training model based on the target model parameters, and the target model parameters are obtained by the central server performing weighted aggregation on multiple global model parameters.
[0016] According to another aspect of the present disclosure, a machine learning method is provided, including: receiving initial model parameters generated by a central server, and sending the initial model parameters to multiple clients; receiving model update parameters generated by the multiple clients based on homomorphic encryption model training; weighted aggregation of the model update parameters until a model update result is generated; feeding back the model update result to the central server, and the central server weighted aggregation of the model update results received from the multiple edge servers to obtain trained global model parameters.
[0017] In one embodiment of the present disclosure, the model update parameters are weighted aggregated until a model update result is generated, including: weighted aggregation of the model update parameters to generate an intermediate update result, and feeding back the intermediate update result to the client as an iterative interaction with the edge server; when the iterative interaction with the client reaches a preset number of times, weighted aggregation of all the corresponding intermediate update results is performed to generate a model update result, and the model update result is fed back to the central server, and the central server weighted aggregates the model update results received from multiple edge servers to obtain trained global model parameters.
[0018] In one embodiment of the present disclosure, the initial model parameters are sent to multiple clients, including: in each round of the iterative interaction, the initial model parameters are sent to some of the clients based on a preset ratio for model training.
[0019] In one embodiment of the present disclosure, it also includes: receiving a target model parameter sent by the central server, wherein the target model parameter is obtained by weighted aggregation of multiple global model parameters obtained by the central server; and sending the target model parameter to the client.
[0020] According to another aspect of the present disclosure, a machine learning method is provided, including: generating initial model parameters, and sending the initial model parameters to multiple edge servers; receiving model update results generated by the multiple edge servers, the model update results are generated by the edge servers performing weighted aggregation on model update parameters sent by clients, the model update parameters are generated by client-based homomorphic encryption model training; weighted aggregation is performed on the model update results to obtain trained global model parameters.
[0021] In one embodiment of the present disclosure, it also includes: performing multiple rounds of communication interactions with the edge server; performing weighted aggregation on the multiple global model parameters obtained based on the multiple rounds of communication interactions to obtain target model parameters.
[0022] According to another aspect of the present disclosure, a machine learning device is provided, comprising: a loading module, for loading the initial model parameters into a multi-layer residual network model in response to the initial model parameters sent by the central server via the edge server; an encryption module, for converting the training data into integer domain data, and performing homomorphic encryption operation on the integer domain data to obtain encrypted training data; a training module, for performing adaptive optimization suitable for homomorphic encryption processing on the multi-layer residual network model to obtain a training model, so as to perform gradient descent model training on the training model based on the encrypted training data, and iteratively update the initial model parameters based on the number of iterations of the model training to obtain model update parameters, wherein the number of iterations of the model training is performed based on the local number of iterations; a first feedback module, for feeding back the model update parameters to the edge server, so that the edge server performs weighted aggregation on the model update parameters received from multiple clients until a model update result is generated and fed back to the central server, and the central server performs weighted aggregation on the model update results received from the multiple edge servers to obtain trained global model parameters.
[0023] According to another aspect of the present disclosure, a machine learning device is provided, including: a first receiving module, used to receive initial model parameters generated by a central server, and send the initial model parameters to multiple clients; a second receiving module, used to receive model update parameters generated by the multiple clients based on homomorphic encryption model training; a first weighting module, used to weightedly aggregate the model update parameters until a model update result is generated; a second feedback module, used to feed back the model update result to the central server, and the central server weightedly aggregates the model update results received from the multiple edge servers to obtain trained global model parameters.
[0024] According to another aspect of the present disclosure, a machine learning device is provided, including: a generating module, used to generate initial model parameters, and send the initial model parameters to multiple edge servers; a third receiving module, used to receive model update results generated by the multiple edge servers, the model update results are generated by the edge servers by weighted aggregation of model update parameters sent by clients, and the model update parameters are generated by the client based on homomorphic encryption model training; a second weighting module, used to weighted aggregation of the model update results to obtain trained global model parameters.
[0025] According to another aspect of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; the processor is configured to perform the above-mentioned machine learning method by executing the executable instructions.
[0026] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned machine learning method is implemented.
[0027] According to another aspect of the present disclosure, a computer program product is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned machine learning method is implemented.
[0028] The machine learning solution provided by the embodiments of the present disclosure sends the initial model parameters to each client and loads them into a multi-layer residual network model, converts the training data into an integer domain and performs homomorphic encryption operations, and uses encrypted training data to perform model training on the multi-layer residual network model to achieve PPML (privacy-preserving machine learning). The clients participating in the model training can connect to the nearest network edge server for communication, and perform multiple rounds of weighted aggregation of parameters on the edge server and the central server. The trained global model parameters finally integrate the information of multiple clients and edge servers, thereby effectively reducing communication overhead.
[0029] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0031] Figure 1 A schematic diagram of a machine learning system in an embodiment of the present disclosure is shown;
[0032] Figure 2 A schematic flow chart showing a machine learning method according to an embodiment of the present disclosure is shown;
[0033] Figure 3 A schematic flow chart showing another machine learning method in an embodiment of the present disclosure;
[0034] Figure 4 A schematic flow chart showing another machine learning method in an embodiment of the present disclosure is shown;
[0035] Figure 5 A schematic flow chart showing another machine learning method in an embodiment of the present disclosure;
[0036] Figure 6 A schematic flow chart showing another machine learning method in an embodiment of the present disclosure;
[0037] Figure 7 A schematic flow chart showing another machine learning method in an embodiment of the present disclosure;
[0038] Figure 8 A schematic diagram of a machine learning device in an embodiment of the present disclosure is shown;
[0039] Fig. 9 A schematic diagram of another machine learning device in an embodiment of the present disclosure is shown;
[0040] Fig.10 A schematic diagram of another machine learning device in an embodiment of the present disclosure is shown;
[0041] Fig.11 A structural block diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0042] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0043] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0044] like Figure 1 As shown, the federated learning network, that is, the architecture of federated learning includes a cloud center server 120, an edge server 140 and a client 160. The center server 120 is responsible for coordinating the entire federated learning process, determining the training rounds, the participating edge servers 140, initializing the global model parameters, and distributing them to the edge servers 140, and using the verification data set to evaluate the updated global model to determine whether the performance of the model meets expectations.
[0045] The edge server 140 receives the initial model parameters sent by the cloud center server 120, and further distributes them to the connected client 160. After the client 160 completes local training, it collects the model update parameters uploaded by the client 160, aggregates these parameters locally, and acts as a bridge between the client 160 and the cloud center server 120, reducing direct communication between the client 160 and the cloud center server 120.
[0046] The client 160 has local training data and trains the model locally using the initial model parameters received from the edge server 140 or the cloud center server 120. During the training process, the gradient of the model or the update parameters are calculated based on the local data, and the update information is uploaded to the edge server 140.
[0047] To facilitate understanding, several terms involved in this application are first explained below.
[0048] RNS (Residue Number System) - CKKS (Cheon-Kim-Kim-Song) is a technology used in the field of homomorphic encryption to improve computing efficiency and accuracy.
[0049] ResNet-20: refers to a ResNet network with 20 layers. ResNet (Residual Network) is a deep neural network architecture that aims to solve the problems of gradient vanishing and gradient exploding during deep neural network training, allowing the network to be trained deeper.
[0050] PPML (Privacy-Preserving Machine Learning) is a general term for a series of machine learning technologies and methods aimed at protecting data privacy.
[0051] Gradient: Essentially a vector, it represents the rate of change and direction of a function at a certain point. In the model training scenario of federated learning, this function refers to the loss function, which is used to measure the difference between the model prediction result and the true label. The goal of model training is to minimize the value of the loss function by adjusting the model parameters, and the gradient indicates the direction in which the loss function decreases fastest under the current parameters.
[0052] Below, the various steps of the machine learning method respectively executed by the client, edge server and central server in the federated learning network in this example implementation will be described in more detail with reference to the accompanying drawings and embodiments.
[0053] Figure 2 A flow chart of a machine learning method in an embodiment of the present disclosure is shown.
[0054] like Figure 2 As shown, a machine learning method according to an embodiment of the present disclosure includes:
[0055] Step S202, in response to the initial model parameters sent by the central server via the edge server, the initial model parameters are loaded into the multi-layer residual network model.
[0056] Among them, the multi-layer residual network model can be a ResNet-20 model, and the ResNet-20 model includes a convolutional layer, a residual block, a batch normalization layer, a ReLU activation layer, a global average pooling layer and a fully connected layer.
[0057] In some embodiments, the federated learning network includes a cloud center server layer, an edge server layer, and a client layer, and is combined with asynchronous communication methods. The edge servers in each region communicate with the cloud center server in the architecture. Since the communication overhead between the client and the edge server is small, after the client uses local data to train the model, it directly uses synchronous communication methods to upload the data to the edge server.
[0058] Step S204, converting the training data into integer domain data, and performing homomorphic encryption operations on the integer domain data to obtain encrypted training data.
[0059] Among them, integer domain data is used for homomorphic encryption, which is an encryption method that allows specific calculations to be performed on ciphertext, and the decryption result is equivalent to the same calculation on the plaintext.
[0060] In some embodiments, the client first preprocesses the local training data, converts it into integer domain data, and encrypts the converted integer domain data using a homomorphic encryption algorithm. Homomorphic encryption technology allows specific computing operations to be performed on the ciphertext while ensuring that the decryption result is consistent with the result of the same calculation on the plaintext.
[0061] Step S206, performing adaptive optimization suitable for homomorphic encryption processing on the multi-layer residual network model to obtain a training model, performing gradient descent model training on the training model based on the encrypted training data, and iteratively updating the initial model parameters based on the number of iterations of the model training to obtain model update parameters, and the number of iterations of the model training is performed based on the local number of iterations.
[0062] Among them, gradient descent is used to minimize the loss function. During the training process, the model parameters are updated according to the gradient of the loss function with respect to the model parameters.
[0063] In some embodiments, in order to enable the multi-layer residual network model to be trained in a homomorphic encryption environment, it needs to be adaptively optimized, including but not limited to: for the convolution layer, it is necessary to use convolution operations compatible with homomorphic encryption, and it may be necessary to use approximate calculation methods for activation functions (such as ReLU). Batch normalization and pooling operations also need to be adjusted accordingly to ensure normal operation on encrypted data.
[0064] In some embodiments, according to the gradient descent algorithm (such as stochastic gradient descent, Adagrad, etc.), the model parameters are updated according to the learning rate and encrypted gradient. This needs to be performed in a homomorphic encryption environment. By repeating the process according to the set number of local iterations, the model parameters are continuously optimized to obtain the model update parameters.
[0065] Step S208, the model update parameters are fed back to the edge server, so that the edge server performs weighted aggregation on the model update parameters received from multiple clients until a model update result is generated and fed back to the central server. The central server performs weighted aggregation on the model update results received from multiple edge servers to obtain the trained global model parameters.
[0066] In some embodiments, the client feeds back the model update parameters obtained through training to the edge server. The edge server receives the model update parameters from multiple clients, and weightedly aggregates these parameters according to a preset weighting scheme. The edge server feeds back the aggregated results to the central server. The central server further weightedly aggregates the aggregated results from multiple edge servers, and finally obtains the trained global model parameters, which integrate the data and calculation results of multiple clients and edge servers, and have a wider range of representativeness and better performance.
[0067] In this embodiment, the initial model parameters are sent to each client and loaded into the multi-layer residual network model. On the client side in the federated learning network, the training data is converted into the integer domain and homomorphic encryption operations are performed. The encrypted training data is used to perform model training on the multi-layer residual network model to achieve PPML (privacy-preserving machine learning). The clients participating in the model training can connect to the nearest network edge server for communication. By performing multiple rounds of weighted aggregation of parameters on the edge server and the central server, the trained global model parameters finally integrate the information of multiple clients and edge servers, thereby effectively reducing communication overhead.
[0068] like Figure 3 As shown, in one embodiment of the present disclosure, the training data is converted into integer domain data, and a homomorphic encryption operation is performed on the integer domain data to obtain encrypted training data, including:
[0069] Step S302: the training data includes training image data, and the training image data is divided into multiple batches of data to be trained.
[0070] In some embodiments, the training image data may be a large-scale dataset.
[0071] Step S304, vectorizing the training data to obtain the training vectors.
[0072] In some embodiments, the purpose of vectorization processing is to convert image data into a vector form suitable for model processing. For image data, the pixel values of the image can be expanded into a one-dimensional vector in a certain order (such as by row or by column).
[0073] Step S306, converting the vector to be trained into integer domain data.
[0074] In some embodiments, the vector to be trained is usually in floating point form. For subsequent homomorphic encryption operations, it is necessary to convert it into integer domain data, such as determining a suitable quantization factor. This quantization factor is used to map the floating point number to an integer. This method can ensure that the data is converted into an integer form suitable for processing by the homomorphic encryption algorithm with little loss of data accuracy.
[0075] Step S308, performing homomorphic encryption operation on the integer domain data to obtain encrypted training data.
[0076] In this embodiment, data partitioning makes the training process more efficient and stable, and can make full use of computing resources. Vectorized processing converts image data into a form that is easy for the model to process. The extracted feature vectors help the model to better learn the characteristics of the image and improve the classification and recognition capabilities of the model. Converting data into integer domain data provides a basis for homomorphic encryption operations, so that the data can remain computable after encryption. Homomorphic encryption operations allow calculations on encrypted data while ensuring data privacy and security. This is very important for training models while protecting data privacy. It can effectively prevent data leakage and meet the needs of data privacy protection without affecting the training effect of the model.
[0077] In one embodiment of the present disclosure, a homomorphic encryption operation is performed on integer domain data to obtain encrypted training data, including:
[0078] Based on the RNS-CKKS encryption method, homomorphic encryption operations are performed on the integer domain data to obtain encrypted training data.
[0079] In this embodiment, homomorphic encryption operations are performed on integer domain data based on the RNS-CKKS (Ring Number Theoretic Transformation-Complex Key-Value Encryption Scheme) encryption method to obtain encrypted training data. The RNS-CKKS encryption scheme, with its unique structure and characteristics, can ensure data confidentiality while allowing specific arithmetic operations on encrypted data. Combined with edge servers and central servers, a new hierarchical federated learning framework that effectively reduces communication overhead is obtained, and PPML (privacy-preserving machine learning) is implemented with the standard deep neural network ResNet-20, thereby effectively protecting the client's data privacy information during data processing.
[0080] like Figure 4 As shown, in one embodiment of the present disclosure, adaptive optimization suitable for homomorphic encryption processing is performed on a multi-layer residual network model to obtain a training model, including:
[0081] Step S402, applying Chebyshev polynomials to approximate the rectified linear unit ReLU function to convert the nonlinear operation of the ReLU function into a polynomial linear operation ReLU, so as to construct a ReLU activation layer in the multi-layer residual network model based on the linear operation ReLU.
[0082] In some embodiments, in a multi-layer residual network model, the original ReLU activation layer is replaced with a linear operation based on Chebyshev polynomial approximation. When the input data passes through this layer, the traditional max(0,x) operation is no longer performed, but the linear combination of Chebyshev polynomials is calculated, thereby converting the nonlinear operation of the ReLU function into a linear operation of the polynomial, completing the construction of the ReLU activation layer.
[0083] Among them, Chebyshev polynomials are a type of orthogonal polynomials, which are often used to approximate functions and solve optimization problems. They are orthogonal in the interval [-1,1] and are widely used tools in numerical analysis. ReLU approximation functions based on Chebyshev polynomials are used to replace the minimax approximation method to achieve higher approximation accuracy and computational efficiency. The form of Chebyshev polynomials is:
[0084] By expanding the input range and optimizing the coefficients, accurate approximation in the global range is achieved. The Chebyshev polynomial is shown in equation (1).
[0085] T n (x)=cos(n·arccos(x)),x∈[-1,1] (1)
[0086] Among them, T n (x) is the nth order Chebyshev polynomial; n is the order of the polynomial, which determines the complexity of the polynomial; x is the independent variable, and its value range is [-1, 1].
[0087] Step S404, constructing a Softmax layer in a multi-layer residual network model based on homomorphic approximation using logarithmic and exponential functions as a fully connected layer to generate an intermediate model including a ReLU activation layer and a fully connected layer.
[0088] Among them, in the homomorphic encryption environment, it is difficult to directly calculate the exponential and logarithmic functions. By adopting efficient homomorphic approximation of logarithmic and exponential functions, such as using Taylor series expansion to approximate exponential and logarithmic functions, efficient calculation under homomorphic encryption is ensured, including: using piecewise linear interpolation to approximate the exponential function exp(x), using the Log-Sum-Exp technique to prevent numerical instability caused by direct calculation of exp(x), and the obtained Softmax function is shown in formula (2):
[0089]
[0090] Among them, the Softmax function is a normalization method in multi-classification problems. It converts the input real number into a probability distribution. The sum of all outputs is 1. Subtracting max(x) is for numerical stability to prevent overflow problems during exponential calculations.
[0091] x i refers to the i-th input value, x j refers to the jth input value, max(x) refers to the maximum value of the input value x, which is used for numerical stability, and exp(x j -max(x) is an exponential function that stretches the input value to positive values.
[0092] Step S406: Perform compression processing based on the dynamic quantization intermediate model to obtain a training model.
[0093] In some embodiments, in order to reduce the amount of homomorphic encryption calculations, dynamic quantization technology is used to compress the ResNet-20 model during training. Dynamic quantization refers to quantization based on the dynamic range of the data during the operation of the model. The quantization process includes but is not limited to dynamic quantization of the weights and activation values in the intermediate training model. After quantization is completed, the model is compressed.
[0094] In this embodiment, the Chebyshev polynomial is applied to approximate the ReLU function, and the nonlinear operation is converted into a linear operation, so that the calculation in the homomorphic encryption environment is more efficient and feasible, and the characteristics of the ReLU function are retained to a certain extent, thereby ensuring the performance of the model. The Softmax layer is constructed based on the homomorphic approximation of the logarithmic and exponential functions, which solves the computational difficulties of the Softmax function in multi-classification tasks in the homomorphic encryption environment and ensures the effective processing of data in an encrypted state. The compression processing of the dynamic quantization intermediate training model significantly reduces the size and computational complexity of the model, improves the operating efficiency of the model, and makes it more suitable for deployment and application in resource-constrained environments, thereby improving the computing power and efficiency of the model in the homomorphic encryption environment, and also reduces the storage and computing costs of the model while ensuring the accuracy of the model, thereby ensuring the reliable execution of privacy-preserving deep learning.
[0095] In one embodiment of the present disclosure, compression processing is performed based on a dynamic quantization intermediate model to obtain a training model, including: compression processing is performed based on a ReLU activation layer and a fully connected layer in the dynamic quantization intermediate model to obtain a training model.
[0096] In some embodiments, during the model inference process, the output of the ReLU activation layer and the weight and output of the fully connected layer are monitored in real time. For the ReLU activation layer, the maximum and minimum values of the output during each inference are recorded. According to the dynamic range of the recorded ReLU activation layer output, the quantization scale and zero point are calculated. A quantization operation is performed on each output value of the ReLU activation layer to convert it into a quantized integer value.
[0097] In some embodiments, for the fully connected layer, the maximum and minimum values of the weight matrix and the maximum and minimum values of the output are recorded respectively to determine the dynamic range, and further according to the accuracy requirements and resource limitations of the model, the appropriate number of quantization bits is selected, and for the weight matrix of the fully connected layer, its quantization scale and zero point are calculated, and each element in the weight matrix is quantized.
[0098] In this embodiment, dynamic quantization is performed according to the actual dynamic range of the data, and the quantization parameters can be adaptively adjusted under different input conditions. By dynamically quantizing and compressing the ReLU activation layer and the fully connected layer in the intermediate model, the storage and computing costs of the model are significantly reduced.
[0099] like Figure 5 As shown, in one embodiment of the present disclosure, gradient descent model training is performed on the training model based on encrypted training data, including:
[0100] Step S502, quantizing the initial model parameters in the training model to obtain quantized model parameters.
[0101] Among them, the number of quantization bits is first determined. For different layers (such as convolutional layers, fully connected layers, etc.), different quantization strategies can be used to convert the representation range of the initial model parameters from floating point numbers to lower precision integer representations.
[0102] Step S504, input the encrypted training data into each layer of the training model in sequence, perform forward propagation model training to output corresponding prediction results, wherein the quantized model parameters are used to provide initial weights for feature extraction operations on the encrypted training data when the encrypted training data is input into the convolutional layer of the training model.
[0103] In some embodiments, the encrypted training data is sequentially input into each layer of the training model. For the convolution layer, the encrypted training data is convolved using the quantized model parameters (quantized weights and biases). Since the data is encrypted, this operation needs to be performed under the framework of homomorphic encryption, and it may be necessary to use a special homomorphic encryption algorithm for convolution operations. After the convolution layer, an activation function is usually applied, such as ReLU or its homomorphic encrypted approximation. Since it is in a homomorphic encryption environment, the calculation of the activation function also requires special processing, and methods such as approximate calculations or polynomial approximation may be used. For the pooling layer, the fully connected layer, etc., according to the structure of the model, the corresponding operations continue to be performed in the encrypted state, and finally the encrypted prediction result is obtained, which represents the model's prediction of the input data in the encrypted state.
[0104] Step S506, calculating the encrypted loss value based on the prediction result and the loss function.
[0105] In some embodiments, according to the task type (such as the cross entropy loss function can be selected for classification tasks, the mean square error loss function can be selected for regression tasks, etc.), the encrypted prediction results and the encrypted true labels are used to calculate the loss function. Since both the data and the prediction results are encrypted, the calculation of the loss function needs to be performed under the framework of homomorphic encryption, and the homomorphic encryption algorithm needs to be used to calculate each part of the loss function.
[0106] Step S508, based on the encrypted loss value, back propagation is performed under the framework of homomorphic encryption to calculate the gradient of the loss function for the parameters in each layer of the training model.
[0107] In some embodiments, under the framework of homomorphic encryption, the chain rule can be used to reversely calculate the gradient starting from the loss function. For example, for the convolution layer, it is necessary to calculate the gradient of the encrypted loss function with respect to the quantized model parameters, which involves the calculation of the convolution kernel gradient under homomorphic encryption. By utilizing the characteristics of homomorphic encryption, the gradient of each parameter in each layer is calculated. For example, the gradient of some complex functions (such as activation functions) is approximated to ensure that the gradient can be correctly calculated in the ciphertext space.
[0108] Step S510, updating the quantization model parameters based on the parameter gradient with gradient descent as the goal, and iterating to obtain the model update parameters.
[0109] In some embodiments, a gradient descent algorithm is used to quantize the updated parameters to keep them within the range of the quantization representation. Steps S504 to S510 are repeated according to a set number of iterations to continuously update the quantization model parameters and obtain the model update parameters.
[0110] In this embodiment, by combining quantization and homomorphic encryption technology, efficient resource utilization and performance improvement of model training are achieved while ensuring data privacy, so that the model can complete training and updating with limited resources while protecting data privacy.
[0111] In one embodiment of the present disclosure, the encrypted training data is sequentially input into each layer of the training model, and further includes: for each layer of the training model, the output encrypted data corresponding to the depth calculation is obtained, and a bootstrap operation is performed on the output encrypted data until the gradient descent model training is completed.
[0112] In this embodiment, by performing a bootstrap operation on the output encrypted data obtained by each layer of depth calculation of the training model, the noise growth of the encrypted data is effectively controlled during the entire gradient descent model training process, and the accuracy of the ciphertext space is maintained.
[0113] In one embodiment of the present disclosure, a bootstrapping operation is performed on output encrypted data, including:
[0114] Encode the output encrypted data into a normalized polynomial form.
[0115] In some embodiments, different homomorphic encryption schemes are based on different mathematical structures, so the homomorphic encryption scheme used is clarified, and the output encrypted data is mapped into the corresponding polynomial ring according to the requirements of the encryption scheme. This may involve representing each element of the data as the coefficients of the polynomial and normalizing the encoded polynomial.
[0116] Based on the block method, the output encrypted data in the form of polynomials is segmented and modulus switching is performed to obtain switched encrypted data, so that the switched encrypted data is input to the next layer accordingly.
[0117] In some embodiments, the output encrypted data in the form of polynomials is divided into blocks according to certain rules, and the modulus switching operation is performed on the polynomial of each block. After the modulus switching of all blocks is completed, the switched encrypted data of these blocks are reintegrated into a complete encrypted data.
[0118] In this embodiment, by encoding the output encrypted data into a standardized polynomial form, a unified and standardized format is provided for calculations in a homomorphic encryption environment, so that encrypted data between different layers can be processed and transmitted in a consistent manner, thereby enhancing the manageability and operability of the data. The modulus switching operation based on the block method effectively optimizes the computing efficiency while ensuring the calculation accuracy of the encrypted data.
[0119] In one embodiment of the present disclosure, the model update parameters are fed back to the edge server so that the edge server performs weighted aggregation on the model update parameters received from multiple clients until a model update result is generated, including:
[0120] The model update parameters are fed back to the edge server so that the edge server performs weighted aggregation on the model update parameters received from multiple clients to generate intermediate update results, and feeds back the intermediate update results to the client as an iterative interaction with the edge server; when the iterative interaction with the edge server reaches a preset number of times, the model training is stopped, wherein the edge server performs weighted aggregation on all intermediate update results obtained after the last iterative interaction to generate a model update result, and feeds it back to the central server, and the central server performs weighted aggregation on the model update results received from multiple edge servers to obtain the trained global model parameters.
[0121] In some embodiments, synchronous stochastic gradient descent is adopted, each client selects a number of sample data with a batch size of A from the local data set for model training and then calculates the average gradient. After receiving the model parameter ω from the edge server, the client k updates it according to its local data, including:
[0122] (1) The local dataset p k Divide into small batches of size B.
[0123] (2) According to the local iteration number c_epoch, perform gradient descent on each batch b* and update the model parameter ω, as shown in formula (3):
[0124] χ t+1 = x t -η t ω (3)
[0125] Among them, x t Represents the current local model parameters of the client, with a learning rate η t Multiply by the global gradient ω as the update step size, the updated model parameter is x t+1 , η t is the learning rate during the tth round of training, x t is the local model parameter of the client during the tth round of training, x t+1 It is the local model parameter of the client during the t+1th round of training.
[0126] (3) The updated model parameters ω are returned to the edge server, as shown in formula (4).
[0127]
[0128] Where k is the client number, ω is the model parameter received by the client from the edge server, and p k is the local data set of client k, b* is the data set from data p k The divided batch data, B is the batch size (Batch Size), c_epoch is the number of iterations of the client, η is the learning rate, l(ω,b*) is the gradient of the loss function, which represents the loss of the current model parameter ω on the batch b*.
[0129] In some embodiments, the client gradient update process can also be expressed as:
[0130] ClientUpdate(k,w):
[0131] b←(split pj into batches of size B)
[0132] for each local j from 1to c_epoch do
[0133] for batch b * ∈b do.
[0134] In one embodiment of the present disclosure, it also includes: receiving the target model parameters sent by the central server via the edge server to update the training model based on the target model parameters, and the target model parameters are obtained by the central server performing weighted aggregation on multiple global model parameters.
[0135] In addition, those skilled in the art will understand that the above Figures 2 to 5 The machine learning method described in performing model training can also be executed on the edge server.
[0136] like Figure 6 As shown, according to another embodiment of the present disclosure, a machine learning method includes:
[0137] Step S602: receiving initial model parameters generated by the central server, and sending the initial model parameters to multiple clients.
[0138] Step S604, receiving model update parameters generated by multiple clients based on homomorphic encryption model training.
[0139] Step S606: weighted aggregation is performed on the model update parameters until a model update result is generated.
[0140] Step S608: Feedback the model update result to the central server. The central server performs weighted aggregation on the model update results fed back by multiple edge servers to obtain trained global model parameters.
[0141] In some embodiments, the aggregation process of the edge server can be expressed as:
[0142] EdgeUpadte(Ei,w):
[0143] for each local epoch i from 1to e_epoch do
[0144] for each client k∈K in parallel do.
[0145]
[0146] return w to cloud server.
[0147] In this embodiment, the edge server E i Receive the model parameters ω from the cloud center server and communicate with its local client K.
[0148] The edge server performs weighted aggregation on the feedback model update parameters of the local client, generates the model update result ω of the edge server, and returns it to the cloud center server.
[0149] Among them, E i refers to the i-th edge server, and K refers to the edge server E i The client set on ω i Refers to the edge server E i Current local model parameters, ω kit+1 refers to the updated model parameters after client k updates, n k refers to the number of training data samples of client k, and n refers to the edge server E i The total number of samples of all clients, e_epoch refers to the number of local iterations of the edge server, that is, the number of iterative interactions with the client.
[0150] In some embodiments, the edge server aggregates the local gradients uploaded by all clients and calculates the global average gradient, including:
[0151] N clients upload their local gradients separately The edge server takes the average value ω of these gradients as the global gradient, as shown in Equation (6).
[0152]
[0153] Among them, ω is the model update result, that is, the result of edge server aggregation, N is the number of clients participating in the training, It is the local gradient uploaded by the i-th client during the t-th round of training, that is, the model update parameters.
[0154] In one embodiment of the present disclosure, model update parameters are weightedly aggregated until a model update result is generated, including: weighted aggregation of the model update parameters to generate an intermediate update result, and feeding back the intermediate update result to the client as an iterative interaction with the edge server; when the iterative interaction with the client reaches a preset number of times, weighted aggregation of all corresponding intermediate update results is performed to generate a model update result, and the model update result is fed back to the central server, and the central server weighted aggregates the model update results received from multiple edge servers to obtain trained global model parameters.
[0155] In one embodiment of the present disclosure, the initial model parameters are sent to multiple clients, including: in each round of iterative interaction, the initial model parameters are sent to some clients based on a preset ratio for model training.
[0156] In one embodiment of the present disclosure, it also includes: receiving a target model parameter sent by the central server, wherein the target model parameter is obtained by weighted aggregation of multiple global model parameters obtained by the central server; and sending the target model parameter to the client.
[0157] In some embodiments, when the number of connected clients is large, the edge server selects a certain number of clients to participate in training at a certain ratio C1 each time, and sets a threshold C2 for the ratio of the number of clients receiving parameters. The participating client uses local data for training, encrypts it after iteration E1 times, and uploads the encrypted training model parameters to the edge server to which it is connected. The edge server waits to receive the gradient parameters uploaded by the client participating in the training until the number of clients uploading parameters reaches the threshold, and then directly aggregates the encrypted parameters and transmits the aggregated results back to the client. Iterate the above process E2 times.
[0158] After the edge server iterates E2 times, it uploads the result to the cloud center server. After receiving the result uploaded by an edge server, the cloud center server performs a certain compensation according to the delay of its gradient, and then performs an aggregation operation and transmits the result back to the edge server.
[0159] Finally, the edge server sends the results to the client to complete the training.
[0160] like Figure 7 As shown, a machine learning method according to another embodiment of the present disclosure includes:
[0161] Step S702: generating initial model parameters and sending the initial model parameters to multiple edge servers.
[0162] Step S704, receiving model update results generated by multiple edge servers, where the model update results are generated by the edge servers performing weighted aggregation on the model update parameters sent by the client, and the model update parameters are generated by the client based on homomorphic encryption model training.
[0163] Step S706, weighted aggregation is performed on the model update results to obtain trained global model parameters.
[0164] In one embodiment of the present disclosure, it also includes: performing multiple rounds of communication interactions with the edge server; performing weighted aggregation on multiple global model parameters obtained based on the multiple rounds of communication interactions to obtain target model parameters.
[0165] In some embodiments, the central server performs a process including:
[0166] Init(ω0);
[0167] for each round t=1,2,…do;
[0168] for each round Ei∈EN in parallel do.
[0169]
[0170] In this embodiment, the cloud center server initializes the global model parameters to obtain the initial model parameters ω 0 , and then through multiple communication rounds round t, receive and aggregate the update results of the edge servers.
[0171] In each round t, the cloud center server calls EdgeUpdate to update each edge server E i The model parameters are based on the amount of training data n of the edge server. i , weighted aggregation of model updates from all edge servers to generate global model parameters ω t+1 .
[0172] Among them, ω 0 refers to the initial model parameters, E i Refers to the i-th edge server. ω t is the global model parameter of the tth round, ω it+1 Refers to the edge server E i The model parameters after the update in round t+1, n i Refers to the edge server E iThe number of training data samples on the edge servers, n refers to the total number of samples of all global training data (the sum of the data of all edge servers), E N The collection of all edge servers.
[0173] In this embodiment, by providing a federated learning idea with good low overhead and high privacy protection, it is an indispensable part of breaking the data island process. Further combined with the edge computing idea, a new hierarchical federated learning method is proposed, which can solve the problem of a large number of data source clients and is suitable for situations with large computational workloads. At the same time, it supports high-precision classification tasks of deep neural networks (such as ResNet-20) on standard data sets (such as CIFAR-10) in a homomorphic encryption environment. This solution gives full play to the advantages of hierarchical federated learning and homomorphic encryption technology with bootstrapping, and provides a new idea for privacy-preserving machine learning.
[0174] In addition, with the development of big data and privacy data edge computing services and the popularization of data security, fully homomorphic encryption algorithms and various types of federated learning algorithms have very broad development space and application scenarios.
[0175] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0176] Refer to the following Figure 8 To describe the machine learning device 800 according to an embodiment of the present disclosure. Figure 8 The machine learning device 800 shown is merely an example and should not bring any limitation to the functionality and scope of use of the embodiments of the present disclosure.
[0177] The machine learning device 800 is presented in the form of a hardware module or a software module. The components of the machine learning device 800 may include but are not limited to: a loading module 802, which is used to load the initial model parameters into the multi-layer residual network model in response to the initial model parameters sent by the central server via the edge server; an encryption module 804, which is used to convert the training data into integer domain data, and perform homomorphic encryption operations on the integer domain data to obtain encrypted training data; a training module 806, which is used to perform adaptive optimization suitable for homomorphic encryption processing on the multi-layer residual network model to obtain a training model, to perform gradient descent model training on the training model based on the encrypted training data, and to iteratively update the initial model parameters based on the number of iterations of the model training to obtain model update parameters, and the number of iterations of the model training is based on the number of local iterations; a first feedback module 808, which is used to feed back the model update parameters to the edge server, so that the edge server performs weighted aggregation on the model update parameters sent by multiple clients until a model update result is generated, and feeds back to the central server, and the central server performs weighted aggregation on the model update results fed back by multiple edge servers to obtain the trained global model parameters.
[0178] Refer to the following Fig. 9 To describe the machine learning device 900 according to an embodiment of the present disclosure. Fig. 9 The machine learning device 900 shown is merely an example and should not bring any limitation to the functionality and scope of use of the embodiments of the present disclosure.
[0179] The machine learning device 900 is implemented in the form of a hardware module or a software module. The components of the machine learning device 900 may include but are not limited to: a first receiving module 902 for receiving the initial model parameters generated by the central server and sending the initial model parameters to multiple clients; a second receiving module 904 for receiving the model update parameters generated by the model training based on homomorphic encryption by multiple clients; a first weighting module 906 for weighted aggregation of the model update parameters until the model update result is generated; a second feedback module 908 for feeding back the model update result to the central server, and the central server weighted aggregation of the model update results fed back by the multiple edge servers to obtain the trained global model parameters.
[0180] Refer to the following Fig.10 To describe the machine learning device 1000 according to an embodiment of the present disclosure. Fig.10 The machine learning device 1000 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0181] The machine learning device 1000 is in the form of a hardware module or a software module. The components of the machine learning device 1000 may include but are not limited to: a generation module 1002, which is used to generate initial model parameters and send the initial model parameters to multiple edge servers; a third receiving module 1004, which is used to receive model update results generated by multiple edge servers, and the model update results are generated by the edge server by weighted aggregation of the model update parameters sent by the client, and the model update parameters are generated by the client based on homomorphic encryption model training; a second weighting module 1006, which is used to weighted aggregate the model update results to obtain the trained global model parameters.
[0182] like Fig.11 As shown, the electronic device 1100 is in the form of a general computing device. It can be the above-mentioned client, edge server and central server. The components of the electronic device 1100 may include but are not limited to: the above-mentioned at least one processing unit 1110, the above-mentioned at least one storage unit 1120, and a bus 1130 connecting different system components (including the storage unit 1120 and the processing unit 1110).
[0183] The storage unit stores a program code, which can be executed by the processing unit 1110, so that the processing unit 1110 performs the steps described in the "Exemplary Method" section of the present specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 1110 can perform the following steps: Figure 2 The scheme described in .
[0184] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 11201 and / or a cache storage unit 11202 , and may further include a read-only storage unit (ROM) 11203 .
[0185] The storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0186] Bus 1130 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0187] The electronic device 1100 may also communicate with one or more external devices 1170 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1100, and / or communicate with any device that enables the electronic device 1100 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1150. Furthermore, the electronic device 1100 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0188] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or an electronic device, etc.) to execute the method according to the implementation of the present disclosure.
[0189] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on an electronic device, the program code is used to enable the electronic device to perform the steps according to various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of the present specification.
[0190] According to the program product for implementing the above method according to the embodiment of the present disclosure, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0191] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0192] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0193] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0194] The program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the IoT terminal, as an independent software package, partially on the user computing device and partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0195] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0196] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0197] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or an electronic device, etc.) to execute the method according to the implementation of the present disclosure.
[0198] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A machine learning method, characterized in that: Applicable to clients of federated learning networks, including: In response to the initial model parameters sent by the central server via the edge server, the initial model parameters are loaded into the multi-layer residual network model; Converting the training data into integer domain data, and performing a homomorphic encryption operation on the integer domain data to obtain encrypted training data; Performing adaptive optimization suitable for homomorphic encryption processing on the multi-layer residual network model to obtain a training model, performing gradient descent model training on the training model based on the encrypted training data, and iteratively updating the initial model parameters based on the number of iterations of the model training to obtain model update parameters, wherein the number of iterations of the model training is performed based on the number of local iterations; The model update parameters are fed back to the edge server so that the edge server performs weighted aggregation on the model update parameters received from multiple clients until a model update result is generated and fed back to the central server. The central server performs weighted aggregation on the model update results received from multiple edge servers to obtain the trained global model parameters.
2. The machine learning method according to claim 1, characterized in that The training data is converted into integer domain data, and a homomorphic encryption operation is performed on the integer domain data to obtain encrypted training data, including: The training data includes training image data, and the training image data is divided into multiple batches of data to be trained; Performing vectorization processing on the data to be trained to obtain vectors to be trained; Converting the vector to be trained into integer domain data; Perform a homomorphic encryption operation on the integer domain data to obtain the encrypted training data.
3. The machine learning method according to claim 2, characterized in that Performing a homomorphic encryption operation on the integer domain data to obtain the encrypted training data includes: Based on the RNS-CKKS encryption method, a homomorphic encryption operation is performed on the integer domain data to obtain the encrypted training data.
4. The machine learning method according to claim 1, characterized in that Performing adaptive optimization suitable for homomorphic encryption processing on the multi-layer residual network model to obtain a training model, including: Apply Chebyshev polynomials to approximate the corrected linear unit (ReLU) function to convert the nonlinear operation of the ReLU function into a polynomial linear operation (ReLU), and construct a ReLU activation layer in the multi-layer residual network model based on the linear operation (ReLU); Constructing a Softmax layer in the multi-layer residual network model based on homomorphic approximation using logarithmic and exponential functions as a fully connected layer to generate an intermediate model including the ReLU activation layer and the fully connected layer; The intermediate model is compressed based on dynamic quantization to obtain the training model.
5. The machine learning method according to claim 4, characterized in that The intermediate model is compressed based on dynamic quantization to obtain the training model, including: The ReLU activation layer and the fully connected layer in the intermediate model are compressed based on dynamic quantization to obtain the training model.
6. The machine learning method according to claim 1, characterized in that: Performing gradient descent model training on the training model based on the encrypted training data includes: Quantizing the initial model parameters in the training model to obtain quantized model parameters; Input the encrypted training data into each layer of the training model in sequence, perform forward propagation model training, and output corresponding prediction results, wherein the quantized model parameters are used to provide initial weights for feature extraction operations on the encrypted training data when the encrypted training data is input into the convolution layer of the training model; Calculating an encrypted loss value based on the prediction result and the loss function; Based on the encrypted loss value, back propagation is performed under the framework of homomorphic encryption to calculate the gradient of the loss function with respect to the parameters in each layer of the training model; The quantization model parameters are updated based on the parameter gradient with the gradient descent as the goal, and the model update parameters are obtained by iteration.
7. The machine learning method according to claim 6, characterized in that Inputting the encrypted training data into each layer of the training model in sequence, further comprising: For the output encrypted data corresponding to each layer of depth calculation of the training model, a bootstrap operation is performed on the output encrypted data until the gradient descent model training is completed.
8. The machine learning method according to claim 7, characterized in that Performing a bootstrap operation on the output encrypted data, comprising: Encoding the output encrypted data into a normalized polynomial form; Based on the block method, the output encrypted data in the form of polynomial is segmented and modular switching is performed to obtain switched encrypted data, so that the switched encrypted data is input to the next layer accordingly.
9. The machine learning method according to claim 1, characterized in that: Feeding back the model update parameters to the edge server so that the edge server performs weighted aggregation on the model update parameters received from the multiple clients until a model update result is generated, including: Feeding back the model update parameters to the edge server, so that the edge server performs weighted aggregation on the model update parameters sent by the multiple clients to generate an intermediate update result, and feeding back the intermediate update result to the client as an iterative interaction with the edge server; When the iterative interaction with the edge server reaches a preset number of times, the model training is stopped, wherein the edge server performs weighted aggregation on all the intermediate update results obtained after the last iterative interaction to generate the model update result, and feeds it back to the central server, and the central server performs weighted aggregation on the model update results fed back by the multiple edge servers to obtain the trained global model parameters.
10. The machine learning method according to claim 1, characterized in that: Also includes: Receive the target model parameters sent by the central server via the edge server to update the training model based on the target model parameters, where the target model parameters are obtained by weighted aggregation of the multiple global model parameters obtained by the central server.
11. A machine learning method, characterized in that: Edge servers used in federated learning networks include: Receiving initial model parameters generated by a central server, and sending the initial model parameters to multiple clients; Receiving model update parameters generated by the plurality of clients based on homomorphic encryption model training; Performing weighted aggregation on the model update parameters until a model update result is generated; The model update result is fed back to the central server, and the central server performs weighted aggregation on the model update results fed back by the multiple edge servers to obtain the trained global model parameters.
12. The machine learning method according to claim 11, characterized in that: The model update parameters are weighted and aggregated until a model update result is generated, including: Performing weighted aggregation on the model update parameters to generate an intermediate update result, and feeding the intermediate update result back to the client as an iterative interaction with the edge server; When the iterative interaction with the client reaches a preset number of times, all the corresponding intermediate update results are weighted aggregated to generate a model update result, and the result is fed back to the central server. The central server weighted aggregates the model update results received from multiple edge servers to obtain the trained global model parameters.
13. The machine learning method according to claim 12, characterized in that: Sending the initial model parameters to multiple clients includes: In each round of iterative interaction, the initial model parameters are sent to some of the clients based on a preset ratio for model training.
14. The machine learning method according to claim 11, characterized in that: Also includes: Receiving a target model parameter sent by the central server, wherein the target model parameter is obtained by weighted aggregation of a plurality of global model parameters obtained by the central server; The target model parameters are sent to the client.
15. A machine learning method, characterized in that: Applied to the central server of the federated learning network, including: Generating initial model parameters, and sending the initial model parameters to multiple edge servers; Receiving model update results generated by the multiple edge servers, where the model update results are generated by the edge servers performing weighted aggregation on model update parameters sent by the client, where the model update parameters are generated by the client based on homomorphic encryption model training; The model update results are weighted and aggregated to obtain trained global model parameters.
16. The machine learning method according to claim 15, characterized in that: Also includes: Perform multiple rounds of communication interactions with the edge server; Perform weighted aggregation on the multiple global model parameters obtained based on multiple rounds of communication interactions to obtain target model parameters; The target model parameters are sent to the edge server, and the edge server sends the target model parameters to the client.
17. A machine learning device, characterized in that Applicable to clients of federated learning networks, including: A loading module, configured to load the initial model parameters into the multi-layer residual network model in response to the initial model parameters sent by the central server via the edge server; An encryption module, used to convert the training data into integer domain data, and perform a homomorphic encryption operation on the integer domain data to obtain encrypted training data; A training module, used to perform adaptive optimization suitable for homomorphic encryption processing on the multi-layer residual network model to obtain a training model, to perform gradient descent model training on the training model based on the encrypted training data, and to iteratively update the initial model parameters based on the number of iterations of the model training to obtain model update parameters, wherein the number of iterations of the model training is performed based on the local number of iterations; The first feedback module is used to feed back the model update parameters to the edge server, so that the edge server performs weighted aggregation on the model update parameters received from multiple clients until a model update result is generated and fed back to the central server. The central server performs weighted aggregation on the model update results received from multiple edge servers to obtain the trained global model parameters.
18. A machine learning device, characterized in that Edge servers used in federated learning networks include: A first receiving module is used to receive initial model parameters generated by the central server and send the initial model parameters to multiple clients; A second receiving module is used to receive model update parameters generated by the multiple clients based on homomorphic encryption model training; A first weighting module, used for weighted aggregation of the model update parameters until a model update result is generated; The second feedback module is used to feed back the model update result to the central server, and the central server performs weighted aggregation on the model update results fed back by the multiple edge servers to obtain the trained global model parameters.
19. A machine learning device, characterized in that Applicable to clients of federated learning networks, including: A generation module, used for generating initial model parameters, and sending the initial model parameters to multiple edge servers; A third receiving module is used to receive the model update results generated by the multiple edge servers, where the model update results are generated by the edge servers performing weighted aggregation on the model update parameters sent by the client, and the model update parameters are generated by the client based on homomorphic encryption model training; The second weighting module is used to perform weighted aggregation on the model update results to obtain trained global model parameters.
20. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the machine learning method described in any one of claims 1 to 10, or the machine learning method described in any one of claims 11 to 14, or the machine learning method described in claim 15 or 16 by executing the executable instructions.
21. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the machine learning method according to any one of claims 1 to 16 is implemented.
22. A computer program product having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the machine learning method according to any one of claims 1 to 16 is implemented.