Data processing method, device, equipment and readable storage medium
By generating and adjusting perturbation gradient values and encoding vectors in federated learning, the problem of insufficient computing power of terminal devices and model security is solved, and resource saving and privacy protection are achieved.
Patent Information
- Application Number
- CN202410769185.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-14
AI Technical Summary
Insufficient computing power of terminal devices in federated learning leads to model collapse, gradient explosion or gradient disappearance, and intermediate features are easily intercepted by attackers during transmission, resulting in privacy leaks and reduced model security.
By generating perturbation gradient values on the business server side, adjusting coding network parameters, generating perturbation coding vectors, and adjusting model parameters on the terminal device, training and federated aggregation of the perturbation coding network are achieved, reducing resource consumption and improving model security.
It effectively reduces the computing overhead of the terminal device, protects the gradient information, improves the security and performance of the model, and prevents privacy leaks.
Smart Images

Figure CN118333105B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, equipment and readable storage medium. Background Art
[0002] Federated learning is a distributed machine learning method that allows multiple terminal devices to jointly train a shared machine learning model with a server. Since each device's local model needs to be trained from scratch, the server and multiple devices need to frequently exchange model parameters in multiple training rounds and cycles, which brings huge resource overhead and communication costs. In the case of limited computing power resources of some terminal devices, such as edge devices such as mobile phones under the Internet of Things, the terminal devices have insufficient computing power and cannot support frequent and large-scale parameter adjustments, which can easily cause model crashes and gradient explosion or gradient vanishing problems, resulting in divergent model weights and poor model performance.
[0003] In federated learning, each terminal device or server can embed or encode the terminal business data it holds through a local model to obtain intermediate features. Other terminal devices or servers can obtain the intermediate features for federated learning. Since the intermediate features need to be transmitted between the client and the server for model updates, if the intermediate features are intercepted during the transmission process, the attacker can analyze the intermediate features to calculate the gradient information of the local model deployed on the terminal device or server, thereby recovering the model parameters, causing privacy leakage and reducing the security of the model. Summary of the invention
[0004] The embodiments of the present application provide a data processing method, apparatus, device and readable storage medium, which can reduce the resource consumption of federated learning, protect the gradient information of the perturbation coding network, and improve the security of the model.
[0005] On the one hand, an embodiment of the present application provides a data processing method, including:
[0006] The service server obtains the terminal loss values respectively sent by the M terminal devices, generates a disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network through the disturbance gradient value to obtain the disturbance coding network; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal business data and the sample label corresponding to the terminal business data, and the target terminal device is any one of the M terminal devices; the prediction result is generated by the initial classification network configured on the target terminal device; M is a positive integer;
[0007] Obtaining first feature vectors respectively sent by M terminal devices, performing feature extraction on the M first feature vectors through a perturbation coding network, and obtaining perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are respectively extracted by the M terminal devices from the terminal service data held by them through the configured initial embedding network;
[0008] Sending one perturbation code vector from the M perturbation code vectors to each of the M terminal devices, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label, to obtain a terminal embedding network and a terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device;
[0009] When the perturbation coding network meets the training convergence conditions, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain the federated embedding network and the federated classification network corresponding to each terminal device; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0010] The disturbance gradient value is generated based on the disturbance value, the model parameters of the initial coding network configured by the service server, and the M terminal loss values, including:
[0011] Random sampling is performed in a real number space having the same dimension as the model parameters of the initial encoding network to obtain a random sampling vector; the random sampling vector obeys a normal distribution;
[0012] A perturbation sampling vector is obtained by performing a dot multiplication operation on the perturbation value and the random sampling vector, a first perturbation parameter and a second perturbation parameter are generated based on the perturbation sampling vector and the model parameters of the initial encoding network, and a perturbation gradient value is generated based on the M terminal loss values, the first perturbation parameter and the second perturbation parameter; the perturbation sampling vector is a vector having the same dimension as the model parameters of the initial encoding network.
[0013] The M terminal loss values include a target terminal loss value, and a disturbance gradient value is generated based on the M terminal loss values, the first disturbance parameter, and the second disturbance parameter, including:
[0014] Performing a point multiplication operation on the target terminal loss value and the first disturbance parameter to obtain a first gradient parameter, performing a point multiplication operation on the target terminal loss value and the second disturbance parameter to obtain a second gradient parameter, and determining the difference between the first gradient parameter and the second gradient parameter as the target gradient parameter;
[0015] Generate a unit loss value corresponding to the target terminal loss value based on the target gradient parameter, the random sampling vector and the perturbation value;
[0016] When the unit loss values corresponding to the M terminal loss values are obtained, the average value of the M unit loss values is multiplied by the training learning rate to obtain the perturbation gradient value.
[0017] Among them, the M terminal loss values are generated by the M terminal devices in the Tth communication round, and T is a positive integer; the model parameters of the initial coding network are adjusted by the perturbation gradient value to obtain the perturbation coding network, including:
[0018] Generate a first-order moment estimate and a second-order moment estimate of the perturbation gradient value based on the perturbation gradient value; the first-order moment estimate is used to indicate a weighted mean of the perturbation gradient value in T communication rounds, and the second-order moment estimate is used to indicate a weighted variance of the perturbation gradient value in T communication rounds;
[0019] A first update parameter is obtained by performing a point multiplication operation on the training learning rate and the first-order moment estimate, a second update parameter is obtained by performing a point multiplication operation on the arithmetic square root of the second-order moment estimate and the disturbance value, and a parameter update value is generated based on the first update parameter and the second update parameter. The model parameters of the initial coding network are adjusted by the parameter update value to obtain a perturbation coding network.
[0020] Wherein, generating a first-order moment estimation value and a second-order moment estimation value of the disturbance gradient value based on the disturbance gradient value includes:
[0021] Obtain a first communication weight and a second communication weight; the first communication weight is used to represent the weight of the disturbance gradient value of T communication rounds, and the second communication weight is used to represent the weight of the disturbance gradient value of T communication rounds;
[0022] Generate a first-order moment estimation value in the T-th communication round based on the disturbance gradient value in the T-th communication round, the first communication weight, and the first-order moment estimation value generated in the T-1-th communication round;
[0023] A second moment estimation value in the T th communication round is generated based on the disturbance gradient value in the T th communication round, the second communication weight, and the second-order moment estimation value generated in the T-1 th communication round.
[0024] The terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain the federated embedding network and the federated classification network corresponding to each terminal device, including:
[0025] Obtain model parameters of the terminal embedded network in the M terminal devices, perform federation aggregation processing on the model parameters of the M terminal embedded networks, and obtain embedding update parameters corresponding to the M terminal devices respectively; the embedding update parameters are used to send to the corresponding terminal devices, and are used to adjust parameters of the terminal embedded network configured by the corresponding terminal devices, so as to obtain a federated embedded network;
[0026] The model parameters of the terminal classification network in the M terminal devices are obtained, and the model parameters of the M terminal classification networks are federally aggregated to obtain the classification update parameters corresponding to the M terminal devices respectively; the classification update parameters are used to be sent to the corresponding terminal devices, and are used to adjust the parameters of the terminal classification network configured for the corresponding terminal devices to obtain a federal classification network.
[0027] On the one hand, an embodiment of the present application provides another data processing method, including:
[0028] The target terminal device extracts features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and sends the first feature vector to the service server, so that the service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the perturbation coding network is obtained by the service server adjusting the model parameters of the configured initial coding network based on the perturbation gradient value, and the perturbation gradient value is generated after M terminal devices respectively send terminal loss values and perturbation values, and the M terminal devices include the target terminal device; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data; the prediction result is generated by the initial classification network configured on the target terminal device;
[0029] Receive the perturbation coding vector sent by the business server, and adjust the model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network;
[0030] When both the terminal embedding network and the terminal classification network meet the terminal training convergence conditions, the weight update parameters sent by the service server are obtained, and the model parameters of the terminal embedding network and the terminal classification network are adjusted based on the weight update parameters to obtain the federated embedding network and the federated classification network; the weight update parameters are obtained by the service server through federal aggregation processing of the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by the M terminal devices; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0031] Among them, it also includes:
[0032] Sending the model parameters of the terminal embedded network to the service server, sending the model parameters of the terminal classification network to the service server, so that the service server performs federal aggregation processing on the model parameters of the terminal embedded network sent by M terminal devices respectively to obtain embedded update parameters, and performs federal aggregation processing on the model parameters of the terminal classification network sent by M terminal devices respectively to obtain classification update parameters; the embedded update parameters and the classification update parameters are used to send to the M terminal devices;
[0033] The weight update parameters include embedding update parameters and classification update parameters. Model parameter adjustment is performed on the terminal embedding network and the terminal classification network based on the weight update parameters, including:
[0034] Performing a dot multiplication operation on the embedding update parameter and the first federated learning update weight to obtain a federated embedding gradient, and adjusting parameters of the terminal embedding network configured for the target terminal device based on the federated embedding gradient to obtain a federated embedding network corresponding to the target terminal device;
[0035] The embedding update parameter is point-multiplied with the second federated learning update weight to obtain the federated classification gradient. Based on the federated embedding gradient, the terminal classification network configured for the target terminal device is parameter-adjusted to obtain the federated classification network corresponding to the target terminal device.
[0036] Wherein, based on the received perturbation coding vector and the sample label, the model parameters of the respectively configured initial embedding network and the initial classification network are adjusted to obtain the terminal embedding network and the terminal classification network, including:
[0037] The perturbation coding vector is classified and identified through the initial classification network to obtain a prediction result, and an iterative loss value is generated based on the sample label of the terminal service data and the prediction result. An iterative gradient value is generated based on the iterative loss value, the model parameters of the initial classification network, and the training learning rate, until K iterative gradient values corresponding to the initial embedding network and the initial classification network in K iteration rounds are obtained, and the average value of the K iterative gradient values is determined as the approximate gradient value; K is a positive integer;
[0038] The model parameters of the initial embedding network and the initial classification network are adjusted through the approximate gradient value to obtain the terminal embedding network and the terminal classification network.
[0039] The model parameters of the initial embedded network are sent to the business server, including:
[0040] Secretly slicing the model parameters of the initial embedded network to obtain a first secret slice and a second secret slice, and sending the first secret slice to the service server, so that when the service server obtains the first secret slices respectively sent by the M terminal devices, it generates a first embedded slice based on the M first secret slices;
[0041] The method also includes:
[0042] Obtaining the first embedded fragment sent by the service server, and generating a second embedded fragment based on the obtained M-1 second secret fragments for other terminal devices and the second secret fragment for the target terminal device; the other terminal device is a terminal device other than the target terminal device among the M terminal devices;
[0043] Perform a slice addition operation on the first embedded slice and the second embedded slice to obtain an embedding update parameter.
[0044] The model parameters of the initial embedded network are secretly sliced to obtain a first secret slice and a second secret slice, including:
[0045] A stretching factor is determined based on the bit width length of the model parameters of the initial embedded network, and the model parameters of the initial embedded network are encoded by floating point numbers using the stretching factor to obtain a stretched coded value, and the stretched coded value is subjected to arithmetic slicing processing to obtain a first secret slicing and a second secret slicing; the stretched coded value is an element in an integer ring, and the result of a slice addition operation of the first secret slicing and the second secret slicing is the stretched coded value; the second secret slicing is used to provide to other terminal devices.
[0046] An embodiment of the present application provides a data processing device, including:
[0047] The loss acquisition module is used to obtain the terminal loss values sent by the M terminal devices respectively, generate the disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjust the model parameters of the initial coding network through the disturbance gradient value to obtain the disturbance coding network; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data, and the target terminal device is any one of the M terminal devices; the prediction result is generated by the initial classification network configured on the target terminal device;
[0048] A perturbation coding module is used to obtain first feature vectors respectively sent by M terminal devices, perform feature extraction on the M first feature vectors through a perturbation coding network, and obtain perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are obtained by extracting the terminal service data held by the M terminal devices respectively through the configured initial embedding network;
[0049] A vector sending module is used to send one perturbation code vector among the M perturbation code vectors to M terminal devices respectively, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label to obtain a terminal embedding network and a terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device;
[0050] The federation processing module is used to perform federation aggregation processing on the terminal embedding network and the terminal classification network in the M terminal devices when the perturbation coding network meets the training convergence condition, so as to obtain the federation embedding network and the federation classification network corresponding to each terminal device respectively; the perturbation coding network deployed on the service server and the federation embedding network and the federation classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0051] In a possible implementation, when the loss acquisition module is used to generate a disturbance gradient value based on the disturbance value, the model parameters of the initial encoding network configured by the service server, and the M terminal loss values, it is specifically used to perform the following operations:
[0052] Random sampling is performed in a real number space having the same dimension as the model parameters of the initial encoding network to obtain a random sampling vector; the random sampling vector obeys a normal distribution;
[0053] A perturbation sampling vector is obtained by performing a dot multiplication operation on the perturbation value and the random sampling vector, a first perturbation parameter and a second perturbation parameter are generated based on the perturbation sampling vector and the model parameters of the initial encoding network, and a perturbation gradient value is generated based on the M terminal loss values, the first perturbation parameter and the second perturbation parameter; the perturbation sampling vector is a vector having the same dimension as the model parameters of the initial encoding network.
[0054] In a possible implementation, the M terminal loss values include a target terminal loss value, and the loss acquisition module is used to generate a disturbance gradient value based on the M terminal loss values, the first disturbance parameter, and the second disturbance parameter, and is specifically used to perform the following operations:
[0055] Performing a point multiplication operation on the target terminal loss value and the first disturbance parameter to obtain a first gradient parameter, performing a point multiplication operation on the target terminal loss value and the second disturbance parameter to obtain a second gradient parameter, and determining the difference between the first gradient parameter and the second gradient parameter as the target gradient parameter;
[0056] Generate a unit loss value corresponding to the target terminal loss value based on the target gradient parameter, the random sampling vector and the perturbation value;
[0057] When the unit loss values corresponding to the M terminal loss values are obtained, the average value of the M unit loss values is multiplied by the training learning rate to obtain the perturbation gradient value.
[0058] In a possible implementation, the M terminal loss values are generated by the M terminal devices in the Tth communication round, where T is a positive integer; the loss acquisition module is used to adjust the model parameters of the initial coding network by the perturbation gradient value, and when the perturbation coding network is obtained, it is specifically used to perform the following operations:
[0059] Generate a first-order moment estimate and a second-order moment estimate of the perturbation gradient value based on the perturbation gradient value; the first-order moment estimate is used to indicate a weighted mean of the perturbation gradient value in T communication rounds, and the second-order moment estimate is used to indicate a weighted variance of the perturbation gradient value in T communication rounds;
[0060] A first update parameter is obtained by performing a point multiplication operation on the training learning rate and the first-order moment estimate, a second update parameter is obtained by performing a point multiplication operation on the arithmetic square root of the second-order moment estimate and the disturbance value, and a parameter update value is generated based on the first update parameter and the second update parameter. The model parameters of the initial coding network are adjusted by the parameter update value to obtain a perturbation coding network.
[0061] In a possible implementation, when the loss acquisition module is used to generate a first-order moment estimation value and a second-order moment estimation value of a disturbance gradient value based on the disturbance gradient value, it is specifically used to perform the following operations:
[0062] Obtain a first communication weight and a second communication weight; the first communication weight is used to represent the weight of the disturbance gradient value of T communication rounds, and the second communication weight is used to represent the weight of the disturbance gradient value of T communication rounds;
[0063] Generate a first-order moment estimation value in the T-th communication round based on the disturbance gradient value in the T-th communication round, the first communication weight, and the first-order moment estimation value generated in the T-1-th communication round;
[0064] A second moment estimation value in the T th communication round is generated based on the disturbance gradient value in the T th communication round, the second communication weight, and the second-order moment estimation value generated in the T-1 th communication round.
[0065] In a possible implementation, the federation processing module is used to perform federation aggregation processing on the terminal embedded networks and the terminal classification networks in the M terminal devices, and when obtaining the federation embedded network and the federation classification network corresponding to each terminal device, the federation processing module is used to perform the following operations:
[0066] Obtain model parameters of the terminal embedded network in the M terminal devices, perform federation aggregation processing on the model parameters of the M terminal embedded networks, and obtain embedding update parameters corresponding to the M terminal devices respectively; the embedding update parameters are used to send to the corresponding terminal devices, and are used to adjust parameters of the terminal embedded network configured by the corresponding terminal devices, so as to obtain a federated embedded network;
[0067] The model parameters of the terminal classification network in the M terminal devices are obtained, and the model parameters of the M terminal classification networks are federally aggregated to obtain the classification update parameters corresponding to the M terminal devices respectively; the classification update parameters are used to be sent to the corresponding terminal devices, and are used to adjust the parameters of the terminal classification network configured for the corresponding terminal devices to obtain a federal classification network.
[0068] On the one hand, an embodiment of the present application provides another data processing device, including:
[0069] The embedding processing module is used to extract features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and send the first feature vector to the service server so that the service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the perturbation coding network is obtained by the service server adjusting the model parameters of the configured initial coding network based on the perturbation gradient value, and the perturbation gradient value is generated after M terminal devices respectively send terminal loss values and perturbation values, and the M terminal devices include a target terminal device; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data; the prediction result is generated by the initial classification network configured on the target terminal device; M is a positive integer;
[0070] The classification processing module is used to receive the perturbation coding vector sent by the business server, and adjust the model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network;
[0071] The terminal processing module is used to obtain the weight update parameters sent by the service server when both the terminal embedding network and the terminal classification network meet the terminal training convergence conditions, and adjust the model parameters of the terminal embedding network and the terminal classification network based on the weight update parameters to obtain the federated embedding network and the federated classification network; the weight update parameters are obtained by the service server performing federal aggregation processing on the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by the M terminal devices; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0072] In a possible implementation, the terminal processing module is further configured to perform the following operations:
[0073] Sending the model parameters of the terminal embedded network to the service server, sending the model parameters of the terminal classification network to the service server, so that the service server performs federal aggregation processing on the model parameters of the terminal embedded network sent by M terminal devices respectively to obtain embedded update parameters, and performs federal aggregation processing on the model parameters of the terminal classification network sent by M terminal devices respectively to obtain classification update parameters; the embedded update parameters and the classification update parameters are used to send to the M terminal devices;
[0074] The weight update parameters include embedding update parameters and classification update parameters. Model parameter adjustment is performed on the terminal embedding network and the terminal classification network based on the weight update parameters, including:
[0075] Performing a dot multiplication operation on the embedding update parameter and the first federated learning update weight to obtain a federated embedding gradient, and adjusting parameters of the terminal embedding network configured for the target terminal device based on the federated embedding gradient to obtain a federated embedding network corresponding to the target terminal device;
[0076] The embedding update parameter is point-multiplied with the second federated learning update weight to obtain the federated classification gradient. Based on the federated embedding gradient, the terminal classification network configured for the target terminal device is parameter-adjusted to obtain the federated classification network corresponding to the target terminal device.
[0077] In a possible implementation, the classification processing module is used to adjust the model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label, and when the terminal embedding network and the terminal classification network are obtained, specifically to perform the following operations:
[0078] The perturbation coding vector is classified and identified through the initial classification network to obtain a prediction result, and an iterative loss value is generated based on the sample label of the terminal service data and the prediction result. An iterative gradient value is generated based on the iterative loss value, the model parameters of the initial classification network, and the training learning rate, until K iterative gradient values corresponding to the initial embedding network and the initial classification network in K iteration rounds are obtained, and the average value of the K iterative gradient values is determined as the approximate gradient value; K is a positive integer;
[0079] The model parameters of the initial embedding network and the initial classification network are adjusted through the approximate gradient value to obtain the terminal embedding network and the terminal classification network.
[0080] In a possible implementation, when the terminal processing module is used to send the model parameters of the initial embedded network to the service server, it is specifically used to perform the following operations:
[0081] Secretly slicing the model parameters of the initial embedded network to obtain a first secret slice and a second secret slice, and sending the first secret slice to the service server, so that when the service server obtains the first secret slices respectively sent by the M terminal devices, it generates a first embedded slice based on the M first secret slices;
[0082] Also used to perform the following operations:
[0083] Obtaining the first embedded fragment sent by the service server, and generating a second embedded fragment based on the obtained M-1 second secret fragments for other terminal devices and the second secret fragment for the target terminal device; the other terminal device is a terminal device other than the target terminal device among the M terminal devices;
[0084] Perform a slice addition operation on the first embedded slice and the second embedded slice to obtain an embedding update parameter.
[0085] In a possible implementation, the terminal processing module is used to secretly slice the model parameters of the initial embedded network to obtain the first secret slice and the second secret slice, and specifically to perform the following operations:
[0086] A stretching factor is determined based on the bit width length of the model parameters of the initial embedded network, and the model parameters of the initial embedded network are encoded by floating point numbers using the stretching factor to obtain a stretched coded value, and the stretched coded value is subjected to arithmetic slicing processing to obtain a first secret slicing and a second secret slicing; the stretched coded value is an element in an integer ring, and the result of a slice addition operation of the first secret slicing and the second secret slicing is the stretched coded value; the second secret slicing is used to provide to other terminal devices.
[0087] On the one hand, an embodiment of the present application provides a computer device, including: a processor, a memory, and a network interface;
[0088] The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, and the memory is used to store a computer program. When the computer program is executed by the processor, the computer device executes the method provided in the embodiment of the present application.
[0089] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method provided by the embodiment of the present application.
[0090] In one aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method provided in the embodiment of the present application.
[0091] The embodiment of the present application obtains the terminal loss values sent to M terminal devices respectively, generates the disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network through the disturbance gradient value to obtain the disturbance coding network. By adding the disturbance value to the real gradient value, the disturbance gradient value is obtained, thereby protecting the original real gradient. Therefore, the coding network trained based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate features, the intermediate features will also be affected by the disturbance, and the disturbance coding features are obtained, so that others cannot infer the real gradient value through the change of the disturbance coding features, and thus cannot infer the model parameters of the disturbance coding network. By obtaining the first feature vectors sent by M terminal devices respectively, the M first feature vectors are feature extracted through the disturbance coding network, and the disturbance coding vectors corresponding to the M first feature vectors are obtained. One perturbation coding vector among the M perturbation coding vectors is sent to each of the M terminal devices. Each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by itself based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network. When the perturbation coding network meets the training convergence condition, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain the federated embedding network and the federated classification network corresponding to each terminal device. The perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are used together to provide classification services for the terminal service data in the target terminal device. The model training can be carried out jointly by the terminal device and the service server, which can reduce the computing overhead of the terminal device. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0093] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;
[0094] Figure 2 This is a schematic diagram of a data processing scenario provided by an embodiment of the present application;
[0095] Figure 3 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 1 ;
[0096] Figure 4 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 2 ;
[0097] Figure 5 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 3 ;
[0098] Figure 6 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. Figure 1 ;
[0099] Figure 7 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. Figure 2 ;
[0100] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0101] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0102] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0103] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0104] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0105] Federated Learning (FL) is a centrally aggregated server device that acts as a coordinator to send the initial model to multiple participants. The participating institutions then use their private data to train the model locally. After completing multiple local trainings, the updated values of the model weights are uploaded to the central aggregation server again. The server then aggregates the parameter updates and passes them to each participant. This process is repeated until the model converges and the maximum communication round requirement or time requirement is reached.
[0106] The solution provided in the embodiments of the present application involves machine learning and federated learning technologies of artificial intelligence, which are specifically illustrated by the following embodiments.
[0107] It can be understood that in the specific implementation of this application, the terminal business data involved, when the above and following embodiments of this application are applied to specific products or technologies, needs to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of the relevant regions.
[0108] Among them, if it is necessary to collect object (such as user, etc.) data in this application, a prompt interface or pop-up window will be displayed before and during the collection. The prompt interface or pop-up window is used to prompt the user that certain data is currently being collected. Only after the user confirms the prompt interface or pop-up window, the relevant steps of data acquisition will be started, otherwise it will end. Moreover, the acquired user data will be used in reasonable and legal scenarios or purposes. Optionally, in some scenarios where user data needs to be used but has not been authorized by the user, authorization can be requested from the user, and the user data can be used when the authorization is passed.
[0109] See also Figure 1 , Figure 1 Schematic diagram of a network architecture provided by an embodiment of the present application. Figure 1 As shown, the network architecture may include a business server 100 and a terminal device cluster, and the terminal device cluster may include terminal device 10a, terminal device 10b, ..., terminal device 10n, wherein any terminal device in the terminal device cluster may have a communication connection with the business server 100, for example, there is a communication connection between the terminal device 10a and the business server 100, and there is a communication connection between the terminal device 10b and the business server 100, wherein the above-mentioned communication connection does not limit the connection method, and may be directly or indirectly connected through a wired communication method, or directly or indirectly connected through a wireless communication method, or through other methods, and the present application does not make any restrictions here.
[0110] like Figure 1 As shown, the business server 100 and M terminal devices (which may include terminal device 10a, terminal device 10b, ..., terminal device 10n) can work together to perform federated learning, and the business server 100 can divide the initial model into an initial embedding network (Embedding Network), an initial encoding network (Encoding Network) and an initial classification network (Classification Network). The business server 100 can retain the initial encoding network and randomly initialize the model parameters of the initial encoding network. The business server 100 can send the initial embedding network and the initial classification network to the M terminal devices, and each terminal device randomly initializes the model parameters of the initial embedding network and the model parameters of the initial classification network.
[0111] Among them, the initial model can be a visual transformation model (Visual Transformer, ViT), a pre-trained generative model (Generative Pre-Trained, GPT), a pre-trained image processing model (Pre-Trained ImageProcessing Transformer, PTI), etc., and the embodiments of the present application are not limited here.
[0112] Federated learning may include T communication rounds, each of which may include K iteration rounds (K iteration training). At the beginning of each communication round, the service server 100 may send a model training (iterative training) request to the M terminal devices. The M terminal devices may perform model training based on the terminal service data they hold. Taking the first iteration round of the first communication round as an example, each terminal device may generate an iteration loss value to adjust the model parameters of the configured initial embedding network, obtain the first initial embedding network of the first round, and perform model training on the configured initial classification network. The model parameters are adjusted to obtain the first round of the first initial classification network. After completing the first round of the first iteration training, each terminal device can perform the first round of the second iteration training (the second iteration training of the first communication round) until the first round of the Kth iteration training is reached, and the first round of the Kth initial embedding network and the first round of the Kth initial classification network corresponding to each terminal device are obtained. Each terminal device can determine the iteration loss value generated by the first round of the Kth iteration training as the first round terminal loss value, and send the first round terminal loss value to the business server 100. The loss value generated by each terminal device during the iterative training can be called the terminal loss value.
[0113] The service server 100 can generate a perturbation gradient value based on the M first-round terminal loss values, the perturbation value, and the model parameters of the initial coding network, and adjust the model parameters of the initial coding network through the perturbation gradient value to obtain the first-round initial coding network. In the second communication round, the service server 100 can continue to send a model training request for the next communication round to the M terminal devices, and each terminal device can continue to adjust the model parameters of the configured first-round K-th initial embedding network and the first-round K-th initial classification network until the second-round K-th training is reached, and each terminal device can send the obtained second-round terminal loss value to the service server 100. The perturbation gradient value may refer to the gradient value after adding the perturbation value.
[0114] The service server 100 can continue to adjust the model parameters of the first round initial coding network through the M second round terminal loss values to obtain the second round initial coding network until the Kth iteration round of the Tth communication round is reached. The initial embedding network obtained by training the Kth iteration round of the Tth communication round can be called the terminal embedding network, and the initial classification network obtained by training the Kth iteration round of the Tth communication round can be called the terminal initial classification network. The service server 100 can receive the Tth round terminal loss values sent by M terminal devices respectively. The service server can adjust the model parameters of the T-1th round initial coding network through the Tth round terminal loss value to obtain a perturbed coding network. The initial embedding network that has converged in training can be called the terminal embedding network, and the initial classification network that has converged in training can be called the terminal classification network. The network obtained by adjusting the model parameters of the initial coding network through the perturbation gradient value can be called the perturbation coding network. The perturbation coding network is used to extract features from the first feature vector to obtain a perturbation coding vector.
[0115] When the perturbation coding network meets the training convergence condition (it can be a certain number of communication rounds), the service server 100 can obtain the model parameters of the terminal embedding network and the model parameters of the terminal initial classification network respectively configured by the M terminal devices, and perform federal aggregation processing on the model parameters of the M terminal embedding networks to obtain the federal embedding network and the federal classification network corresponding to each terminal device. Taking the terminal device 10a as an example, the perturbation coding network deployed on the service server 100 and the federal embedding network and the federal classification network on the terminal device 10a are used together to provide classification services for the terminal service data in the terminal device 10a. The network obtained after the model parameters of the M terminal embedding networks are federally aggregated can be called a federal embedding network, and the network obtained after the model parameters of the M terminal classification networks are federally aggregated can be called a federal classification network. The federal embedding network is used to extract features from the terminal service data to obtain a first feature vector, and the federal classification network is used to classify and identify the perturbation coding vector to obtain a prediction result.
[0116] In each communication round of the embodiment of the present application, the terminal device only needs to transmit the terminal loss value, and the terminal service data does not need to leave the local area, which can effectively protect data privacy and security. The business server can obtain the terminal loss value corresponding to each terminal device in only one communication round to generate a disturbance loss value, and adjust the parameters of the disturbance coding network once through the disturbance loss value, without the need to adjust the parameters in each iteration round, which greatly reduces the number of parameter exchanges and the amount of data, and reduces the communication cost. By adding the disturbance value to the true gradient value, the disturbance gradient value is obtained, thereby protecting the original true gradient. Therefore, the coding network trained based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate features, the intermediate features will also be affected by the disturbance, and the disturbance coding features are obtained, so that others cannot infer the true gradient value through the change of the disturbance coding features, and thus cannot infer the model parameters of the disturbance coding network. The model parameters and gradient information of the disturbance coding network are protected, and the model information protection capability is provided, which improves the security of the federated classification model.
[0117] See also Figure 2 , Figure 2 Schematic diagram of a data processing scenario provided by an embodiment of the present application. Figure 2 As shown, the terminal device 10a, the terminal device 10b, ..., the terminal device 10n are all configured with a federal embedded network and a federal classification network, and the service server 100 is configured with a scrambled coding network. For ease of understanding, the terminal device 10a is taken as an example for explanation. The scrambled coding network deployed on the service server 100 and the federal embedded network and the federal classification network on the terminal device 10a are jointly used to provide image classification services for the terminal service data in the terminal device 10a.
[0118] It can be understood that the terminal device 10a can be an external terminal device, and the perturbation coding network in the service server 100 is a black box scenario, that is, the external terminal device cannot obtain model parameters or gradient information.
[0119] The terminal device 10a can embed the business image data into a first feature vector through a federated embedding network. The first feature vector can be obtained by tokenizing the business image data (for example, a unit obtained by tokenization analysis). The terminal device 10a can send an interface call request carrying the first feature vector of the business image data to the business server 100.
[0120] The service server 100 may perform multimodal feature extraction on multiple modes such as color, shape, texture, etc. in the first feature vector based on the scrambled coding network to obtain a scrambled coding vector corresponding to the first feature vector.
[0121] The service server 100 may send the scrambled coding vector to the terminal device 10a. The terminal device 10a may classify and identify the scrambled coding vector based on the federated classification network, obtain the prediction probability corresponding to each category label in the label set corresponding to the federated classification network, and the terminal device 10a may determine the category label corresponding to the maximum prediction probability in the label set as the prediction result of the service image data.
[0122] The embodiment of the present application can jointly perform model training through the terminal device and the business server, which can reduce the computing overhead of the terminal device. The model training method proposed in the embodiment of the present application can allow the terminal business data to remain on the local device in situations where strict protection of user data privacy is required, such as medical health, financial services, personalized recommendations and other fields, and the first feature vector for encoding and embedding can be transmitted to provide classification services, thereby protecting data privacy and security. For fields with complex calculations and requiring rapid response, such as autonomous driving and real-time detection, the conversion coding network distributed in the business server can perform rapid data processing and model reasoning to improve processing efficiency. And because a large number of model parameters are concentrated in the business server, the business server centrally processes the parameter updates of the model, which helps to quickly iterate and improve the model while maintaining the consistency and accuracy of the model.
[0123] See also Figure 3 , Figure 3 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 1 The data processing method may be executed by a business server, which may be Figure 1 The business server 100 shown in FIG. 100 is shown in FIG. 101. The data processing method is executed by the business server as an example for description. The data processing method may include at least the following steps S101 to S104:
[0124] Step S101, the service server obtains the terminal loss values respectively sent by M terminal devices, generates a disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network by the disturbance gradient value to obtain a disturbance coding network; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data, and the target terminal device is any one of the M terminal devices; the prediction result is generated by the initial classification network configured on the target terminal device; M is a positive integer;
[0125] Specifically, the business server and M terminal devices can work together to perform federated learning, and the business server can divide the initial model into an initial embedding network, an initial coding network, and an initial classification network. The business server can retain the initial coding network and randomly initialize the model parameters of the initial coding network. The business server can send the initial embedding network and the initial classification network to M terminal devices, and each terminal device randomly initializes the model parameters of the initial embedding network and the model parameters of the initial classification network. Among them, the initial model can be a visual conversion model, a pre-trained generation model, a pre-trained image processing model, etc., and the embodiments of the present application are not limited here.
[0126] For ease of understanding, the example of federated learning including 2 communication rounds and the target terminal device performing the first communication round of training is used for explanation. The target terminal device can be any one of the M terminal devices. In the first communication round, each terminal device can generate the first round terminal loss value, adjust the model parameters of the configured initial embedding network, and obtain the first round initial embedding network, adjust the model parameters of the configured initial classification network, and obtain the first round initial classification network, and send the first round terminal loss value to the business server. The loss value generated by each terminal device during iterative training can be called the terminal loss value. The network obtained by adjusting the model parameters of the initial coding network through the perturbation gradient value can be called the perturbation coding network. The perturbation coding network is used to extract features from the first feature vector to obtain a perturbation coding vector.
[0127] The service server can obtain the first-round terminal loss values sent by M terminal devices respectively, generate the first-round disturbance gradient values based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M first-round terminal loss values, adjust the model parameters of the initial coding network through the first-round disturbance gradient values, and obtain the first-round disturbance coding network.
[0128] It can be understood that by adding a perturbation value to the true gradient value, the perturbation gradient value is obtained, thereby protecting the original true gradient. Therefore, the encoding network trained based on the perturbation gradient value also has a perturbation effect, so that when the perturbation encoding network outputs intermediate features, the intermediate features will also be affected by the perturbation, making it impossible for others to infer the true gradient value through the change of the intermediate features, and thus unable to infer the model parameters of the perturbation encoding network. The model parameters and gradient information of the perturbation encoding network are protected, and it has the ability to protect model information, thereby improving the security of the federated classification model.
[0129] Step S102, obtaining first feature vectors respectively sent by M terminal devices, performing feature extraction on the M first feature vectors through a perturbation coding network, and obtaining perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are respectively extracted by the M terminal devices from the terminal service data held by them through the configured initial embedding network;
[0130] Specifically, in the second communication round, each terminal device can extract features from the terminal service data it holds through the first round of initial embedding network to obtain a first feature vector, and send the first feature vector to the service server respectively. The service server can obtain the first feature vectors sent by the M terminal devices respectively, and extract features from the M first feature vectors through the first round of perturbation coding network to obtain perturbation coding vectors corresponding to the M first feature vectors respectively.
[0131] Step S103, sending one perturbation code vector of the M perturbation code vectors to each of the M terminal devices, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label, to obtain a terminal embedding network and a terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device;
[0132] Specifically, the service server may send one disturbance code vector among the M disturbance code vectors to each of the M terminal devices, and the disturbance code vector received by each terminal device corresponds to the first feature vector extracted by each terminal device. Among them, a disturbance code vector will only be sent to a terminal device corresponding thereto, for example, the disturbance code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device, and the target terminal device will only receive a disturbance code vector corresponding thereto.
[0133] Each terminal device classifies and identifies the received perturbation coding vector based on the first round initial classification network to obtain a prediction result, and adjusts the model parameters of the first round initial embedding network and the first round initial classification network configured by each terminal device based on the prediction result and the sample label to obtain the second round initial embedding network and the second round initial classification network. The second round initial embedding network can also be called the terminal embedding network, and the second round initial classification network can also be called the terminal classification network. The interface information output by the perturbation coding network can be called the perturbation coding vector. The initial embedding network that has converged in training can be called the terminal embedding network, and the initial classification network that has converged in training can be called the terminal classification network.
[0134] Among them, the terminal embedding network configured for each terminal device is obtained by adjusting the model parameters of the linear embedding network, and the terminal classification network configured for each terminal device is obtained by adjusting the model parameters of the classification network.
[0135] Step S104, when the perturbation coding network meets the training convergence condition, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain the federated embedding network and the federated classification network corresponding to each terminal device; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are used together to provide classification services for the terminal service data in the target terminal device.
[0136] Specifically, the service server can obtain the second round terminal loss values sent by the M terminal devices respectively, generate the second round perturbation gradient values based on the perturbation value, the model parameters of the initial coding network configured by the service server and the M second round terminal loss values, adjust the model parameters of the second round perturbation coding network by the perturbation gradient values, and obtain the second round perturbation coding network. When the communication rounds reach a certain number, it can be determined that the perturbation coding network meets the training convergence conditions. For example, when the communication rounds reach 2 times, the obtained second round perturbation coding network can be determined as a perturbation coding network that meets the training convergence conditions. The service server can obtain the model parameters of the terminal embedding network and the model parameters of the terminal classification network configured by the M terminal devices respectively, perform federal aggregation processing on the model parameters of the M terminal embedding networks to obtain embedding update parameters, perform federal aggregation processing on the model parameters of the M terminal classification networks to obtain classification update parameters, and send the embedding update parameters and classification update parameters to the M terminal devices.
[0137] Each terminal device can adjust the model parameters of the terminal embedding network based on the embedding update parameters to obtain the corresponding federated embedding network, and adjust the model parameters of the terminal classification network based on the classification update parameters to obtain the corresponding federated classification network. Taking the target terminal device as an example, the perturbation coding network that meets the training convergence conditions in the service server and the federal embedding network and federal classification network obtained by the target terminal device are used together to provide classification services for the terminal service data in the target terminal device. The network obtained after the model parameters of the M terminal embedding networks are federated and aggregated can be called a federal embedding network, and the network obtained after the model parameters of the M terminal classification networks are federated and aggregated can be called a federal classification network. The federal embedding network is used to extract features from the terminal service data to obtain the first feature vector, and the federal classification network is used to classify and identify the perturbation coding vector to obtain a prediction result.
[0138] Optionally, the federated learning in the embodiment of the present application may include T communication rounds, each communication round may include K iteration rounds, and the training process of each communication round may refer to the specific description of the above steps S101 to S104. In the training process of each iteration round, each terminal device may generate an iteration loss value to adjust the model parameters of the configured initial embedding network and the initial classification network, and the model parameter adjustment of each iteration round may be to adjust the initial embedding network and the initial classification network obtained in the previous iteration round. The iteration loss value generated by each terminal device in the Kth iteration training can be determined as the terminal loss value, and each terminal device can send the terminal loss value to the service server respectively. The service server generates a perturbation gradient value through the perturbation value, the model parameters of the initial coding network configured by the service server, and the M terminal loss values, and adjusts the model parameters of the initial coding network once through the perturbation gradient value. The model parameter adjustment of each communication round may be to adjust the perturbation coding network obtained in the previous communication round, which can greatly reduce the communication overhead in terms of calculation and memory. When a certain communication round is reached, it can be determined that the terminal embedded network and the terminal classification network respectively configured by the M terminal devices meet the terminal training convergence conditions. The initial embedded network that meets the terminal training convergence conditions can be called the terminal embedded network, and the initial classification network that meets the terminal training convergence conditions can be called the terminal classification network. The business server can perform federal aggregation processing on the terminal embedded network and the terminal classification network configured by the M terminal devices to obtain a federal embedded network and a federal classification network.
[0139] The embodiment of the present application obtains the terminal loss values sent to M terminal devices respectively, generates the disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network through the disturbance gradient value to obtain the disturbance coding network. By adding the disturbance value to the real gradient value, the disturbance gradient value is obtained, thereby protecting the original real gradient. Therefore, the coding network trained based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate features, the intermediate features will also be affected by the disturbance, and the disturbance coding features are obtained, so that others cannot infer the real gradient value through the change of the disturbance coding features, and thus cannot infer the model parameters of the disturbance coding network. By obtaining the first feature vectors sent by M terminal devices respectively, the M first feature vectors are feature extracted through the disturbance coding network, and the disturbance coding vectors corresponding to the M first feature vectors are obtained. One perturbation coding vector among the M perturbation coding vectors is sent to each of the M terminal devices. Each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by itself based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network. When the perturbation coding network meets the training convergence condition, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain the federated embedding network and the federated classification network corresponding to each terminal device. The perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are used together to provide classification services for the terminal service data in the target terminal device. The model training can be carried out jointly by the terminal device and the service server, which can reduce the computing overhead of the terminal device.
[0140] See also Figure 4 , Figure 4 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 2 The data processing method may be executed by a business server, which may be Figure 1 The business server 100 shown in FIG. 100 is shown in FIG. 100. The data processing method is described below by taking the data processing method executed by the business server as an example. The data processing method may at least include the following steps S201 to S206:
[0141] Step S201, the service server obtains the terminal loss values respectively sent by M terminal devices;
[0142] Specifically, the service server can collaborate with M terminal devices to conduct federated learning. The service server can divide the pre-trained model into a linear embedding network, a transform coding network, and a classification network. The linear embedding network and the classification network are respectively assigned to the M terminal devices. The service server retains the transform coding network and the parameter weights for the transform coding network in the pre-trained model. Each terminal device retains the parameter weights for the linear embedding network and the classification network in the pre-trained model, and randomly initializes the local parameter weights.
[0143] The pre-trained model can be a multimodal model that is pre-trained and converged on multiple modalities, such as a visual conversion model or a pre-trained generation model. Taking image recognition tasks as an example, the pre-trained model can be a pre-trained image processing model. The pre-trained model can be a model trained with public data similar to the task domain of federated learning.
[0144] The business server can determine the hyperparameters of federated learning, which may include the terminal sampling rate q, the model learning rate , the total number of terminal devices participating in federated learning (can be N), communication round T, iteration round K. Federated learning can include T communication rounds, each communication round can include K iteration rounds (K iteration training), at the beginning of each communication round, the service server can take the terminal sampling rate q, sample M terminal devices from N terminal devices based on the terminal sampling rate q, send model training requests to the M terminal devices, each of the M terminal devices can randomly sample the terminal service data stored locally, and can sample a preset batch of data.
[0145] For ease of understanding, the example of federated learning including 2 communication rounds, both of which include K iteration rounds, and the target terminal device performing training is used for explanation. The target terminal device can be any one of the M terminal devices. In the first iteration round of the first communication round, each terminal device can generate an iteration loss value to adjust the model parameters of the configured initial embedding network to obtain the first round of the first initial embedding network, and adjust the model parameters of the configured initial classification network to obtain the first round of the first initial classification network. After completing the first round of the first iteration training, each terminal device can perform the first round of the second iteration training (training of the second iteration round of the first communication round) until the first round of the Kth iteration training is reached, and the first round of the Kth initial embedding network and the first round of the Kth initial classification network corresponding to each terminal device are obtained. The iteration loss value obtained by the first round of the Kth iteration training can be called the first round terminal loss value, and the service server can obtain the first round terminal loss values sent by the M terminal devices. The loss value generated by each terminal device during iterative training can be called the terminal loss value.
[0146] It can be understood that the embodiments of the present application can divide the initial classification model into an initial embedding network and an initial classification network configured on the terminal device, and an initial coding network configured on the business server. The terminal device and the business server jointly perform model training, which can be expanded to a large number of terminal devices. Each terminal device contributes its own data and computing power, which helps to improve the generalization ability of the model and reduce the computing overhead of each terminal device. The terminal device and the business server can adjust the model parameters of the initial coding network and the initial embedding network in parallel, as well as adjust the model parameters of the perturbation coding network, thereby improving the model training efficiency.
[0147] Step S202, random sampling is performed in a real number space having the same dimension as the model parameters of the initial encoding network to obtain a random sampling vector; the random sampling vector obeys a normal distribution; a perturbation value is point-multiplied with the random sampling vector to obtain a perturbation sampling vector, a first perturbation parameter and a second perturbation parameter are generated based on the perturbation sampling vector and the model parameters of the initial encoding network, and a perturbation gradient value is generated based on M terminal loss values, the first perturbation parameter and the second perturbation parameter; the perturbation sampling vector is a vector having the same dimension as the model parameters of the initial encoding network.
[0148] Specifically, the service server may perform random sampling in a real number space having the same dimension as the model parameters of the initial coding network to obtain a random sampling vector z. The random sampling vector z is obtained by random sampling in a d-dimensional real number space, that is, The random sampling vector z follows a normal distribution, that is, . Refers to the identity matrix of the same size as the model parameters of the initial encoder network.
[0149] The business server can obtain the disturbance value , the disturbance value , is a constant value, which can be 0.0001. Perturbation value It can also be called the disturbance scale, which is used to control the degree of disturbance. Perform a dot multiplication operation with the random sampling vector z to obtain the perturbed sampling vector The business server can perturb the sampling vector A disturbance value is added to the model parameters of the initial coding network to obtain a symmetric component, which may include a first disturbance parameter and a second disturbance parameter. That is, the service server may generate the first disturbance parameter and the second disturbance parameter based on the disturbance sampling vector and the model parameters of the initial coding network.
[0150] The business server can generate a disturbance gradient value based on M terminal loss values, a first disturbance parameter and a second disturbance parameter. The process can be: performing a point multiplication operation on the target terminal loss value and the first disturbance parameter to obtain a first gradient parameter, performing a point multiplication operation on the target terminal loss value and the second disturbance parameter to obtain a second gradient parameter, and determining the difference between the first gradient parameter and the second gradient parameter as the target gradient parameter; generating a unit loss value corresponding to the target terminal loss value based on the target gradient parameter, a random sampling vector and a disturbance value; when the unit loss values corresponding to the M terminal loss values are obtained, performing a point multiplication operation on the average value of the M unit loss values and the training learning rate to obtain a disturbance gradient value.
[0151] Specifically, the M terminal loss values may include a target terminal loss value, and the target terminal loss value may be any terminal loss value among the M terminal loss values. The corresponding unit loss value can be expressed as , unit loss value The calculation process can be shown as formula (1):
[0152] Formula (1)
[0153] in, Used to indicate the last iteration (Kth round) of training for terminal service data in the tth communication round The generated loss value is the target terminal loss value. Used to represent a batch of data sampled by terminal device i in the last round of iterative training in the tth communication round. When used to represent the tth communication round, the initial encoding network The model parameters. operator is used to indicate approach to a limit.
[0154] The service server can perform a point multiplication operation on the target terminal loss value and the first disturbance parameter to obtain the first gradient parameter , perform a dot multiplication operation on the target terminal loss value and the second perturbation parameter to obtain the second gradient parameter , the difference between the first gradient parameter and the second gradient parameter is determined as the target gradient parameter. The service server can be based on the target gradient parameter, the random sampling vector z and the disturbance value Generates the unit loss value corresponding to the target terminal loss value.
[0155] When the unit loss values corresponding to the M terminal loss values are obtained, the average value of the M unit loss values is multiplied by the training learning rate to obtain the perturbation gradient value (the perturbation gradient value may refer to the gradient value after the perturbation value is added). The calculation process of the perturbation gradient value can be shown as formula (2):
[0156] Formula (2)
[0157] in, is the perturbation gradient value generated for the tth communication round, Used to represent the unit loss value generated for terminal device i.
[0158] The business server can generate a first-round disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the business server, and the M first-round terminal loss values, and adjust the model parameters of the initial coding network through the first-round disturbance gradient value to obtain a first-round disturbance coding network.
[0159] It can be understood that the embodiment of the present application adds a disturbance value to the true gradient value to obtain a disturbance gradient value, thereby protecting the original true gradient. Therefore, the coding network obtained by training based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate feature, the intermediate feature will also be affected by the disturbance, and the disturbance coding feature is obtained, so that others cannot infer the true gradient value through the change of the disturbance coding feature, and thus cannot infer the model parameters of the disturbance coding network. The terminal device adjusts the model parameters of the initial embedding network and the initial classification network through the disturbance coding feature to obtain the terminal loss value. The service server can add appropriate random disturbance noise (disturbance value) according to the Gaussian distribution to the terminal loss value sent by each terminal device, and effectively approximate the model gradient by calculating the difference of the terminal loss value in the symmetric direction to obtain the disturbance gradient value. The disturbance gradient value is obtained only by function evaluation calculation, and there is no need to perform back propagation training to calculate the gradient value. It can be applied to black box scenarios, improves the calculation efficiency, does not require complex back propagation training to calculate the gradient value, and reduces the calculation cost. At the same time, since the perturbation value is a noise value, the perturbation coding network relies on random sampling to estimate the gradient. By training and learning the perturbation value, it can have good robustness to noise and outliers.
[0160] Step S203, generating a first-order moment estimate and a second-order moment estimate of the disturbance gradient value based on the disturbance gradient value; the first-order moment estimate is used to indicate the weighted mean of the disturbance gradient value in T communication rounds, and the second-order moment estimate is used to indicate the weighted variance of the disturbance gradient value in T communication rounds; performing a point multiplication operation on the training learning rate and the first-order moment estimate to obtain a first update parameter, performing a point multiplication operation on the arithmetic square root of the second-order moment estimate and the disturbance value to obtain a second update parameter, generating a parameter update value based on the first update parameter and the second update parameter, adjusting the model parameters of the initial coding network through the parameter update value, and obtaining a disturbance coding network.
[0161] Specifically, the business server can generate a first-order moment estimate and a second-order moment estimate of the disturbance gradient value based on the disturbance gradient value, and the process may be: obtaining a first communication weight and a second communication weight; the first communication weight is used to characterize the weight of the disturbance gradient value of T communication rounds, and the second communication weight is used to characterize the weight of the disturbance gradient value of T communication rounds; based on the disturbance gradient value of the T communication round, the first communication weight, and the first-order moment estimate generated in the T-1 communication round, the first-order moment estimate in the T communication round is generated; based on the disturbance gradient value of the T communication round, the second communication weight, and the second-order moment estimate generated in the T-1 communication round, the second moment estimate in the T communication round is generated.
[0162] Specifically, the first-order moment estimate is used to indicate the weighted mean of the disturbance gradient value in T communication rounds. The service server can calculate the disturbance gradient value in the Tth communication round based on the disturbance gradient value. , the first communication weight and the first-order moment estimate generated in the T-1th communication round Generate the first-order moment estimate in the Tth communication round, the first-order moment estimate in the Tth communication round The calculation process can be shown as formula (3):
[0163] Formula (3)
[0164] in, is the first communication weight, which is the coefficient used to control the weight of the perturbation gradient value in T communication rounds, , which can be set to 0.9. It is the first-order moment estimate of the previous communication round, that is, the first-order moment estimate of the T-1th communication round.
[0165] The second-order moment estimate is used to indicate the weighted variance of the disturbance gradient value in T communication rounds. The service server can calculate the disturbance gradient value based on the Tth communication round. , the second communication weight and the second-order moment estimate generated in the T-1th communication round Generate the second moment estimate in the Tth communication round , the second-order moment estimate of the Tth communication round The calculation process can be shown as formula (4):
[0166] Formula (4)
[0167] in, is the second communication weight, which is the coefficient used to control the weight of the perturbation gradient value in T communication rounds. , which can be set to 0.99. It is the second-order moment estimate of the previous communication round, that is, the second-order moment estimate of the T-1th communication round.
[0168] The service server can perform a point multiplication operation on the training learning rate and the first-order moment estimate to obtain a first update parameter, perform a point multiplication operation on the arithmetic square root of the second-order moment estimate and the disturbance value to obtain a second update parameter, generate a parameter update value based on the first update parameter and the second update parameter, and adjust the model parameters of the initial coding network through the parameter update value to obtain a disturbance coding network. The process of adjusting the model parameters based on the parameter update value can be shown as formula (5):
[0169] Formula (5)
[0170] in, is the training learning rate, It is used to represent the model parameters before adjustment, that is, the model parameters of the initial encoding network. Used to represent the adjusted model parameters, that is, the model parameters of the perturbation encoding network. The operator is used to represent the process of adjusting model parameters during backpropagation training.
[0171] It can be understood that the embodiment of the present application calculates the first-order moment estimate and the second-order moment estimate of the perturbation gradient value. The first-order moment estimate is a momentum term that can help accelerate the convergence of model training and reduce random fluctuations in the perturbation value. The second-order moment estimate helps to adjust the learning rate of each model parameter so that the learning rate is adaptively adjusted according to the historical gradient changes of the parameter. By calculating the first-order moment estimate and the second-order moment estimate of the perturbation gradient value, the accuracy of the perturbation coding network can be improved while ensuring the security of the gradient information of the perturbation coding network.
[0172] Optionally, the embodiment of the present application can also directly adjust the model parameters of the initial coding network by the perturbation gradient value to obtain the perturbation coding network. The process of adjusting the model parameters based on the perturbation gradient value can be shown as formula (6):
[0173] Formula (6)
[0174] Step S204, obtaining first feature vectors respectively sent by M terminal devices, performing feature extraction on the M first feature vectors through a perturbation coding network, and obtaining perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are respectively extracted by the M terminal devices from the terminal service data held by them through the configured initial embedding network;
[0175] Specifically, in the first iteration of the second round of training, each terminal device can extract features from the terminal service data held by the first round of K-th initial embedding network to obtain a first feature vector, and send the first feature vector to the service server respectively. The service server can obtain the first feature vectors sent by the M terminal devices respectively, extract features from the M first feature vectors through the first round of perturbation coding network, and obtain perturbation coding vectors corresponding to the M first feature vectors respectively. The interface information output by the perturbation coding network can be called a perturbation coding vector.
[0176] Step S205, sending one perturbation code vector of the M perturbation code vectors to each of the M terminal devices, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label, to obtain a terminal embedding network and a terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device;
[0177] Specifically, the service server may send one disturbance code vector among the M disturbance code vectors to each of the M terminal devices, and the disturbance code vector received by each terminal device corresponds to the first feature vector extracted by each terminal device. Among them, a disturbance code vector will only be sent to a terminal device corresponding thereto, for example, the disturbance code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device, and the target terminal device will only receive a disturbance code vector corresponding thereto.
[0178] The target terminal device can receive the perturbation coding vector sent by the service server, classify and identify the perturbation coding vector through the first round K-th initial classification network, obtain the prediction result, generate the approximate loss value based on the prediction result and the sample label of the terminal service data, and adjust the model parameters of the first round K-th initial embedding network and the first round K-th initial classification network configured by the approximate loss value until the second round K-th iteration training is reached, and the second round K-th initial embedding network and the second round K-th initial classification network corresponding to each terminal device are obtained. The second round K-th initial embedding network can also be called the terminal embedding network, and the second round K-th initial classification network can also be called the terminal classification network. The initial embedding network that has converged in training can be called the terminal embedding network, and the initial classification network that has converged in training can be called the terminal classification network. The network obtained by adjusting the model parameters of the initial coding network through the perturbation gradient value can be called the perturbation coding network, and the perturbation coding network is used to extract features from the first feature vector to obtain the perturbation coding vector.
[0179] The embodiment of the present application can adapt to the black box scenario where the model parameters or gradient information of the federated classification model cannot be obtained, so that the terminal device can normally use the interface information of the coding network in the federated classification model without knowing the intermediate features encoded in the federated classification model. The interface information can be a perturbation coding vector, and the perturbation coding vector is used to perform the training process of federated learning with multiple external terminal devices. The model parameters and gradient information of the perturbation coding network are protected, and the model information protection capability is provided, thereby improving the security of the federated classification model.
[0180] Step S206, obtaining model parameters of the terminal embedded network in the M terminal devices, and performing federal aggregation processing on the model parameters of the M terminal embedded networks to obtain embedding update parameters corresponding to the M terminal devices respectively; the embedding update parameters are used to be sent to the corresponding terminal devices, and are used to adjust the parameters of the terminal embedded network configured for the corresponding terminal devices to obtain a federal embedded network; obtaining model parameters of the terminal classification network in the M terminal devices, and performing federal aggregation processing on the model parameters of the M terminal classification networks to obtain classification update parameters corresponding to the M terminal devices respectively; the classification update parameters are used to be sent to the corresponding terminal devices, and are used to adjust the parameters of the terminal classification network configured for the corresponding terminal devices to obtain a federal classification network.
[0181] Specifically, when the Kth iteration of the second round of training is reached, it can be determined that both the terminal embedding network and the terminal classification network meet the terminal training convergence conditions. When a certain number of communication rounds is reached, it can be determined that the perturbation coding network meets the training convergence conditions. It can be understood that when the perturbation coding network meets the training convergence conditions, the perturbation coding network deployed on the service server and the terminal embedding network and terminal classification network deployed on the terminal device are used together to form a federated classification model. The service server and each terminal device perform federated learning. The process of optimizing the objective function F of the federated classification model can be shown as formula (7):
[0182] Formula (7)
[0183] Among them, M is the number of terminal devices participating in federated learning, For the expected value of terminal service data (t is the communication round of the current training), It refers to the data distribution that the terminal business data obeys. w can be used to indicate the model parameters of the federated classification model. is the input terminal business data, Used to represent the function processing of the federated classification model on terminal business data.
[0184] The service server can calculate the perturbation gradient value to perturb the encoding network in the last iteration round (Kth iteration round) of each communication round The model parameters are adjusted, and when the preset communication rounds are reached, a perturbation coding network that meets the training convergence conditions is obtained. , a perturbation coding network that meets the training convergence conditions It can also be called a federated coding network. Optimizing the Perturbation Encoding Network The process can be shown as formula (8):
[0185] Formula (8)
[0186] in, For representing perturbation encoding networks The model parameters, is the expected value for the terminal service data (t is the communication round of the current training), Refers to the data distribution that terminal business data obeys. is a loss function (the specific selection of the loss function is not limited in this embodiment of the application), Used to represent terminal business data The sample labels of . The initial classification network used to represent terminal device i The output prediction results are: The initial classification network used to represent terminal device i The model parameters. Perturbation coding network for representing business servers The output perturbation encoding vector, Transcoding network used to represent business servers The model parameters. The initial embedded network used to represent terminal device i The first eigenvector of the output, The initial embedded network used to represent terminal device i The model parameters.
[0187] The service server can obtain the model parameters of the terminal embedded network in the M terminal devices, perform federation aggregation processing on the model parameters of the M terminal embedded network, and obtain the embedding update parameters corresponding to the M terminal devices respectively. Taking the federation aggregation processing as average aggregation as an example, the embedding update parameters are obtained. The process can be shown as formula (9):
[0188] Formula (9)
[0189] in, Terminal embedded network configured for terminal device i . Embed update parameters Used to send to the corresponding terminal device i, and used to configure the terminal embedding network of the corresponding terminal device i Adjust the parameters to get the federated embedding network The network obtained by performing federated aggregation processing on the model parameters of the M terminal embedding networks can be called a federated embedding network. The federated embedding network is used to extract features from the terminal service data to obtain a first feature vector.
[0190] The service server can obtain the model parameters of the terminal classification network in the M terminal devices, perform federation aggregation processing on the model parameters of the M terminal classification network, and obtain the classification update parameters corresponding to the M terminal devices respectively. Taking the federation aggregation processing as average aggregation as an example, the classification update parameters are obtained. The process can be shown as formula (10):
[0191] Formula (10)
[0192] in, Terminal classification network configured for terminal device i . Embed update parameters Used to send to the corresponding terminal device i, and used to configure the terminal classification network for the corresponding terminal device i Adjust the parameters to get the federated classification network The network obtained by performing federated aggregation processing on the model parameters of the M terminal classification networks can be called a federated classification network. The federated classification network is used to classify and identify the perturbation coding vector to obtain a prediction result.
[0193] When the perturbation encoding network When the training convergence conditions are met, the perturbation encoding network that meets the training convergence conditions Identified as a federal coding network , the federated coding network A federated embedded network configured with each end device and the Federated Classification Network , together constitute the federated classification model corresponding to each terminal device i. Among them, the federated coding network and the federated embedding network and the federated classification network configured by the target terminal device together constitute the federated classification model corresponding to the target terminal device. The training convergence condition can be to reach a preset communication round.
[0194] Optionally, the federated learning in the embodiment of the present application may include T communication rounds, each communication round may include K iteration rounds, and the training process of each communication round may refer to the specific description of the above steps S201 to S206. In the training process of each iteration round, each terminal device may generate an iteration loss value to adjust the model parameters of the configured initial embedding network and the initial classification network. The model parameter adjustment of each iteration round may be to adjust the initial embedding network and the initial classification network obtained in the previous iteration round. The training process of each iteration round may refer to the specific description of the above step S201. The iteration loss value generated by each terminal device in the Kth iteration training may be determined as the terminal loss value, and each terminal device may send the terminal loss value to the service server respectively. The service server generates a perturbation gradient value through the perturbation value, the model parameters of the initial coding network configured by the service server, and the M terminal loss values. The model parameters of the initial coding network are adjusted once through the perturbation gradient value. The model parameter adjustment of each communication round may be to adjust the perturbation coding network obtained in the previous communication round, which can greatly reduce the communication overhead in terms of calculation and memory. When a certain communication round is reached, it can be determined that the terminal embedded network and the terminal classification network respectively configured by the M terminal devices meet the terminal training convergence conditions. The initial embedded network that meets the terminal training convergence conditions can be called the terminal embedded network, and the initial classification network that meets the terminal training convergence conditions can be called the terminal classification network. The business server can perform federal aggregation processing on the terminal embedded network and the terminal classification network configured by the M terminal devices to obtain a federal embedded network and a federal classification network.
[0195] The embodiment of the present application obtains the terminal loss values sent to M terminal devices respectively, generates the disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network through the disturbance gradient value to obtain the disturbance coding network. By adding the disturbance value to the real gradient value, the disturbance gradient value is obtained, thereby protecting the original real gradient. Therefore, the coding network trained based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate features, the intermediate features will also be affected by the disturbance, and the disturbance coding features are obtained, so that others cannot infer the real gradient value through the change of the disturbance coding features, and thus cannot infer the model parameters of the disturbance coding network. By obtaining the first feature vectors sent by M terminal devices respectively, the M first feature vectors are feature extracted through the disturbance coding network, and the disturbance coding vectors corresponding to the M first feature vectors are obtained. One perturbation coding vector among the M perturbation coding vectors is sent to each of the M terminal devices. Each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by itself based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network. When the perturbation coding network meets the training convergence condition, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain the federated embedding network and the federated classification network corresponding to each terminal device. The perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are used together to provide classification services for the terminal service data in the target terminal device. The model training can be carried out jointly by the terminal device and the service server, which can reduce the computing overhead of the terminal device.
[0196] The embodiment of the present application adds a disturbance value to the real gradient value to obtain a disturbance gradient value, thereby protecting the original real gradient. Therefore, the coding network obtained by training based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate feature, the intermediate feature will also be affected by the disturbance, and the disturbance coding feature is obtained, so that others cannot infer the real gradient value through the change of the disturbance coding feature, and thus cannot infer the model parameters of the disturbance coding network. The terminal device adjusts the model parameters of the initial embedding network and the initial classification network through the disturbance coding feature to obtain the terminal loss value. The service server can add appropriate random disturbance noise (disturbance value) according to the Gaussian distribution to the terminal loss value sent by each terminal device, and effectively approximate the model gradient by calculating the difference of the terminal loss value in the symmetric direction to obtain the disturbance gradient value. The disturbance gradient value is obtained only through function evaluation calculation, and there is no need to perform back-propagation training to calculate the gradient value. It can be applied to black box scenarios, improves the calculation efficiency, does not require complex back-propagation training to calculate the gradient value, and reduces the calculation cost. At the same time, since the perturbation value is a noise value, the perturbation coding network relies on random sampling to estimate the gradient. Through training and learning the perturbation value, it can have good robustness to noise and outliers. By introducing the first-order moment estimate and the second-order moment estimate as momentum terms, it can help accelerate the convergence of model training and reduce the random fluctuations of the perturbation value. The second-order moment estimate helps to adjust the learning rate of each model parameter, so that the learning rate is adaptively adjusted according to the historical gradient changes of the parameter. By calculating the first-order moment estimate and the second-order moment estimate of the perturbation gradient value, the accuracy of the perturbation coding network can be improved while ensuring the security of the gradient information of the perturbation coding network.
[0197] See also Figure 5 , Figure 5 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 3 The data processing method may be executed by a target terminal device, which may be Figure 1 Any terminal device in the terminal device set shown. The data processing method may at least include the following steps S301 to S303:
[0198] Step S301, the target terminal device extracts features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and sends the first feature vector to the service server, so that the service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the perturbation coding network is obtained by the service server adjusting the model parameters of the configured initial coding network based on the perturbation gradient value, and the perturbation gradient value is generated after M terminal devices respectively send terminal loss values and perturbation values, and the M terminal devices include the target terminal device; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data; the prediction result is generated by the initial classification network configured on the target terminal device;
[0199] Specifically, the service server can collaborate with M terminal devices to conduct federated learning. The service server can divide the pre-trained model into a linear embedding network, a transform coding network, and a classification network. The linear embedding network and the classification network are respectively assigned to the M terminal devices. The service server retains the transform coding network and the parameter weights for the transform coding network in the pre-trained model. Each terminal device retains the parameter weights for the linear embedding network and the classification network in the pre-trained model, and randomly initializes the local parameter weights.
[0200] The pre-trained model can be a multimodal model that is pre-trained and converged on multiple modalities, such as a visual conversion model or a pre-trained generation model. Taking image recognition tasks as an example, the pre-trained model can be a pre-trained image processing model. The pre-trained model can be a model trained with public data similar to the task domain of federated learning.
[0201] The business server can determine the hyperparameters of federated learning, which may include the terminal sampling rate q, the model learning rate , the total number of terminal devices participating in federated learning (can be N), communication round T, iteration round K. Federated learning can include T communication rounds, each communication round can include K iteration rounds (K iteration training), at the beginning of each communication round, the service server can take the terminal sampling rate q, sample M terminal devices from N terminal devices based on the terminal sampling rate q, send model training requests to the M terminal devices, each of the M terminal devices can randomly sample the terminal service data stored locally, and can sample a preset batch of data.
[0202] For ease of understanding, the example of federated learning including 2 communication rounds, both of which include K iteration rounds, and training of the target terminal device is explained. The target terminal device can be any one of the M terminal devices. In the first iteration round of the first communication round, each terminal device can generate an iteration loss value to adjust the model parameters of the configured initial embedding network to obtain the first round of the first initial embedding network, and adjust the model parameters of the configured initial classification network to obtain the first round of the first initial classification network. After completing the first round of the first iteration training, each terminal device can perform the first round of the second iteration training (the first The second iteration round of the communication round is trained until the Kth iteration training of the first round is reached, and the Kth initial embedding network and the Kth initial classification network corresponding to each terminal device are obtained. The iterative loss value obtained by the Kth iteration training of the first round can be called the first round terminal loss value. The service server can obtain the first round terminal loss values sent by the M terminal devices respectively, and generate the first round perturbation gradient value based on the perturbation value, the model parameters of the initial coding network configured by the service server, and the M first round terminal loss values. The model parameters of the initial coding network are adjusted by the first round perturbation gradient value to obtain the first round perturbation coding network. The loss value generated by each terminal device during iterative training can be called the terminal loss value. The network obtained by adjusting the model parameters of the initial coding network by the perturbation gradient value can be called the perturbation coding network. The perturbation coding network is used to extract features from the first feature vector to obtain a perturbation coding vector.
[0203] In the first iteration training of the second round, each terminal device can extract features from the terminal service data held by the first round K-th initial embedding network to obtain the first feature vector, and send the first feature vector to the service server respectively. The service server can obtain the first feature vectors sent by the M terminal devices respectively, extract features from the M first feature vectors through the first round perturbation coding network, and obtain the perturbation coding vectors corresponding to the M first feature vectors respectively. The interface information output by the perturbation coding network can be called a perturbation coding vector.
[0204] It can be understood that in each communication round, the terminal device only needs to transmit the terminal loss value, and the terminal business data does not need to leave the local area, which can effectively protect data privacy and security. Since the terminal loss value is obtained by the initial classification network classifying and identifying the perturbation coding vector output by the perturbation coding network, the initial embedding network obtained by adjusting the model parameters by the terminal loss value also carries noise (perturbation value), and the first eigenvector extracted from the terminal business data by the initial embedding network also carries noise, making it impossible for others to infer the gradient value of the initial embedding network through the change of the first eigenvector, and thus it is impossible to infer the model parameters of the initial embedding network or pass the model parameters, thereby improving the security of the initial embedding network.
[0205] Step S302, receiving the perturbation coding vector sent by the service server, and adjusting the model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network;
[0206] Specifically, the target terminal device can receive the perturbation coding vector sent by the service server. The perturbation coding vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device. The target terminal device will only receive a perturbation coding vector corresponding thereto. The target terminal device can classify and identify the perturbation coding vector through the first round K-th initial classification network to obtain a prediction result. Based on the prediction result and the sample label of the terminal service data, an approximate loss value is generated. The model parameters of the first round K-th initial embedding network and the first round K-th initial classification network configured by each device are adjusted through the approximate loss value until the second round K-th iteration training is reached, and the second round K-th initial embedding network and the second round K-th initial classification network corresponding to each terminal device are obtained. The second round K-th initial embedding network can also be referred to as a terminal embedding network, and the second round K-th initial classification network can also be referred to as a terminal classification network. The initial embedding network that has converged in training can be referred to as a terminal embedding network, and the initial classification network that has converged in training can be referred to as a terminal classification network.
[0207] The perturbation coding vector is generated by the perturbation coding network. For details about the perturbation coding network and the perturbation coding vector, please refer to the above Figure 4 The specific description of steps S201 to S203 of the corresponding embodiment will not be repeated here in the embodiment of the present application.
[0208] Optionally, the target terminal device may determine the average value of the loss values generated by K iterative training as the approximate loss value, and adjust the model parameters of the initial embedding network and the initial classification network through the approximate loss value. The process may be: classify and identify the perturbation coding vector through the initial classification network to obtain a prediction result, generate an iterative loss value based on the sample label of the terminal business data and the prediction result, generate an iterative gradient value based on the iterative loss value, the model parameters of the initial classification network and the training learning rate, until the K iterative gradient values corresponding to the initial embedding network and the initial classification network in K iterative rounds are obtained, and the average value of the K iterative gradient values is determined as the approximate gradient value; K is a positive integer; the model parameters of the initial embedding network and the initial classification network are adjusted through the approximate gradient value to obtain the terminal embedding network and the terminal classification network.
[0209] Specifically, the perturbation coding vector is classified and identified through the initial classification network to obtain a prediction result, and an iterative loss value is generated based on the sample label of the terminal business data and the prediction result. That is, in each iterative training, the target terminal device can generate an iterative loss value, and the target terminal device can generate an iterative gradient value based on the iterative loss value, the model parameters of the initial classification network, and the training learning rate, until K iterative gradient values corresponding to the initial embedding network and the initial classification network in K iterative rounds are obtained, and the target terminal device can determine the average value of the K iterative gradient values as the approximate gradient value.
[0210] The model parameters of the K-th initial embedding network and the K-th initial classification network configured in the first round are adjusted through the approximate loss value until the K-th iterative training in the second round is reached, and the K-th initial embedding network and the K-th initial classification network corresponding to each terminal device are obtained. The K-th initial embedding network in the second round can also be called the terminal embedding network, and the K-th initial classification network in the second round can also be called the terminal classification network.
[0211] Step S303, when both the terminal embedding network and the terminal classification network meet the terminal training convergence condition, obtain the weight update parameters sent by the service server, adjust the model parameters of the terminal embedding network and the terminal classification network based on the weight update parameters, and obtain the federated embedding network and the federated classification network; the weight update parameters are obtained by the service server through federal aggregation processing of the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by the M terminal devices; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0212] Specifically, when both the terminal embedding network and the terminal classification network meet the terminal training convergence condition, the target terminal device can send the model parameters of the terminal embedding network and the model parameters of the terminal classification network to the business server for federated aggregation processing, and the process can be: sending the model parameters of the terminal embedding network to the business server, sending the model parameters of the terminal classification network to the business server, so that the business server performs federated aggregation processing on the model parameters of the terminal embedding network sent by M terminal devices respectively to obtain embedding update parameters, and performs federated aggregation processing on the model parameters of the terminal classification network sent by M terminal devices respectively to obtain classification update parameters; the embedding update parameters and the classification update parameters are used to be sent to the M terminal devices;
[0213] Specifically, when the Kth iteration training in the second round is reached, it can be determined that both the terminal embedding network and the terminal classification network meet the terminal training convergence conditions. The target terminal device can send the model parameters of the terminal embedding network to the business server, and send the model parameters of the terminal classification network to the business server. The business server can obtain the model parameters of the terminal embedding networks in the M terminal devices, and perform federal aggregation processing on the model parameters of the M terminal embedding networks to obtain the embedding update parameters corresponding to the M terminal devices respectively. The business server can obtain the model parameters of the terminal classification networks in the M terminal devices, and perform federal aggregation processing on the model parameters of the M terminal classification networks to obtain the classification update parameters corresponding to the M terminal devices respectively.
[0214] Optionally, the target terminal device may perform multi-party secure computation on the model parameters of the terminal embedded network and the model parameters of the terminal classification network to generate secret slices of the model parameters of the terminal embedded network and the model parameters of the terminal classification network. Taking the model parameters of the terminal embedded network as an example, the process may be: performing secret slicing on the model parameters of the initial embedded network to obtain a first secret slice and a second secret slice, and sending the first secret slice to the business server, so that when the business server obtains the first secret slices respectively sent by M terminal devices, it generates a first embedded slice based on the M first secret slices;
[0215] Specifically, secret sharing can be used to generate secret shards. Secret sharing can include arithmetic secret sharing (Arithmetic Secret Sharing) and Boolean secret sharing (Boolean Secret Sharing). Arithmetic secret sharing can be used to generate arithmetic shards, and Boolean secret sharing can be used to generate Boolean shards.
[0216] It should be understood that secret sharing can be used to generate secret slices. Secret sharing can include arithmetic secret sharing and Boolean secret sharing. Arithmetic secret sharing can be used to generate arithmetic slices, and Boolean secret sharing can be used to generate Boolean slices. Secret sharing has the "homomorphism" that each participant can directly sum and multiply the cryptographic data (i.e. arithmetic slices or Boolean slices) without exchanging any data. In arithmetic secret sharing, integer rings are For example, Equal to 2 64 (i.e. modulo 2 64 Plus, indicating that the maximum value of an integer is 2 64 -1, at this time, the addition operation refers to Addition and subtraction operations on ), The number on Split into two shards (i.e. arithmetic shards) and , Held by the first party, Held by the second party, and , similarly, , arithmetic slicing has additive homomorphism, that is In Boolean secret sharing, Boolean values are combined using XOR. Split into two shards (i.e. Boolean sharding) and , Held by the first party, Held by the second party, In other words, if the secret sharing method is XOR, the random number obtained by the calculation party is called Boolean sharding; if the secret sharing method is arithmetic addition, the random number obtained by the calculation party is called arithmetic sharding. Among them, Boolean sharding and arithmetic sharding can be collectively referred to as secret sharding (sharding for short).
[0217] The target terminal device can secretly slice the model parameters of the initial embedded network to obtain a first secret slice and a second secret slice, and send the first secret slice to the business server. When the business server obtains the first secret slices sent by M terminal devices respectively, it performs a slice addition operation on the M first secret slices to obtain a first sum slice, and performs a slice division operation on the first sum slice based on the number M of terminal devices that share the secret to obtain a first embedded slice.
[0218] Among them, the two-party slice addition (Add, which can also be called slice addition operation) is expressed as " " means: input and , output . Two-way slice division (Div), here we use " " means: input and , output .when When M is an integer, the output .
[0219] Among them, the process of secretly slicing the model parameters of the initial embedded network to obtain the first secret slice and the second secret slice can be: determining the stretching factor based on the bit width length of the model parameters of the initial embedded network, performing floating point encoding on the model parameters of the initial embedded network through the stretching factor to obtain a stretched coded value, and performing arithmetic slicing processing on the stretched coded value to obtain the first secret slice and the second secret slice; the stretched coded value is an element in the integer ring, and the result of the slice addition operation of the first secret slice and the second secret slice is the stretched coded value; the second secret slice is used to provide to other terminal devices.
[0220] Specifically, the target terminal device can determine the stretching factor f based on the bit width length of the model parameter of the initial embedded network, and perform floating point encoding on the model parameter y of the initial embedded network based on the stretching factor f to obtain the stretched encoding value t. The process can be expressed as t=Encode(y,f). Among them, the stretched encoding value is an element in the integer ring, that is, t∈ .
[0221] Among them, the model parameter y of the initial embedding network can be a floating point number obtained by vector encoding, and the model parameter y of the initial embedding network can include an integer part and a decimal part, that is, y∈R, f is a positive integer, and the stretching factor f can be used to represent a decimal floating point number as a binary floating point number. Then the stretching factor f can represent the bit width of the decimal part of the model parameter y of the initial embedding network, and the stretching factor f can generally be set to 20.
[0222] Taking the secret shard as an arithmetic shard as an example, the target terminal device can input the model parameters y and the stretch factor f of the initial embedding network, execute t=Encode(y,f), and calculate , which can be expressed by combining y with Multiply, round the result to the nearest integer, and when t≥0, output t∈ ; otherwise output t+ ∈ . P can generally be set to 64, that is, t has 64 bits. The target terminal device can perform arithmetic slicing on the stretched code value t to obtain the first secret slice and the second secret shard . First Secret Shard Used to provide the second secret fragment to the business server Used to provide to other terminal devices.
[0223] Among them, the first secret arithmetic shard Interactive Arithmetic Slicing The result of the slice addition operation is the stretched code value t, the interactive arithmetic slice It can be used to provide to the second party. Two-party shard addition (Add, also known as shard addition operation), here is " " means: input and , output .
[0224] Among them, the weight update parameters include embedding update parameters and classification update parameters. The process of adjusting the model parameters of the terminal embedding network and the terminal classification network based on the weight update parameters can be: performing a point multiplication operation on the embedding update parameter and the first federated learning update weight to obtain a federated embedding gradient, and adjusting the parameters of the terminal embedding network configured for the target terminal device based on the federated embedding gradient to obtain the federated embedding network corresponding to the target terminal device; performing a point multiplication operation on the embedding update parameter and the second federated learning update weight to obtain a federated classification gradient, and adjusting the parameters of the terminal classification network configured for the target terminal device based on the federated embedding gradient to obtain the federated classification network corresponding to the target terminal device.
[0225] Specifically, the target terminal device can obtain the model update parameters sent by the business server, where the model update parameters include embedded update parameters and classified update parameters. The embedded update parameters are obtained by the business server performing federal aggregation processing on the model parameters of the terminal embedded network in the M terminal devices, and the classified update parameters are obtained by the business server performing federal aggregation processing on the model parameters of the terminal classified network in the M terminal devices.
[0226] It can be understood that when the model parameters of the initial embedded network are secret slices, the target terminal device can obtain the second secret slice generated by other terminal devices to generate embedded update parameters. The process can be: obtain the first embedded slice sent by the business server, and generate a second embedded slice based on the M-1 second secret slices obtained for other terminal devices and the second secret slice for the target terminal device; the other terminal devices are the terminal devices other than the target terminal device among the M terminal devices; perform slice addition operation on the first embedded slice and the second embedded slice to obtain the embedded update parameters.
[0227] Specifically, the target terminal device can obtain the first embedded slice sent by the service server, and based on the M-1 second secret slices for other terminal devices and the second secret slice for the target terminal device, perform a slice addition operation on the M-1 second secret slices for other terminal devices and the second secret slice for the target terminal device to obtain a second sum slice, and perform a slice division operation on the second sum slice based on the number M of terminal devices that share the secret to obtain a second embedded slice. The other terminal devices are terminal devices other than the target terminal device among the M terminal devices. The target terminal device can perform a slice addition operation on the first embedded slice and the second embedded slice to obtain an embedded update parameter.
[0228] It can be understood that the embodiment of the present application performs multi-party secure calculation on the model parameters of the terminal embedded network and the model parameters of the terminal classification network, and sends the obtained first secret shard to the business server to calculate the first embedded shard, and sends the obtained first secret shard to other terminal devices. Since the secret shard satisfies homomorphic encryption, the target terminal device can obtain the second secret shard sent by other terminal devices to calculate the second embedded shard, and perform shard addition operation on the first embedded shard and the second embedded shard to obtain the embedded update parameter. The secret shard cannot independently restore the model parameters of the terminal embedded network and the terminal classification network, which can enhance the security of the model parameters of the terminal embedded network and the model parameters of the terminal classification network, is suitable for distributed systems, and improves the feasibility of federated learning.
[0229] The target terminal device can perform a dot multiplication operation on the embedding update parameter and the first federated learning update weight to obtain a federated embedding gradient. The first federated learning update weight can be a weight pre-set when the target terminal device participates in federated learning, that is, the adjustment weight of the linear embedding network of the target terminal device to the model parameters obtained by this federated learning. The target terminal device can adjust the parameters of the terminal embedding network configured for the target terminal device based on the federated embedding gradient to obtain the federated embedding network corresponding to the target terminal device. The network obtained by performing federated aggregation processing on the model parameters of the M terminal embedding networks can be called a federated embedding network. The federated embedding network is used to extract features from the terminal service data to obtain the first feature vector. The adjustment process can be shown as formula (11):
[0230] Formula (11)
[0231] in, It is used to represent the terminal embedding network obtained by training the terminal device i in the last communication round (the Tth communication round), Update weights for the first federated learning, Update parameters for embedding.
[0232] The target terminal device can perform a dot multiplication operation on the embedding update parameter and the second federated learning update weight to obtain a federated classification gradient. The second federated learning update weight can be a weight pre-set when the target terminal device participates in federated learning, that is, the adjustment weight of the classification network of the target terminal device to the model parameters obtained by this federated learning. The target terminal device can adjust the parameters of the terminal classification network configured for the target terminal device based on the federated embedding gradient to obtain the federated classification network corresponding to the target terminal device. The network obtained by performing federated aggregation processing on the model parameters of the M terminal classification networks can be called a federated classification network. The federated classification network is used to classify and identify the perturbation coding vector to obtain the prediction result. The adjustment process can be shown as formula (12):
[0233] Formula (12)
[0234] in, It is used to represent the terminal embedding network obtained by training the terminal device i in the last communication round (the Tth communication round), Update weights for the first federated learning, Update parameters for embedding.
[0235] Optionally, the federated learning in the embodiment of the present application may include T communication rounds, each communication round may include K iteration rounds, and the training process of each communication round may refer to the specific description of the above steps S301 to S303. In the training process of each iteration round, each terminal device may generate an iteration loss value to adjust the model parameters of the configured initial embedding network and the initial classification network. The model parameter adjustment of each iteration round may be to adjust the initial embedding network and the initial classification network obtained in the previous iteration round. The training process of each iteration round may refer to the specific description of the above step S301. The iteration loss value generated by each terminal device in the Kth iteration training may be determined as the terminal loss value, and each terminal device may send the terminal loss value to the service server respectively. The service server generates a perturbation gradient value through the perturbation value, the model parameters of the initial coding network configured by the service server, and the M terminal loss values. The model parameters of the initial coding network are adjusted once through the perturbation gradient value. The model parameter adjustment of each communication round may be to adjust the perturbation coding network obtained in the previous communication round, which can greatly reduce the communication overhead in terms of calculation and memory. When a certain communication round is reached, it can be determined that the terminal embedded network and the terminal classification network respectively configured by the M terminal devices meet the terminal training convergence conditions. The initial embedded network that meets the terminal training convergence conditions can be called the terminal embedded network, and the initial classification network that meets the terminal training convergence conditions can be called the terminal classification network. The business server can perform federal aggregation processing on the terminal embedded network and the terminal classification network configured by the M terminal devices to obtain a federal embedded network and a federal classification network.
[0236] The embodiment of the present application extracts features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and sends the first feature vector to the service server. The service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the parameter value in the perturbation coding network adds a perturbation value in the symmetrical perturbation direction, so that the intermediate features output by the perturbation coding network will not expose the gradient information of the perturbation coding network. In each communication round, the terminal device only needs to transmit the terminal loss value, and the terminal service data does not need to leave the local area, which can effectively protect data privacy and security. Since the terminal loss value is obtained by the initial classification network classifying and identifying the perturbation coding vector output by the perturbation coding network, the initial embedding network obtained by adjusting the model parameters by the terminal loss value also carries noise (perturbation value), and the first feature vector extracted from the terminal service data by the initial embedding network also carries noise, so that others cannot infer the gradient value of the initial embedding network through the change of the first feature vector, and thus cannot infer the model parameters of the initial embedding network, and cannot restore the terminal service data through the model parameters, further improving the security of the terminal service data. By receiving the perturbation coding vector sent by the service server, the model parameters of the initial embedding network and the initial classification network configured are adjusted based on the received perturbation coding vector and the sample label, and the terminal embedding network and the terminal classification network are obtained; the accuracy of the terminal embedding network and the terminal classification network can be improved by determining the average value of the iterative loss value as the estimated approximate loss value. When the terminal embedding network and the terminal classification network both meet the terminal training convergence condition, the weight update parameter sent by the service server is obtained, and the model parameters of the terminal embedding network and the terminal classification network are adjusted based on the weight update parameter to obtain the federated embedding network and the federated classification network, wherein the weight update parameter is obtained by the service server performing federated aggregation processing on the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by the M terminal devices, and the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are used together to provide classification services for the terminal service data in the target terminal device. In a black box scenario (without directly sharing model parameters and gradient information), the target terminal device can call the interface information output by the perturbation coding network, namely the perturbation coding vector, and output the interface information with added perturbation values for federated learning, thereby achieving privacy protection of the model and improving the feasibility of data security.
[0237] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. Figure 1 .like Figure 6As shown, the data processing device 1 includes a loss acquisition module 610 , a disturbance encoding module 620 , a vector sending module 630 and a federation processing module 640 .
[0238] The loss acquisition module 610 is used to obtain the terminal loss values respectively sent by the M terminal devices, generate a disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjust the model parameters of the initial coding network by the disturbance gradient value to obtain the disturbance coding network; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data, and the target terminal device is any one of the M terminal devices; the prediction result is generated by the initial classification network configured on the target terminal device; M is a positive integer;
[0239] The perturbation coding module 620 is used to obtain the first feature vectors respectively sent by the M terminal devices, perform feature extraction on the M first feature vectors through the perturbation coding network, and obtain the perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are obtained by the M terminal devices respectively extracting the terminal service data held by them through the configured initial embedding network;
[0240] The vector sending module 630 is used to send one perturbation code vector of the M perturbation code vectors to the M terminal devices respectively, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label to obtain the terminal embedding network and the terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device;
[0241] The federation processing module 640 is used to perform federation aggregation processing on the terminal embedding network and the terminal classification network in the M terminal devices when the perturbation coding network meets the training convergence condition, so as to obtain the federation embedding network and the federation classification network corresponding to each terminal device respectively; the perturbation coding network deployed on the service server and the federation embedding network and the federation classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0242] In a possible implementation, the loss acquisition module 610 is used to generate a disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server, and the M terminal loss values, and is specifically used to perform the following operations:
[0243] Random sampling is performed in a real number space having the same dimension as the model parameters of the initial encoding network to obtain a random sampling vector; the random sampling vector obeys a normal distribution;
[0244] A perturbation sampling vector is obtained by performing a dot multiplication operation on the perturbation value and the random sampling vector, a first perturbation parameter and a second perturbation parameter are generated based on the perturbation sampling vector and the model parameters of the initial encoding network, and a perturbation gradient value is generated based on the M terminal loss values, the first perturbation parameter and the second perturbation parameter; the perturbation sampling vector is a vector having the same dimension as the model parameters of the initial encoding network.
[0245] In a possible implementation, the M terminal loss values include a target terminal loss value, and the loss acquisition module 610 is used to generate a disturbance gradient value based on the M terminal loss values, the first disturbance parameter, and the second disturbance parameter, and is specifically used to perform the following operations:
[0246] Performing a point multiplication operation on the target terminal loss value and the first disturbance parameter to obtain a first gradient parameter, performing a point multiplication operation on the target terminal loss value and the second disturbance parameter to obtain a second gradient parameter, and determining the difference between the first gradient parameter and the second gradient parameter as the target gradient parameter;
[0247] Generate a unit loss value corresponding to the target terminal loss value based on the target gradient parameter, the random sampling vector and the perturbation value;
[0248] When the unit loss values corresponding to the M terminal loss values are obtained, the average value of the M unit loss values is multiplied by the training learning rate to obtain the perturbation gradient value.
[0249] In a possible implementation, the M terminal loss values are generated by the M terminal devices in the Tth communication round, where T is a positive integer; the loss acquisition module 610 is used to adjust the model parameters of the initial coding network by the perturbation gradient value, and when the perturbation coding network is obtained, it is specifically used to perform the following operations:
[0250] Generate a first-order moment estimate and a second-order moment estimate of the perturbation gradient value based on the perturbation gradient value; the first-order moment estimate is used to indicate a weighted mean of the perturbation gradient value in T communication rounds, and the second-order moment estimate is used to indicate a weighted variance of the perturbation gradient value in T communication rounds;
[0251] A first update parameter is obtained by performing a point multiplication operation on the training learning rate and the first-order moment estimate, a second update parameter is obtained by performing a point multiplication operation on the arithmetic square root of the second-order moment estimate and the disturbance value, and a parameter update value is generated based on the first update parameter and the second update parameter. The model parameters of the initial coding network are adjusted by the parameter update value to obtain a perturbation coding network.
[0252] In a possible implementation, when the loss acquisition module 610 is used to generate a first-order moment estimation value and a second-order moment estimation value of a disturbance gradient value based on the disturbance gradient value, it is specifically used to perform the following operations:
[0253] Obtain a first communication weight and a second communication weight; the first communication weight is used to represent the weight of the disturbance gradient value of T communication rounds, and the second communication weight is used to represent the weight of the disturbance gradient value of T communication rounds;
[0254] Generate a first-order moment estimation value in the T-th communication round based on the disturbance gradient value in the T-th communication round, the first communication weight, and the first-order moment estimation value generated in the T-1-th communication round;
[0255] A second moment estimation value in the T th communication round is generated based on the disturbance gradient value in the T th communication round, the second communication weight, and the second-order moment estimation value generated in the T-1 th communication round.
[0256] In a possible implementation, the federation processing module 640 is used to perform federation aggregation processing on the terminal embedded networks and the terminal classification networks in the M terminal devices, and when obtaining the federation embedded network and the federation classification network corresponding to each terminal device, specifically to perform the following operations:
[0257] Obtain model parameters of the terminal embedded network in the M terminal devices, perform federation aggregation processing on the model parameters of the M terminal embedded networks, and obtain embedding update parameters corresponding to the M terminal devices respectively; the embedding update parameters are used to send to the corresponding terminal devices, and are used to adjust parameters of the terminal embedded network configured by the corresponding terminal devices, so as to obtain a federated embedded network;
[0258] The model parameters of the terminal classification network in the M terminal devices are obtained, and the model parameters of the M terminal classification networks are federally aggregated to obtain the classification update parameters corresponding to the M terminal devices respectively; the classification update parameters are used to be sent to the corresponding terminal devices, and are used to adjust the parameters of the terminal classification network configured for the corresponding terminal devices to obtain a federal classification network.
[0259] The embodiment of the present application obtains the terminal loss values sent to M terminal devices respectively, generates the disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network through the disturbance gradient value to obtain the disturbance coding network. By adding the disturbance value to the real gradient value, the disturbance gradient value is obtained, thereby protecting the original real gradient. Therefore, the coding network trained based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate features, the intermediate features will also be affected by the disturbance, and the disturbance coding features are obtained, so that others cannot infer the real gradient value through the change of the disturbance coding features, and thus cannot infer the model parameters of the disturbance coding network. By obtaining the first feature vectors sent by M terminal devices respectively, the M first feature vectors are feature extracted through the disturbance coding network, and the disturbance coding vectors corresponding to the M first feature vectors are obtained. One perturbation coding vector among the M perturbation coding vectors is sent to each of the M terminal devices. Each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by itself based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network. When the perturbation coding network meets the training convergence condition, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain the federated embedding network and the federated classification network corresponding to each terminal device. The perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are used together to provide classification services for the terminal service data in the target terminal device. The model training can be carried out jointly by the terminal device and the service server, which can reduce the computing overhead of the terminal device.
[0260] The embodiment of the present application adds a disturbance value to the real gradient value to obtain a disturbance gradient value, thereby protecting the original real gradient. Therefore, the coding network obtained by training based on the disturbance gradient value also has a disturbance effect, so that when the disturbance coding network outputs the intermediate feature, the intermediate feature will also be affected by the disturbance, and the disturbance coding feature is obtained, so that others cannot infer the real gradient value through the change of the disturbance coding feature, and thus cannot infer the model parameters of the disturbance coding network. The terminal device adjusts the model parameters of the initial embedding network and the initial classification network through the disturbance coding feature to obtain the terminal loss value. The service server can add appropriate random disturbance noise (disturbance value) according to the Gaussian distribution to the terminal loss value sent by each terminal device, and effectively approximate the model gradient by calculating the difference of the terminal loss value in the symmetric direction to obtain the disturbance gradient value. The disturbance gradient value is obtained only through function evaluation calculation, and there is no need to perform back-propagation training to calculate the gradient value. It can be applied to black box scenarios, improves the calculation efficiency, does not require complex back-propagation training to calculate the gradient value, and reduces the calculation cost. At the same time, since the perturbation value is a noise value, the perturbation coding network relies on random sampling to estimate the gradient. Through training and learning the perturbation value, it can have good robustness to noise and outliers. By introducing the first-order moment estimate and the second-order moment estimate as momentum terms, it can help accelerate the convergence of model training and reduce the random fluctuations of the perturbation value. The second-order moment estimate helps to adjust the learning rate of each model parameter, so that the learning rate is adaptively adjusted according to the historical gradient changes of the parameter. By calculating the first-order moment estimate and the second-order moment estimate of the perturbation gradient value, the accuracy of the perturbation coding network can be improved while ensuring the security of the gradient information of the perturbation coding network.
[0261] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0262] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. Figure 2 .like Figure 7 As shown, the data processing device 2 includes an embedding processing module 710 , a classification processing module 720 and a terminal processing module 730 .
[0263] The embedding processing module 710 is used to extract features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and send the first feature vector to the service server so that the service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the perturbation coding network is obtained by the service server adjusting the model parameters of the configured initial coding network based on the perturbation gradient value, and the perturbation gradient value is generated after M terminal devices respectively send terminal loss values and perturbation values, and the M terminal devices include a target terminal device; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data; the prediction result is generated by the initial classification network configured on the target terminal device;
[0264] The classification processing module 720 is used to receive the perturbation coding vector sent by the service server, and adjust the model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network;
[0265] The terminal processing module 730 is used to obtain the weight update parameters sent by the service server when both the terminal embedding network and the terminal classification network meet the terminal training convergence conditions, and adjust the model parameters of the terminal embedding network and the terminal classification network based on the weight update parameters to obtain the federated embedding network and the federated classification network; the weight update parameters are obtained by the service server performing federal aggregation processing on the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by the M terminal devices; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0266] In a possible implementation, the terminal processing module 730 is further configured to perform the following operations:
[0267] Sending the model parameters of the terminal embedded network to the service server, sending the model parameters of the terminal classification network to the service server, so that the service server performs federal aggregation processing on the model parameters of the terminal embedded network sent by M terminal devices respectively to obtain embedded update parameters, and performs federal aggregation processing on the model parameters of the terminal classification network sent by M terminal devices respectively to obtain classification update parameters; the embedded update parameters and the classification update parameters are used to send to the M terminal devices;
[0268] The weight update parameters include embedding update parameters and classification update parameters. Model parameter adjustment is performed on the terminal embedding network and the terminal classification network based on the weight update parameters, including:
[0269] Performing a dot multiplication operation on the embedding update parameter and the first federated learning update weight to obtain a federated embedding gradient, and adjusting parameters of the terminal embedding network configured for the target terminal device based on the federated embedding gradient to obtain a federated embedding network corresponding to the target terminal device;
[0270] The embedding update parameter is point-multiplied with the second federated learning update weight to obtain the federated classification gradient. Based on the federated embedding gradient, the terminal classification network configured for the target terminal device is parameter-adjusted to obtain the federated classification network corresponding to the target terminal device.
[0271] In a possible implementation, the classification processing module 720 is used to adjust the model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label, and when the terminal embedding network and the terminal classification network are obtained, specifically to perform the following operations:
[0272] The perturbation coding vector is classified and identified through the initial classification network to obtain a prediction result, and an iterative loss value is generated based on the sample label of the terminal service data and the prediction result. An iterative gradient value is generated based on the iterative loss value, the model parameters of the initial classification network, and the training learning rate, until K iterative gradient values corresponding to the initial embedding network and the initial classification network in K iteration rounds are obtained, and the average value of the K iterative gradient values is determined as the approximate gradient value; K is a positive integer;
[0273] The model parameters of the initial embedding network and the initial classification network are adjusted through the approximate gradient value to obtain the terminal embedding network and the terminal classification network.
[0274] In a possible implementation, when the terminal processing module 730 is used to send the model parameters of the initial embedded network to the service server, it is specifically used to perform the following operations:
[0275] Secretly slicing the model parameters of the initial embedded network to obtain a first secret slice and a second secret slice, and sending the first secret slice to the service server, so that when the service server obtains the first secret slices respectively sent by the M terminal devices, it generates a first embedded slice based on the M first secret slices;
[0276] Also used to perform the following operations:
[0277] Obtaining the first embedded fragment sent by the service server, and generating a second embedded fragment based on the obtained M-1 second secret fragments for other terminal devices and the second secret fragment for the target terminal device; the other terminal device is a terminal device other than the target terminal device among the M terminal devices;
[0278] Perform a slice addition operation on the first embedded slice and the second embedded slice to obtain an embedding update parameter.
[0279] In a possible implementation, the terminal processing module 730 is used to perform secret slicing on the model parameters of the initial embedded network to obtain the first secret slicing and the second secret slicing, and specifically to perform the following operations:
[0280] A stretching factor is determined based on the bit width length of the model parameters of the initial embedded network, and the model parameters of the initial embedded network are encoded by floating point numbers using the stretching factor to obtain a stretched coded value, and the stretched coded value is subjected to arithmetic slicing processing to obtain a first secret slicing and a second secret slicing; the stretched coded value is an element in an integer ring, and the result of a slice addition operation of the first secret slicing and the second secret slicing is the stretched coded value; the second secret slicing is used to provide to other terminal devices.
[0281] The embodiment of the present application extracts features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and sends the first feature vector to the service server. The service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the parameter value in the perturbation coding network adds a perturbation value in the symmetrical perturbation direction, so that the intermediate features output by the perturbation coding network will not expose the gradient information of the perturbation coding network. In each communication round, the terminal device only needs to transmit the terminal loss value, and the terminal service data does not need to leave the local area, which can effectively protect data privacy and security. Since the terminal loss value is obtained by the initial classification network classifying and identifying the perturbation coding vector output by the perturbation coding network, the initial embedding network obtained by adjusting the model parameters by the terminal loss value also carries noise (perturbation value), and the first feature vector extracted from the terminal service data by the initial embedding network also carries noise, so that others cannot infer the gradient value of the initial embedding network through the change of the first feature vector, and thus cannot infer the model parameters of the initial embedding network, and cannot restore the terminal service data through the model parameters, further improving the security of the terminal service data. By receiving the perturbation coding vector sent by the service server, the model parameters of the initial embedding network and the initial classification network configured are adjusted based on the received perturbation coding vector and the sample label, and the terminal embedding network and the terminal classification network are obtained; the accuracy of the terminal embedding network and the terminal classification network can be improved by determining the average value of the iterative loss value as the estimated approximate loss value. When the terminal embedding network and the terminal classification network both meet the terminal training convergence condition, the weight update parameter sent by the service server is obtained, and the model parameters of the terminal embedding network and the terminal classification network are adjusted based on the weight update parameter to obtain the federated embedding network and the federated classification network, wherein the weight update parameter is obtained by the service server performing federated aggregation processing on the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by the M terminal devices, and the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are used together to provide classification services for the terminal service data in the target terminal device. In a black box scenario (without directly sharing model parameters and gradient information), the target terminal device can call the interface information output by the perturbation coding network, namely the perturbation coding vector, and output the interface information with added perturbation values for federated learning, thereby achieving privacy protection of the model and improving the feasibility of data security.
[0282] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0283] See also Figure 8 , Figure 8 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8 As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 8 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.
[0284] In such Figure 8 In the computer device 1000 shown, the network interface 1004 can provide a network communication element; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005.
[0285] When the computer device 1000 is a data processing apparatus 1, the following is achieved:
[0286] The service server obtains the terminal loss values respectively sent by the M terminal devices, generates a disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network by the disturbance gradient value to obtain a disturbance coding network; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data, and the target terminal device is any one of the M terminal devices; the prediction result is generated by the initial classification network configured on the target terminal device; M is a positive integer;
[0287] Obtaining first feature vectors respectively sent by M terminal devices, performing feature extraction on the M first feature vectors through a perturbation coding network, and obtaining perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are respectively extracted by the M terminal devices from the terminal service data held by them through the configured initial embedding network;
[0288] Sending one perturbation code vector of the M perturbation code vectors to the M terminal devices respectively, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label, to obtain a terminal embedding network and a terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device;
[0289] When the perturbation coding network meets the training convergence condition, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain a federated embedding network and a federated classification network corresponding to each terminal device; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0290] When the computer device 1000 is a data processing device 2, the following is achieved:
[0291] The target terminal device extracts features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and sends the first feature vector to the service server, so that the service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the perturbation coding network is obtained by the service server adjusting the model parameters of the configured initial coding network based on a perturbation gradient value, and the perturbation gradient value is generated after M terminal devices respectively send terminal loss values and perturbation values, and the M terminal devices include the target terminal device; the terminal loss value is generated by the target terminal device through a prediction result corresponding to the terminal service data and a sample label corresponding to the terminal service data; the prediction result is generated by an initial classification network configured on the target terminal device;
[0292] Receiving the perturbation coding vector sent by the service server, and adjusting model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain a terminal embedding network and a terminal classification network;
[0293] When both the terminal embedding network and the terminal classification network meet the terminal training convergence condition, the weight update parameters sent by the service server are obtained, and the model parameters of the terminal embedding network and the terminal classification network are adjusted based on the weight update parameters to obtain a federated embedding network and a federated classification network; the weight update parameters are obtained by the service server through federal aggregation processing of the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by M terminal devices; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
[0294] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 3 , Figure 4 and Figure 5 The description of the data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.
[0295] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and when the processor executes the computer program, it can execute the above Figure 3 , Figure 4 and Figure 5The description of the above data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0296] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been displayed or is to be displayed.
[0297] In addition, it should be noted that: the embodiment of the present application also provides a computer program product, the computer program product includes a computer program, the computer program is stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above Figure 3 , Figure 4 and Figure 5 A method provided by any corresponding embodiment.
[0298] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other step units inherent to these processes, methods, devices, products, or equipment.
[0299] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of network elements in the above description. Whether these network elements are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described network elements for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0300] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the process in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide the functions for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0301] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0302] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0303] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, characterized in that: include: The service server obtains the terminal loss values respectively sent by the M terminal devices, generates a disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values, and adjusts the model parameters of the initial coding network by the disturbance gradient value to obtain a disturbance coding network; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data, and the target terminal device is any one of the M terminal devices; the prediction result is generated by the initial classification network configured on the target terminal device; M is a positive integer; Obtaining first feature vectors respectively sent by M terminal devices, performing feature extraction on the M first feature vectors through a perturbation coding network, and obtaining perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are respectively extracted by the M terminal devices from the terminal service data held by them through the configured initial embedding network; Sending one perturbation code vector of the M perturbation code vectors to the M terminal devices respectively, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label, to obtain a terminal embedding network and a terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device; When the perturbation coding network meets the training convergence condition, the terminal embedding network and the terminal classification network in the M terminal devices are federated and aggregated to obtain a federated embedding network and a federated classification network corresponding to each terminal device; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
2. The method according to claim 1, characterized in that The generating of the disturbance gradient value based on the disturbance value, the model parameters of the initial coding network configured by the service server and the M terminal loss values includes: Performing random sampling in a real number space having the same dimension as the model parameters of the initial encoding network to obtain a random sampling vector; the random sampling vector obeys a normal distribution; Perform a point multiplication operation on the disturbance value and the random sampling vector to obtain a disturbance sampling vector, generate a first disturbance parameter and a second disturbance parameter based on the disturbance sampling vector and the model parameters of the initial encoding network, and generate a disturbance gradient value based on M terminal loss values, the first disturbance parameter and the second disturbance parameter; the disturbance sampling vector is a vector having the same dimension as the model parameters of the initial encoding network.
3. The method according to claim 2, characterized in that The M terminal loss values include a target terminal loss value, and generating a disturbance gradient value based on the M terminal loss values, the first disturbance parameter, and the second disturbance parameter includes: Performing a dot multiplication operation on the target terminal loss value and the first disturbance parameter to obtain a first gradient parameter, performing a dot multiplication operation on the target terminal loss value and the second disturbance parameter to obtain a second gradient parameter, and determining a difference between the first gradient parameter and the second gradient parameter as a target gradient parameter; Generate a unit loss value corresponding to the target terminal loss value based on the target gradient parameter, the random sampling vector and the disturbance value; When the unit loss values corresponding to the M terminal loss values are obtained, a point multiplication operation is performed on the average value of the M unit loss values and the training learning rate to obtain a perturbation gradient value.
4. The method according to claim 3, characterized in that The M terminal loss values are generated by the M terminal devices in the Tth communication round, where T is a positive integer; The method of adjusting the model parameters of the initial coding network by perturbing the gradient value to obtain the perturbation coding network includes: Generate a first-order moment estimate and a second-order moment estimate of the disturbance gradient value based on the disturbance gradient value; the first-order moment estimate is used to indicate a weighted mean of the disturbance gradient value in T communication rounds, and the second-order moment estimate is used to indicate a weighted variance of the disturbance gradient value in T communication rounds; Perform a point multiplication operation on the training learning rate and the first-order moment estimate to obtain a first update parameter, perform a point multiplication operation on the arithmetic square root of the second-order moment estimate and the disturbance value to obtain a second update parameter, generate a parameter update value based on the first update parameter and the second update parameter, adjust the model parameters of the initial coding network by the parameter update value, and obtain a perturbation coding network.
5. The method according to claim 4, characterized in that The step of generating a first-order moment estimation value and a second-order moment estimation value of the disturbance gradient value based on the disturbance gradient value comprises: Obtain a first communication weight and a second communication weight; the first communication weight is used to characterize the weight of the disturbance gradient value of T communication rounds, and the second communication weight is used to characterize the weight of the disturbance gradient value of T communication rounds; Generate a first-order moment estimation value in the T-th communication round based on the disturbance gradient value in the T-th communication round, the first communication weight, and the first-order moment estimation value generated in the T-1-th communication round; A second moment estimation value in the T th communication round is generated based on the disturbance gradient value in the T th communication round, the second communication weight, and the second moment estimation value generated in the T-1 th communication round.
6. The method according to claim 1, characterized in that The performing of federation aggregation processing on the terminal embedding networks and the terminal classification networks in the M terminal devices to obtain the federation embedding network and the federation classification network corresponding to each terminal device respectively includes: Acquire model parameters of the terminal embedded network in the M terminal devices, perform federation aggregation processing on the model parameters of the M terminal embedded networks, and obtain embedding update parameters corresponding to the M terminal devices respectively; the embedding update parameters are used to send to the corresponding terminal devices, and are used to adjust parameters of the terminal embedded network configured by the corresponding terminal devices, so as to obtain a federated embedded network; The model parameters of the terminal classification network in the M terminal devices are obtained, and the model parameters of the M terminal classification networks are federally aggregated to obtain classification update parameters corresponding to the M terminal devices respectively; the classification update parameters are used to send to the corresponding terminal devices, and are used to adjust the parameters of the terminal classification network configured for the corresponding terminal devices to obtain a federal classification network.
7. A data processing method, characterized in that: include: The target terminal device extracts features from the terminal service data based on the configured initial embedding network to obtain a first feature vector, and sends the first feature vector to the service server, so that the service server extracts features from the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the perturbation coding network is obtained by the service server adjusting the model parameters of the configured initial coding network based on a perturbation gradient value, and the perturbation gradient value is generated after M terminal devices respectively send terminal loss values and perturbation values, and the M terminal devices include the target terminal device; the terminal loss value is generated by the target terminal device through a prediction result corresponding to the terminal service data and a sample label corresponding to the terminal service data; the prediction result is generated by an initial classification network configured on the target terminal device; Receiving the perturbation coding vector sent by the service server, and adjusting model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain a terminal embedding network and a terminal classification network; When both the terminal embedding network and the terminal classification network meet the terminal training convergence condition, the weight update parameters sent by the service server are obtained, and the model parameters of the terminal embedding network and the terminal classification network are adjusted based on the weight update parameters to obtain a federated embedding network and a federated classification network; the weight update parameters are obtained by the service server through federal aggregation processing of the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by M terminal devices; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
8. The method according to claim 7, characterized in that Also includes: Sending the model parameters of the terminal embedded network to the service server, sending the model parameters of the terminal classification network to the service server, so that the service server performs federation aggregation processing on the model parameters of the terminal embedded network sent by M terminal devices respectively to obtain embedded update parameters, and performs federation aggregation processing on the model parameters of the terminal classification network sent by M terminal devices respectively to obtain classification update parameters; the embedded update parameters and the classification update parameters are used to be sent to the M terminal devices; The weight update parameters include embedding update parameters and classification update parameters, and the adjusting of model parameters of the terminal embedding network and the terminal classification network based on the weight update parameters includes: Performing a point multiplication operation on the embedding update parameter and the first federated learning update weight to obtain a federated embedding gradient, and adjusting parameters of a terminal embedding network configured for the target terminal device based on the federated embedding gradient to obtain a federated embedding network corresponding to the target terminal device; The embedding update parameter is point-multiplied with the second federated learning update weight to obtain a federated classification gradient, and based on the federated embedding gradient, parameters of the terminal classification network configured for the target terminal device are adjusted to obtain a federated classification network corresponding to the target terminal device.
9. The method according to claim 7, characterized in that: The adjusting model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain the terminal embedding network and the terminal classification network includes: The perturbation coding vector is classified and identified by an initial classification network to obtain a prediction result, an iterative loss value is generated based on the sample label of the terminal service data and the prediction result, and an iterative gradient value is generated based on the iterative loss value, the model parameters of the initial classification network, and the training learning rate, until K iterative gradient values corresponding to the initial embedding network and the initial classification network in K iteration rounds are obtained, and the average value of the K iterative gradient values is determined as the approximate gradient value; K is a positive integer; The model parameters of the initial embedding network and the initial classification network are adjusted by using the approximate gradient value to obtain a terminal embedding network and a terminal classification network.
10. The method according to claim 8, characterized in that The sending of the model parameters of the initial embedded network to the service server includes: Secretly slicing the model parameters of the initial embedded network to obtain a first secret slice and a second secret slice, and sending the first secret slice to the service server, so that when the service server obtains the first secret slices respectively sent by the M terminal devices, it generates a first embedded slice based on the M first secret slices; The method further comprises: Obtaining the first embedded fragment sent by the service server, and generating a second embedded fragment based on the obtained M-1 second secret fragments for other terminal devices and the second secret fragment for the target terminal device; the other terminal device is a terminal device other than the target terminal device among the M terminal devices; Perform a slice addition operation on the first embedded slice and the second embedded slice to obtain an embedding update parameter.
11. The method according to claim 10, characterized in that The step of secretly slicing the model parameters of the initial embedded network to obtain a first secret slice and a second secret slice comprises: A stretching factor is determined based on the bit width length of the model parameter of the initial embedded network, and the model parameter of the initial embedded network is encoded by floating point numbers using the stretching factor to obtain a stretched coded value, and the stretched coded value is subjected to arithmetic slicing processing to obtain a first secret slicing and a second secret slicing; the stretched coded value is an element in an integer ring, and the result of a slice addition operation of the first secret slicing and the second secret slicing is the stretched coded value; the second secret slicing is used to provide to the other terminal device.
12. A data processing device, characterized in that: The data processing device is applied to a business server and includes: A loss acquisition module, used to obtain terminal loss values respectively sent by M terminal devices, generate a disturbance gradient value based on a disturbance value, a model parameter of an initial coding network configured by the service server, and the M terminal loss values, and adjust the model parameter of the initial coding network by the disturbance gradient value to obtain a disturbance coding network; the terminal loss value is generated by a target terminal device through a prediction result corresponding to terminal service data and a sample label corresponding to the terminal service data, and the target terminal device is any one of the M terminal devices; the prediction result is generated by an initial classification network configured on the target terminal device; M is a positive integer; A perturbation coding module is used to obtain first feature vectors respectively sent by M terminal devices, perform feature extraction on the M first feature vectors through a perturbation coding network, and obtain perturbation coding vectors respectively corresponding to the M first feature vectors; the M first feature vectors are obtained by extracting the terminal service data held by the M terminal devices respectively through the configured initial embedding network; A vector sending module, used for sending one perturbation code vector of the M perturbation code vectors to the M terminal devices respectively, so that each terminal device adjusts the model parameters of the initial embedding network and the initial classification network configured by each terminal device based on the received perturbation code vector and the sample label to obtain a terminal embedding network and a terminal classification network; the perturbation code vector received by the target terminal device corresponds to the first feature vector extracted by the target terminal device; A federation processing module is used to perform federation aggregation processing on the terminal embedding network and the terminal classification network in the M terminal devices when the perturbation coding network meets the training convergence condition, so as to obtain a federation embedding network and a federation classification network corresponding to each terminal device; the perturbation coding network deployed on the service server and the federation embedding network and the federation classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
13. A data processing device, characterized in that: The data processing device is applied to a target terminal device, and includes: An embedding processing module, used for performing feature extraction on the terminal service data based on the configured initial embedding network to obtain a first feature vector, and sending the first feature vector to the service server so that the service server performs feature extraction on the first feature vector through a perturbation coding network to obtain a perturbation coding vector; the perturbation coding network is obtained by the service server adjusting the model parameters of the configured initial coding network based on a perturbation gradient value, and the perturbation gradient value is generated after M terminal devices respectively send terminal loss values and perturbation values, and the M terminal devices include the target terminal device; the terminal loss value is generated by the target terminal device through the prediction result corresponding to the terminal service data and the sample label corresponding to the terminal service data; the prediction result is generated by the initial classification network configured on the target terminal device; A classification processing module, configured to receive the perturbation coding vector sent by the service server, and adjust the model parameters of the respectively configured initial embedding network and initial classification network based on the received perturbation coding vector and the sample label to obtain a terminal embedding network and a terminal classification network; The terminal processing module is used to obtain the weight update parameters sent by the service server when both the terminal embedding network and the terminal classification network meet the terminal training convergence conditions, and adjust the model parameters of the terminal embedding network and the terminal classification network based on the weight update parameters to obtain a federated embedding network and a federated classification network; the weight update parameters are obtained by the service server performing federal aggregation processing on the model parameters of the initial embedding network and the model parameters of the initial classification network respectively sent by M terminal devices; the perturbation coding network deployed on the service server and the federated embedding network and the federated classification network on the target terminal device are jointly used to provide classification services for the terminal service data in the target terminal device.
14. A computer device, characterized in that: include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method described in any one of claims 1-11.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 11.
16. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium and is suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Method and device for jointly training business models
CN112101946A
Federal learning method and device, equipment and storage medium
CN115841133A
Method and apparatus for detecting ami network intrusion, and medium
WO2023159812A1
