Data processing method, device, system and readable storage medium
By using the model training information of associated client devices on the server side for model training and update, the problem of slow model convergence speed in non-independent and homogeneous data scenarios is solved, and privacy protection and efficient model training are achieved.
Patent Information
- Application Number
- CN202110578585.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-26
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-05-26
AI Technical Summary
The existing technology is difficult to use multiple parties’ privacy data to jointly train models safely and comprehensively while protecting user privacy, especially in non-independent and homogeneous data scenarios, model training convergence speed is slow.
By determining the second client device associated with the first client device on the server side, and using the model training information of the second client device to train the server model of the first client device, obtain the target network model, and send it to The first client device performs model updates to avoid uploading training data, protect user privacy, and speed up model convergence.
It realizes that while protecting user privacy, it safely uses multi-party privacy data for joint training, and improves the model convergence speed in non-independent and homogeneous data scenarios.
Smart Images

Figure CN113297175B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a data processing method, device, system and readable storage medium. Background Art
[0002] With the continuous development of artificial intelligence and the increasing privacy requirements of users, the problem of data islands has gradually come into people's view. Data plays an extremely important role in modeling. More dimensional and richer data is conducive to building more accurate and effective models. However, data is generally distributed among different users. If data is shared, there will be certain privacy and security issues. It can be seen that due to issues such as privacy protection and data barriers, it is difficult to safely and comprehensively use the privacy data of multiple parties to jointly train models while protecting the privacy data of each user. Summary of the invention
[0003] The present application proposes a data processing method, device, system and readable storage medium to improve the above-mentioned defects.
[0004] In the first aspect, an embodiment of the present application provides a data processing method, which is applied to a server of a data processing system, wherein the server is connected to a plurality of client devices, and the plurality of client devices include a first client device. The method comprises: receiving model training information sent by the plurality of client devices, wherein the model training information is network model parameters obtained by each client device using its own data to train the server-side model sent by the server; determining a second client device associated with the first client device; using the model training information of the second client device to train the server-side model corresponding to the first client device to obtain a target network model; sending the model parameters of the target network model to the first client device, and instructing the first client device to update the model corresponding to the first client device using the model parameters of the target network model.
[0005] In the second aspect, an embodiment of the present application provides a data processing method, which is applied to a first client device of a data processing system, and the data processing system also includes a server, and the server is connected to multiple client devices. The method includes: receiving model parameters of a target network model sent by the server, the target network model is the model training information sent by the multiple client devices received by the server, the model training information is the network model parameters obtained by each client device using its own data to train the server model sent by the server, determining a second client device associated with the first client device, and using the model training information of the second client device to train the server model corresponding to the first client device; and using the model parameters of the target network model to update the client model corresponding to the first client device.
[0006] In a third aspect, an embodiment of the present application also provides a data processing device, which is applied to a server of a data processing system, wherein the server is connected to a plurality of client devices, wherein the plurality of client devices include a first client device, and the device includes: a receiving module, a determining module, a training module, and an updating module. Among them, the receiving module is used to receive model training information sent by the plurality of client devices, wherein the model training information is a network model parameter obtained by each client device using its own data to train the server-side model sent by the server. The determining module is used to determine a second client device associated with the first client device. The training module is used to train the server-side model corresponding to the first client device using the model training information of the second client device to obtain a target network model. The updating module is used to send the model parameters of the target network model to the first client device, and instruct the first client device to update the client model corresponding to the first client device using the model parameters of the target network model.
[0007] In a fourth aspect, an embodiment of the present application further provides a data processing system, comprising a server, a first client device, and a second client device; the server comprises one or more processors, a memory, and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the above method; the first client device comprises one or more processors, a memory, and one or more applications, wherein the one or more applications in the first client device are stored in the memory of the first client device and configured to be executed by the one or more processors in the first client device, and the one or more applications in the first client device are configured to execute.
[0008] In a fifth aspect, an embodiment of the present application further provides a computer-readable medium, wherein the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the above method.
[0009] The data processing method, device, system and readable storage medium provided in the embodiment of the present application, when receiving the model training information sent by the client device, by determining the second client device associated with the first client device, and using the model training information of the second client device to train the server model corresponding to the first client device, so as to obtain the target network model, send the model parameters of the target network model to the first client device, and instruct the first client device to update the client model corresponding to the first client device using the model parameters of the target network model. Thus, the present application trains the client model by using the model training information of the client device, because the client device does not need to upload training data, the user's privacy can be protected, and the model training information is the model training information of the second client device associated with the first client device, so the present application can safely and comprehensively use the privacy data of multiple parties to jointly train the client model corresponding to the first client device, and at the same time, because the model training information is the model training information of the second client device associated with the first client device, the client model corresponding to the first client device is updated by using the model training information, which can accelerate the convergence speed of the client model corresponding to the first client device, that is, solve the learning problem of non-independent and identically distributed data.
[0010] Other features and advantages of the embodiments of the present application will be described in the subsequent description, and partly become apparent from the description, or can be understood by practicing the embodiments of the present application. The purposes and other advantages of the embodiments of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0012] Figure 1 A structural schematic diagram of a data processing system is shown;
[0013] Figure 2 A schematic diagram of the structure of a data processing system based on a horizontal federated learning framework is shown;
[0014] Figure 3A schematic diagram of horizontal federated learning data distribution involved in an embodiment of the present application is shown;
[0015] Figure 4 A method flow chart of a data processing method provided by an embodiment of the present application is shown;
[0016] Figure 5 A schematic diagram showing data stored in a first device in a data processing method provided by an embodiment of the present application is shown;
[0017] Figure 6 A schematic diagram showing data stored in a second device in a data processing method provided by an embodiment of the present application is shown;
[0018] Figure 7 A schematic diagram showing data stored in a third device in a data processing method provided by an embodiment of the present application is shown;
[0019] Figure 8 A schematic diagram of data interaction between a server and multiple client devices in a data processing method provided by an embodiment of the present application is shown;
[0020] Fig. 9 A method flow chart of a data processing method provided by another embodiment of the present application is shown;
[0021] Fig.10 A flowchart of step S220 in a data processing method provided by another embodiment of the present application is shown;
[0022] Fig.11 A flowchart of step S240 in a data processing method provided by another embodiment of the present application is shown;
[0023] Fig.12 A method flow chart of a data processing method provided by another embodiment of the present application is shown;
[0024] Fig.13 A method flow chart of a data processing method provided by another embodiment of the present application is shown;
[0025] Fig.14 A structural block diagram of a data processing device provided in an embodiment of the present application is shown;
[0026] Fig.15 A structural block diagram of a data processing system provided by an embodiment of the present application is shown;
[0027] Fig.16 A storage unit provided in an embodiment of the present application and used to store or carry program codes for implementing a data processing method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0028] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0029] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0030] For ease of understanding, the nouns involved in the embodiments of the present application are explained below.
[0031] 1) Artificial Intelligence (AI)
[0032] Artificial intelligence 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.
[0033] 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.
[0034] 2) Machine Learning (ML)
[0035] Machine learning 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 teaching learning.
[0036] 3) Attention
[0037] The attention mechanism imitates the internal process of biological observation behavior, that is, a mechanism that aligns internal experience and external sensation to increase the observation precision of some areas, and can use limited attention resources to quickly filter out high-value information from a large amount of information. The main idea of the attention mechanism is to ignore irrelevant information and focus on key information. If the attention mechanism is classified, it can be divided into hard attention mechanism and soft attention mechanism. The hard attention mechanism refers to the distinction between the attention area and the non-attention area, represented by 1 and 0 respectively, which is mainly used for reinforcement learning; the soft attention mechanism refers to the degree of attention paid to each area, represented by a continuous value between 0 and 1. Using the soft attention mechanism, by integrating channel attention and spatial attention in the three-dimensional convolutional neural network, it is possible to filter out important information.
[0038] 4) Federated Learning
[0039] Federated learning is also known as federated machine learning, joint learning, and alliance learning. Federated learning is a machine learning framework for distributed systems based on cloud technology. In the federated learning architecture, it includes a server and multiple client devices. Each client device stores its own training data locally, and the server and each client device are equipped with models with the same model architecture. Training machine learning models through the federated learning architecture can effectively solve the problem of data silos, allowing participants to jointly model without sharing data, which can technically break data silos and achieve AI collaboration.
[0040] Federated learning can include horizontal federated learning (HFL), vertical federated learning (VFL) and federated transfer learning (FTL). The three elements that constitute federated learning are data source, federated learning system and users. Among them, horizontal federated learning has the same or similar business formats, more feature overlap and less user overlap; vertical federated learning has the same or similar users, less feature overlap and more user overlap; federated transfer learning has less intersection between business formats and users, less feature overlap and less user overlap.
[0041] 5) General Data Protection Regulation
[0042] The General Data Protection Regulation is a new EU privacy and data protection regulation. It requires more detailed privacy protection measures in corporate systems, more detailed data protection agreements, and more user-friendly and detailed disclosures about corporate privacy and data protection practices.
[0043] 6) Cloud Technology
[0044] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which is used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of technical network systems require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.
[0045] 7) Independently Identically Distribution
[0046] Independent and identically distributed means that the probability distribution of each variable in a set of random variables is the same, and these random variables are independent of each other. A set of random variables is independent and identically distributed does not mean that the probability of each event in their sample space is the same. For example, the sequence of results obtained by throwing non-uniform dice is independent and identically distributed, but the probability of each face facing up is not the same.
[0047] With the popularization of 5G technology (5th generation mobile networks) and the continuous upgrading of computing power of mobile Internet devices, mobile terminals have begun to carry more and more complex model calculations, so that different users' needs for different scenarios can be customized. When training a machine learning model, if only the data generated by one user is used to train the model, a high-quality machine learning model cannot be obtained, so it is necessary to combine the data of different users to train the machine learning model. However, with the promulgation of the General Data Protection Regulation (GDPR) and the Data Security Law of the People's Republic of China, the intensity of data protection has been continuously strengthened, so that the problem of data islands continues to trouble people. Although horizontal federated learning can make the data of client devices stored locally instead of being sent out, and can also achieve the effect of model training, the existing horizontal federated learning can only be applied to independent and identically distributed (IID) type scenarios. If non-independent and identically distributed (Non-IID) is encountered, the existing technology cannot solve the above problem well. In the case of non-independent and identically distributed, the convergence speed of model training is slow due to the uniform distribution of data.
[0048] In response to the above problems, the inventors proposed the data processing method, device, system and storage medium provided in the embodiments of the present application. The client model is trained by using the model training information of the client device. Since the client device does not need to upload the training data, the user's privacy can be protected. Moreover, the model training information is the model training information of the second client device associated with the first client device. Therefore, the present application can safely and comprehensively use the privacy data of multiple parties to jointly train the client model corresponding to the first client device. At the same time, since the model training information is the model training information of the second client device associated with the first client device, the client model corresponding to the first client device is updated by using the model training information, which can speed up the convergence speed of the client model corresponding to the first client device, that is, solve the learning problem of non-independent and identically distributed data. Among them, the specific data processing method is described in detail in the subsequent embodiments.
[0049] Figure 1It is a structural diagram of a data processing system according to an exemplary embodiment. The system includes a server 101 and multiple client devices 102. In some scenarios, the server 101 can be called a central server. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0050] The client device 102 may be an electronic device, such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The server 101 and the client device 102 may be directly or indirectly connected via a wired network or a wireless network, and this application does not limit this.
[0051] Optionally, the above-mentioned wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to any combination of local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network or virtual private network. In some embodiments, the data exchanged through the network is represented by technology and / or format including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technology can also be used to replace or supplement the above-mentioned data communication technology.
[0052] The data processing scheme involved in this application can be specifically applied in the scenario of horizontal federated learning, which can also be called feature-aligned federated learning, that is, the data features of the participants in horizontal federated learning are aligned, and horizontal federation can increase the total amount of training samples. It can be seen that horizontal federated learning is mainly an algorithm that can achieve comprehensive use of data while ensuring the privacy of data of all parties when samples with the same characteristics are distributed among different participants.
[0053] Figure 2 This is a schematic diagram of a data processing system based on a horizontal federated learning framework, as shown in an exemplary embodiment. Figure 2 , the data processing system is composed of a server 101 and a plurality of client devices 102, wherein the plurality of client devices 102 may be client device 1, client device 2, client device 3...client device m. The client device 102 at least includes a data storage device 1021, which is used to store data generated by the client device 102 and construct a training data set based on the data. The training data set may be referred to as the data of the client device itself, and the data may be used to train at least one client model 1022. The at least one client model 1022 may be a pre-set learning model. The client model 1022 may be trained based on the data stored in the data storage device 1021, and then the model training information corresponding to each client model 1022 obtained by the training may be uploaded to the server 101. The server 101 merges the model training information uploaded by the client model to obtain the latest network model, and re-sends it to the client device 1022 until the client model in the client device meets the convergence condition, and then stops the model training.
[0054] As an example, Figure 3 This is a schematic diagram of horizontal federated learning data distribution involved in this application. Figure 3The data processing system shown may include multiple client devices, which may be client device 1, client device 2, and client device 3. The data stored in client device 1 is a first data set 11, which includes samples u1 to u3, each of which has feature data including X1 to X4; the data stored in client device 2 is a second data set 12, which includes samples u4 to u6, each of which has feature data including X1 to X4; the data stored in client device 3 is a third data set 13, which includes samples u7 to u9, each of which has feature data including X1 to X4. Through horizontal federated learning, the overall data of federated learning can be expanded to include samples u1 to u9, each of which has feature data including X1 to X4.
[0055] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of a data processing method provided by an embodiment of the present application. In a specific embodiment, the data processing method is applied to Fig.14 The data processing device 500 shown in FIG. Fig.15 The server 610 shown in FIG. Figure 4 The process shown is described in detail, and the data processing method may specifically include steps S110 to S140.
[0056] Step S110: receiving model training information sent by the multiple client devices.
[0057] In the embodiment of the present application, the application scenario of the data processing method can be horizontal federated learning. The method can be applied to Figure 1 and Figure 2 The server of the data processing system shown can be connected to multiple client devices, wherein the multiple client devices can include a first client device, that is, the server can be connected to multiple client devices including the first client device through a wired or wireless network, and the server can send data to the multiple client devices and also receive data transmitted by the multiple client devices.
[0058] In some embodiments, the server may receive model training information sent by multiple client devices, wherein the model training information may be network model parameters obtained by each client device using its own data to train the server-side model sent by the server. Different client devices may store different data, and the features included in these data may be the same or different. If the features included in the data are the same, the server may use the global network model to fuse the model parameters uploaded by each client device, and send the fused model parameters to each client device respectively. In addition, the format corresponding to the data of the client device itself may be an image, a voice, or a text, etc., and the format of the data contained in each client device may be the same. The specific format of the data is not explicitly limited here and can be selected according to actual conditions.
[0059] However, in most cases, different client devices contain different data, and the features contained in these data may also be different. This type of data distribution can be called non-independent and identically distributed. Non-independent and identically distributed is due to the fact that the samples of the data owner correspond to different users, the users are located in different regions, and the time windows of data collection are different. Therefore, when conducting joint training, the data owned by each client device often has different feature distribution or label distribution, and the features are not independent of each other.
[0060] In order to more clearly understand the difference between non-IID and IID, we now give Figures 5 to 7 The diagram shown, Figure 5 The data is stored in the first device, and the data may include a first object 111 and a second object 112, wherein the first object 111 is a dog, and the second object 112 is a cat. Figure 6 is the data stored in the second device, the data includes the third object 113, wherein the third object 113 is a dog. Figure 5 and Figure 6 It can be known that the data contained in the first device and the second device both contain the dog, that is, the data contained in the first client device and the second client device are independent and identically distributed. In addition, Figure 7 The data stored in the third device includes the fourth object 114, the fifth object 115, and the sixth object 116, wherein the fourth object 114, the fifth object 115, and the sixth object 116 together constitute a landscape picture. For example, the fourth object 114 may be a river, the fifth object 115 may be a grassland, and the sixth object 116 may be the sky. The river, the grassland, and the sky may together constitute a landscape picture. Figure 7 The landscape shown, Figure 7 and Figure 5 or Figure 7 and Figure 6Compared with the two types of images, Figure 7 For landscape pictures, Figure 5 or Figure 6 is an animal image, so Figure 5 and Figure 7 or Figure 6 and Figure 7 The data are not independent and identically distributed.
[0061] As a method, when the server obtains network model parameters uploaded by different client devices, if the global model is used to directly fuse the network model parameters uploaded by these client devices, the client models cannot converge, or they can converge but the convergence time of the model will be very long, mainly because these network model parameters are obtained through training with non-independent and identically distributed data. In order to solve this problem, the embodiment of the present application obtains a second client device associated with the first client, and uses the model training information of the second client device to train the server model corresponding to the first client device. Through continuous updating and iteration, the model training information of each client device can be quickly and effectively obtained. The main reason is that using the model training information of non-associated client devices to train the server model corresponding to the first client device will result in slow model training speed, or cause the model to fail to converge, while using the model training information of the second client device associated with the first client device to train the server model corresponding to the first client device can speed up the convergence of the model.
[0062] As an example, if the first client device is associated with the second client device, the model training information of the second client device can be used to train the server model corresponding to the first client device, and if the first client device is not associated with the second client device, the model training information of the second client device is not used to train the server model corresponding to the first client device. The embodiment of the present application can further search for the second client device associated with the first client device. Because the information for training the server model corresponding to the first client device is the model training information of the device associated with the first client device, it can avoid the non-convergence of the model to a certain extent and accelerate the convergence of the model.
[0063] In some embodiments, the model training information sent by the client device may be at least one of model gradient data, model parameters, and a complete client model. If the model training information is a model parameter, each client device may train the server model sent by the server through its own data to obtain a client model. The parameters corresponding to each client model are the model parameters, which may include the weights and offset values of the client model. In addition, after obtaining the client model, the client device may also add random noise to the model parameters of each generated client model through a differential privacy mechanism, and send the model parameters with random noise added to the server as model training information.
[0064] In other implementations, each client device can train the server model sent by the server with its own data, generate an intermediate model gradient, and then send the model gradient to the server as model training information. In addition, when the client device obtains the intermediate model gradient, it can also add random noise to each generated model gradient through the differential privacy mechanism, and send the model gradient with added noise as model training information to the server.
[0065] In other implementations, each client device can train the server model sent by the server with its own data to generate a client model, and then send each client model to the server as model training information. In addition, when the client device obtains the client model, it can also add random noise to the generated client model through the differential privacy mechanism, and send the client model with added noise to the server as model training information.
[0066] In addition, in order to ensure the security of model training information, when the client device obtains model gradient data, model parameters or a complete client model, it can use homomorphic encryption methods to encrypt model gradient data, model parameters or a complete client model, and send the encrypted data to the server as model training information. Homomorphic encryption is a cryptographic technology based on mathematical calculation encryption, which satisfies the exchange law between the four arithmetic operations and encryption operations, that is, for data A, encrypted data B is generated by homomorphic encryption technology, and data addition and subtraction operations are performed on encrypted data B. The result obtained is the same as the result obtained by performing the same addition and subtraction operations on data A and encrypting it. Homomorphic encryption is generally divided into fully homomorphic encryption and semi-homomorphic encryption. Among them, fully homomorphic encryption satisfies both additive homomorphic encryption and multiplicative homomorphic encryption, and semi-homomorphic encryption only satisfies one of them.
[0067] In other embodiments, in order to ensure the security of model training information, when the client device obtains model gradient data, model parameters or a complete client model, it can also use a secure multi-party computing (MPC) method to encrypt the model gradient data, model parameters or a complete client model, and send the encrypted data to the server as model training information. Secure multi-party computing is a distributed computing technology for multi-party collaboration. When multiple data participants perform joint calculations, it ensures that each participant who does not trust each other obtains the required calculation results without leaking the original data information. Secure multi-party computing requires different computing protocols for different applications, including oblivious transfer protocols, secret sharing protocols, etc. Among them, the data participants can be multiple client devices in the embodiments of the present application.
[0068] In some implementations, the server may be deployed with multiple server models, and the number of the multiple server models may be determined according to the number of client devices, that is, the number of server models may be configured in accordance with the number of client devices. For example, if there are three client devices, three server models may be deployed on the server, and each server model corresponds to one client device. Specifically, client device 1 corresponds to server model 1, client device 2 corresponds to server model 2, and client device 3 corresponds to server model 3.
[0069] In other embodiments, the multiple server-side models deployed by the server may be neural network models or mathematical models of the same structure, and the neural network model may include a deep neural network (DNN) model, a recurrent neural network (RNN) model, an embedding model, a gradient boosting decision tree (GBDT) model, etc. The mathematical model includes a linear model, a tree model, etc., which are not listed one by one in this embodiment. It should be noted that the functions of the multiple server-side models deployed by the server are also the same, such as the server-side models are all used for image recognition, or are all used for speech recognition, etc.
[0070] In other implementations, when the server obtains the server model, it may first randomly initialize each model parameter in the server model to obtain an initialized server model, and when issuing model training parameters to each client device of the current horizontal federated learning, the initialized server model is issued to the corresponding client device. For example, the initialized server model 1 is issued to client device 1, the initialized server model 2 is issued to client device 2, the initialized server model 3 is issued to client device 3, and so on.
[0071] As a method, after the server sends multiple initialized server-side models to the corresponding client devices, it can instruct the client devices to train the server-side models using their own data to obtain model training information corresponding to different client devices. From the above introduction, it can be known that the data contained in different client devices is different. For example, the data corresponding to client device 1 is data 1, the data corresponding to client device 2 is data 2, and the data corresponding to client device 3 is data 3.
[0072] Specifically, after receiving the server model 1 sent by the server, the client device 1 can use the data 1 to train the server model 1 to obtain the client model 1, and the client device 1 can upload the model training information 1 corresponding to the client model 1 to the server; after receiving the server model 2 sent by the server, the client device 2 can use the data 2 to train the server model 2 to obtain the client model 2, and the client device 2 can upload the model training information 2 corresponding to the client model 2 to the server; after receiving the server model 3 sent by the server, the client device 3 can use the data 3 to train the server model 3 to obtain the client model 3, and the client device 3 can upload the model training information 3 corresponding to the client model 3 to the server. The above description is only a reference example, and the actual situation shall prevail.
[0073] Step S120: Determine a second client device associated with the first client device.
[0074] In the embodiment of the present application, the first client device may be any one of a plurality of client devices, and a plurality of first client devices may exist at the same time, such as Figure 8In the example diagram shown, client C1 can be used as the first client device, client C2 can also be used as the first client device, etc. In addition, before determining the second client device associated with the first client device, the embodiment of the present application can first obtain the working state of each client device, and then use the client device whose working state meets the preset working state as the first client device, where the working state can be the current power consumption of each client device. For example, when it is determined that the power consumption of the current client device is less than the preset power consumption, the client device can be used as the first client device.
[0075] In another embodiment, the working state of the client device may also include the application currently running on the client device. Specifically, the embodiment of the present application may determine whether the application currently running on the client device is a designated application. If it is a designated application, the client device is not used as the first client device. If the currently running application is not a designated application, the client device may be used as the first client device. For example, if the currently running program is a game program, because the power consumption of the game program is usually relatively large, when determining that the client device is running the game program, the client device is not used as the first client device. In addition, the designated application may be set by the user according to his own needs, or it may be pre-set by the client device before leaving the factory.
[0076] In other embodiments, when there are multiple client devices whose working status meets the preset working status, the embodiment of the present application can use all of the multiple client devices as first client devices, and then obtain the second client devices associated with each first client device respectively. It should be noted that the embodiment of the present application can obtain the second client devices associated with each first client device in parallel, and can also obtain the second client devices associated with each first client device in series. Specifically, the server can simultaneously obtain the second client devices associated with each first client device, and then use the model training information of each second client device to train the server-side model corresponding to each first client device, and obtain multiple target network models. Alternatively, the server can also traverse each first client device separately until all first client devices are traversed, and then terminate the data processing.
[0077] In some embodiments, the second client device may be a client device other than the first client device that is associated with the first client device, wherein the association may be that the types of data stored by the first client device and the data stored by the second client device are similar, and the similarity in type may be that the subject type of the data stored by the first client device and the subject type of the data stored by the second client device are similar. Specifically, the embodiment of the present application may determine whether the data tag stored by the first client device is similar to the data tag stored by the second client device. If they are similar, it indicates that the first client device is associated with the second client device. For example, client C1 is the first client device, and the subject type of the data stored by it is animals, the subject type of the data stored by client C2 is scenery, and the subject type of the data stored by client C3 is animals. At this time, client C3 can be called the second client device associated with client C1.
[0078] In the embodiment of the present application, the number of second client devices associated with the first client device may be one or more, or may not exist, and the non-existence means that there is no second client device associated with the first client device in the current time period. If it is determined that there is no second client device associated with the first client device in the current time period, the embodiment of the present application may continue to detect, that is, determine whether there is a second client device associated with the first client device at the next moment.
[0079] Specifically, the embodiment of the present application can detect the update of the data corresponding to other client devices, and when it is determined that the data of other client devices is updated, it is re-determined whether there is a second client device associated with the first client device. The main reason for the above situation is that the data of different client devices will continue to change with the user's habit of using the client device. For example, the user of client C1 likes landscape pictures in the first time period, but likes animal pictures in the second time period, which will also cause the data to change continuously with the user's preferences.
[0080] In some embodiments, when the server receives model training information sent by multiple client devices, it can determine the second client device associated with the first client device. Specifically, the embodiment of the present application can determine the second client device associated with the first client device based on the model training information, or can determine the second client device associated with the first client device based on different categories of client devices, or can determine the second client device associated with the first client device based on the geographical locations between the client devices, etc.
[0081] In the embodiment of the present application, the server can determine the second client devices associated with different client devices in parallel. Specifically, the server simultaneously treats all client devices as first client devices, and then determines the second client devices associated with each first client device respectively. For example, the second client device associated with client C1 is determined in parallel, the second client device associated with client C2 is determined in parallel, the second client device associated with client C3 is determined in parallel, and so on.
[0082] In addition, the server may also determine the second client devices associated with different client devices in series, such as first determining the second client device associated with client C1, then determining the second client device associated with client C2, and then determining the second client device associated with client C3, etc. The specific method for determining the second client devices associated with different client devices will not be described in detail here, and can be selected according to actual conditions.
[0083] Step S130: Use the model training information of the second client device to train the server model corresponding to the first client device to obtain a target network model.
[0084] In some embodiments, after the server obtains the second client device associated with the first client device, it can use the model training information of the second client device to train the server-side model corresponding to the first client device to obtain the target network model. Specifically, the server can first determine whether the number of second client devices is multiple. If the number of second client devices is multiple, the server-side model corresponding to the first client device is trained using the model training information of the second client device to obtain the weight values corresponding to different model training information, and then the average value of the model training information of the second client device can be obtained by weighted averaging, and finally the average value of the model training information is used as the network model parameter of the target network model.
[0085] As a method, if the model training information of the second client device is gradient information, the server can use a weighted average method to calculate the average value of the gradient values in each gradient information, and use the result as the parameter update of the server model corresponding to the first client, that is, the average value of the gradient values in each gradient information is used as the gradient value of the target network model. If the model training information of the second client device is model parameter information, the server can use a weighted average method to calculate the average value of the model parameters in each model parameter information, and use the result as the parameter update of the server model corresponding to the first client, that is, the average value of the model parameters in each model parameter information is used as the model parameter of the target network model.
[0086] Optionally, the weights of each second client device used in the weighted average algorithm can be set in advance according to specific needs. For example, the weights can be set according to the data volume ratio of the local training data of each participating device, and a participating device with a larger data volume is set with a higher weight. In addition, the weight can also be determined according to the association degree between the second client device and the first client device. The greater the association degree between the second client device and the first client device, the greater the corresponding weight value can be.
[0087] From the above introduction, it can be known that the first client device can be any one of the multiple client devices, that is, each client device in the embodiment of the present application can be used as the first client device, and can also be used as the second client device of other client devices. Therefore, the target network model finally obtained can also be multiple, that is, each first client device can correspond to a target network model. If the server obtains multiple target network models, the model parameters of the target network model can be sent to the first client device corresponding to it, and the first client device is instructed to use the model parameters of the target network model to update the client model corresponding to the first client device, that is, enter step S140.
[0088] Step S140: sending the model parameters of the target network model to the first client device, and instructing the first client device to update the client model corresponding to the first client device using the model parameters of the target network model.
[0089] In an embodiment of the present application, after acquiring the target model, the server may send the model parameters of the target network model to the first client device, and instruct the first client device to update the client model corresponding to the first client device using the model parameters of the target network model, wherein the client model corresponding to the first client device may be referred to as the first client model, and the first client model may be a model stored by the first client device. In other words, the client model corresponding to the first client device is mainly a model obtained by the first client device after receiving the server model sent by the server by training the server model using its own data.
[0090] Specifically, the server can instruct the first client device to use its own data to iteratively train the client model corresponding to the first client device, and during the training process, the first client device can use the model parameters of the target network model to optimize the client model corresponding to the first client device. The client model corresponding to the first client device is the model corresponding to the model training information sent by the first client device. In addition, the model parameters of the target network model can be the weights, deviations, and losses of the target network model, and the model parameters can also be the gradient of the target network model. Optionally, the embodiment of the present application can also directly send the target network model to the first client device.
[0091] In other embodiments, in order to ensure the security of the data, before the server obtains the model parameters of the target network model and sends them to the client model corresponding to the first client device, it may first encrypt the model parameters of the target network model, and then send the encrypted model parameters to the first client device. Specifically, the embodiment of the present application may encrypt the model parameters of the target network model using a homomorphic encryption method, and send the encrypted model parameters to the first client device. In addition, the embodiment of the present application may also encrypt the model parameters of the target network model using differential privacy. The specific method for encrypting the model parameters of the target network model is not explicitly limited here and can be selected according to actual conditions.
[0092] A data processing method proposed in an embodiment of the present application, when receiving model training information sent by a client device, determines a second client device associated with a first client device, and uses the model training information of the second client device to train the server model corresponding to the first client device to obtain a target network model, sends the model parameters of the target network model to the first client device, and instructs the first client device to update the client model corresponding to the first client device using the model parameters of the target network model. Thus, the present application trains the client model by using the model training information of the client device, because the client device does not need to upload training data, the user's privacy can be protected, and the model training information is the model training information of the second client device associated with the first client device, so the present application can safely and comprehensively use the privacy data of multiple parties to jointly train the client model corresponding to the first client device, and at the same time, because the model training information is the model training information of the second client device associated with the first client device, the client model corresponding to the first client device is updated by using the model training information, which can accelerate the convergence speed of the client model corresponding to the first client device, that is, solve the learning problem of non-independent and identically distributed data.
[0093] Another embodiment of the present application provides a data processing method. Fig. 9 , the data processing method may include steps S210 to S260.
[0094] Step S210: receiving model training information sent by the multiple client devices.
[0095] Step S220: Determine a second client device associated with the first client device.
[0096] In some embodiments, the server may obtain the second client device associated with the first client device by utilizing the attention mechanism. Fig.10 ,pass Fig.10 It is known that step S220 may include steps S221 to S223.
[0097] Step S221: Use the attention mechanism to determine the information difference between the model training information of the first client device and the model training information of each of the other client devices.
[0098] As one approach, an embodiment of the present application may utilize an attention mechanism to determine the information difference between the model training information of the first client device and the model training information of each other client device, and the information difference may be the gap value between the model information of the other client devices and the model information of the first client device. If the model training information is a model parameter, the server may determine the information difference between the model parameters of the first client device and the model parameters of the other client devices. For example, obtain the difference between the weight of the client model corresponding to the first client device and the weight of the other client models, and use the difference as the information difference. As another approach, if the model training information is a gradient value, the server may determine the information difference between the gradient value of the first client device and the gradient value of the other client devices.
[0099] In the embodiment of the present application, the function of the attention mechanism can be:
[0100]
[0101] Among them, A represents the attention function, w i represents the model training information of the first client device, w j represents the model training information of other client devices, σ is a constant, and '=' represents equality, that is, the attention function is equal to In addition, σ may be a hyperparameter, which may be set by the user according to the training conditions of the model.
[0102] Step S222: determining the association degree between the first client device and each of the other client devices according to the information difference.
[0103] In an embodiment of the present application, if the server obtains the information difference between the model training information of the first client device and the model training information of each other client device, it can determine the correlation between the first client device and each other client device based on the information difference. The larger the information difference, the greater the difference between the first client device and the other clients, and the smaller the information difference, the smaller the difference between the first client device and the other client devices.
[0104] In the embodiment of the present application, the greater the information difference between the first client device and the other client devices, the smaller the correlation between the first client device and the other client devices, and the smaller the information difference between the first client device and the other client devices, the greater the correlation between the first client device and the other client devices.
[0105] In some embodiments, after the server determines the association degree between the first client device and each other client device according to the information difference, it can determine whether the association degree between the first client device and the other client devices meets the preset condition. If it meets the preset condition, the other client devices that meet the preset condition are used as the second client device, that is, entering step S223, wherein the preset condition may be that the association degree is greater than the preset association degree. In addition, if the association degree is less than the preset association degree, the client device corresponding to the association degree may not be used as the second client device.
[0106] Step S223: If the association between the first client device and other client devices meets the preset condition, the other client devices meeting the preset condition are used as second client devices.
[0107] Step S230: If there are multiple second client devices, obtain the association degree between each of the second client devices and the first client device.
[0108] Step S240: acquiring target training information according to the degree of association and the model training information of the second client device.
[0109] In some other embodiments, see Fig.11 , obtaining target training information according to the correlation degree and the model training information of the second client device may include steps S241 to S242.
[0110] Step S241: assigning a corresponding weight to each second client device according to the degree of association between each second client device and the first client device, wherein the weight is positively correlated with the degree of association.
[0111] In some embodiments, after determining the second client device associated with the first client device, the embodiment of the present application can assign a corresponding weight to each second client device according to the degree of association between each second client device and the first client device, wherein the weight is positively correlated with the degree of association, and the weights assigned to different second client devices can be different or the same, that is, when there are multiple second client devices with the same degree of association with the first client device, the weights of the multiple second client devices can be the same. In some embodiments, the weights can be assigned by the server using an attention mechanism.
[0112] Specifically, when the server obtains the model training information sent by multiple client devices, the server can input the model training information into the weight acquisition model, which can take the model training information of each client device as input and then output the weight values of other client devices compared to the first client device. i When it is the first client device, the client devices associated with it may include client C1, client C2, and client C m , client C1 is better than client C i The weight value can be β i,1 , client C2 is better than client C i The weight value can be β i,2 , client C3 compared to client C i The weight value can be β i,3 , client C m Compared with client C i The weight value can be β i,m It can be seen that if the first client device is different, then the other client devices associated with it are also different, and the association degree between the other client devices and the first client device is also different.
[0113] In the embodiment of the present application, the formula corresponding to the weights of other client devices associated with the first client device can be: Among them, α k represents the step size of gradient descent, A represents the attention function, and w i represents the model training information corresponding to the first client device, w j It represents the model training information of other client devices associated with the first client device.
[0114] In other embodiments, the greater the association between other client devices and the first client device, the greater the corresponding weight value β will be, that is, the more similar the model training information of other client devices is to the model training of the first client device, the greater the corresponding β value will be, and the greater the contribution of the model training information of the client device to the target network model, that is, similar client devices jointly participate in updating the server model. In addition, if other client devices are not associated with the first client device, or the association is very small, the corresponding weight value β can be approximately 0.
[0115] In the embodiment of the present application, the main reason for the different associations between other client devices and the first client device is that the data of each client device is different. The difference may be that the data category or data type contained in the data is different. For example, the data in client C1 is mainly animals, the data in client C2 is mainly people, and the data in client C i The data in the database is mainly animals. If client C i As the first client, since the data in the client C1 is similar to its own data, the client C1 can be called the second client device associated with the first client device, while the client C2 cannot be used as the second client device because the data stored in the client C2 is not related to the first client device.
[0116] It should be noted that the second client device associated with the first client device may change with the change of the data of each client device. For example, the client device associated with the first client device in the first time period is client C1, and the client device associated with the first client device in the second time period may become client C2.
[0117] Step S242: Obtain the target training information according to the weight of each of the second client devices and the model training information.
[0118] In some implementations, after obtaining the weight corresponding to each second client device, the embodiment of the present application can obtain the target training information according to the weight of each second client device and the model training information. Specifically, the server can obtain the target training information by weighted summation, and the model corresponding to the target training information is the target network model, wherein the target network model can be the network model corresponding to the first client device.
[0119] As an example, the target training information can be The model training information of the second client device associated with the first client device can be respectively as well as etc., and the weights corresponding to the second client device are β i,1 , βi,2 and β i,m (excluding β i,i ), the final target training information Can be equal to Among them, β i,1 +β i,2 +…+β i,m =1.
[0120] Step S250: Use the target training information to train the server model corresponding to the first client device to obtain a target network model.
[0121] In the embodiment of the present application, the target network model carries the task of docking and iteratively updating the client model, and the target network model is also the current expression of the client model corresponding to all second client devices associated with the first client device. Therefore, the target network model can be regarded as an information sensor between the server and different clients.
[0122] Step S260: Send the model parameters of the target network model to the first client device, and instruct the first client device to update the client model corresponding to the first client device using the model parameters of the target network model.
[0123] In summary, the embodiment of the present application deploys different server-side models on the server, adaptively selects a second client device similar to the first client device based on the attention mechanism, and uses the model training information of the second client device to update the server-side model corresponding to the first client device to obtain the target network model, and then uses the target network model and the data of the first client device to iterate the client model corresponding to the first client device, thereby effectively solving the problem of non-independent and identically distributed data in horizontal federated learning. Therefore, the embodiment of the present application uses the attention mechanism to bind similar user groups together to update the server-side model, and the client model is updated and iterated based on the server-side model, so that horizontal federated learning can be achieved to train the client model with similarly distributed data, which speeds up the convergence of the client model.
[0124] Another embodiment of the present application provides a data processing method. Fig.12 , the data processing method may include steps S310 to S360.
[0125] Step S310: receiving model training information sent by the multiple client devices.
[0126] Step S320: Determine a second client device associated with the first client device.
[0127] Step S330: Use the model training information of the second client device to train the server model corresponding to the first client device to obtain a target network model.
[0128] Step S340: sending the model parameters of the target network model to the first client device, and instructing the first client device to update the client model corresponding to the first client device using the model parameters of the target network model.
[0129] In some embodiments, when the server obtains the target network model, it can send the model parameters of the target network model to the first client device, and instruct the first client device to update the client model corresponding to the first client device using the model parameters of the target network model. It can also send the model parameters of the target network model to the first client device and the second client device associated with the first client device at the same time, and instruct the first client device and the second client device to update their respective stored client models using the model parameters of the target network model. Specifically, it can instruct the first client to update the client model corresponding to the first client device using the model parameters of the target network model, and instruct the second client device to update the second client model using the model parameters of the target network model.
[0130] In other embodiments, when the client devices use the model parameters of the target network model to update their respective client models, the client models can be trained in combination with the model parameters of the target network model and their respective data. Therefore, using the model parameters of the target network model to update the client model corresponding to the first client device can satisfy the following formula.
[0131]
[0132] in, represents the client model corresponding to the first client device, It represents the loss of the client model corresponding to the first client device under the premise of considering its own data. Represents the target network model The regular interaction of the first client device can make the client model corresponding to With the target network model More and more similar, that is, the client model corresponding to the first client device It is mainly based on the similar users obtained by the attention mechanism through the target network model Update obtained.
[0133] In some embodiments, after sending the model parameters of the target network model to the first client device and instructing the first client device to update the client model corresponding to the first client device using the model parameters of the target network model, the server can receive update information sent by at least one client device, and enter step S350.
[0134] Step S350: receiving update information sent by at least one client device, wherein the update information is a network parameter corresponding to a client model stored in at least one of the client devices.
[0135] In an embodiment of the present application, the server sends the model parameters of the target network model to the first client device, and can instruct the first client device to update the client model corresponding to the first client device of the first client device using the model parameters of the target network model to obtain update information. In other words, the server can receive update information sent by at least one client device, wherein the update information is the network parameters corresponding to the client model stored in at least one client device. In addition, the at least one client device can be the first client device, or the first client device and the second client device, or all client devices connected to the server.
[0136] Step S360: If it is determined according to the update information that the client model corresponding to the first client device meets the convergence condition, the update operation on the client model corresponding to the first client device is stopped.
[0137] In some embodiments, at least one client device may be a first client device, and the convergence condition at this time may be that the loss value of the client model corresponding to the first client device is less than a first loss value. Specifically, the loss value of the client model corresponding to the first client device is obtained according to the update information sent by the first client device. If the loss value of the client model corresponding to the first client device is less than the first loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and the update operation of the client model corresponding to the first client device is stopped.
[0138] In addition, if at least one client device is a first client device, the embodiment of the present application can also obtain the number of updates of the client model corresponding to the first client device, that is, count the number of iterations of the client model corresponding to the first client device, and then determine whether the number of iterations is less than the preset number of iterations. If the number of iterations of the client model corresponding to the first client device is less than the preset number of iterations, it is determined that the client model corresponding to the first client device meets the convergence conditions, and the update operation of the client model corresponding to the first client device is stopped.
[0139] Optionally, the embodiment of the present application may also determine whether the network parameters of the client model corresponding to the first client device are unchanged. If unchanged, it is determined that the client model corresponding to the first client device meets the convergence condition. The embodiment of the present application may also obtain the training time of the client model corresponding to the first client device, and determine whether the training time is greater than the preset training time. If the training time of the client model corresponding to the first client device is greater than the preset training time, it is determined that the client model corresponding to the first client device meets the preset condition. It should be noted that the embodiment of the present application may use any of the above convergence conditions to determine whether the client model corresponding to the first client device converges, or may combine at least two of the above convergence conditions to determine whether the client model corresponding to the first client device converges, so that the client model corresponding to the first client device obtained last may be more accurate. For example, the server may first determine whether the training time of the client model corresponding to the first client device is greater than the preset training time. If less than, it may continue to determine whether the loss of the client model corresponding to the first client device is less than the preset loss. If less than, it indicates that the client model corresponding to the first client device converges. The specific combination of which convergence conditions is not explicitly limited here and can be selected according to actual conditions.
[0140] In other embodiments, at least one client device may include all client devices, and each client device may correspond to a client model. In this case, the convergence condition may be that the target loss value is less than the second loss value, wherein the target loss value may be obtained based on the loss values of all client models. Specifically, the loss value of each client model is obtained based on the update information sent by all the client devices, and the target loss value is obtained based on the loss values of all the client models. If the target loss value is less than the second loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and the update operation of the client model corresponding to the first client device is stopped. The target loss value may be the sum of the loss values of all client models, or the average of the loss values of all client models.
[0141] In other embodiments, at least one client device may include all client devices, wherein all client devices include a first client device and multiple other client devices, and each client device corresponds to a client model. At this time, the convergence condition may be that the sum of the target loss value and the target association is less than a third loss value, wherein the target loss value may be the sum of the loss values of all client models, and the target association may be the sum of the associations between the first client device and each other client device. Specifically, the loss value of each client model is obtained according to the update information sent by all the client devices, and the sum of the loss values of all the client models is used as the target loss value. The association between the first client device and each other client device is obtained according to the attention mechanism, and the multiple associations are summed to obtain the target association. If the sum of the target loss value and the target association is less than the third loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and the update operation of the client model corresponding to the first client device is stopped.
[0142] Optionally, the formula corresponding to the convergence condition can be:
[0143]
[0144] Among them, G(W) is the total loss value of multiple client models, is the target loss value, λ represents the regularization coefficient, represents the target relevance, A represents the attention function, and w i represents the model training information of the first client device, w j represents the model training information of other client devices, m represents the number of client devices, and L is the third loss value. In addition, F represents the loss function corresponding to machine learning, which can be a cross entropy. The cross entropy is mainly used to measure the performance of the network model. The output of the network model is a probability value between 0 and 1.
[0145] From the above introduction, it can be known that if the model training information of other client devices is more similar to the model training information of the first client device, the value of A(·) is close to 0. On the contrary, if the model training information of other client devices is very different from the model training information of the first client device, A(·) is close to 1. In order to optimize G(W), the embodiment of the present application can alternately optimize A(·) and F(·) until G(W) converges or reaches the maximum number of iterations K set this time, and then stop training. Among them, the formula for optimizing A(·) can be as follows.
[0146]
[0147] Among them, α k represents the step size of gradient descent, It represents the partial derivative of A(·). By using this formula, the application can continuously optimize the server model, and then obtain the client model more quickly and effectively.
[0148] In the embodiment of the present application, It represents the interaction between all client models and server models, which can also be called a regular term. The regular term is also called a penalty term, which is used to punish the situation where the model is too complex due to excessive weights. The larger the regularization coefficient, the stronger the penalty effect of the regularization term. The regularization coefficient is used to balance the degree of fit of the training data and the complexity of the model itself. If the regularization coefficient is too large, the model may be relatively simple, but there is a risk of underfitting. The model may not have learned some characteristics in the training data, and the prediction may not be accurate. If the regularization coefficient is too small, the model will be more complex, but there is a risk of overfitting. The embodiment of the present application introduces It can not only avoid the overfitting problem but also improve the accuracy of model training.
[0149] In other embodiments, at least one client device may be a first client device and a second client device associated with the first client device, the second client device corresponds to a second client model, and there may be multiple second client devices. At this time, the convergence condition may be that the target loss value is less than a fourth loss value, wherein the target loss value may be obtained based on the loss values of the client model corresponding to the first client device and the client model corresponding to the second client device. Specifically, the loss values of the client model corresponding to the first client device and the client model corresponding to the second client device are obtained based on the update information sent by the first client device and the second client device, and the target loss value is obtained based on the loss values of the client model corresponding to the first client device and the client model corresponding to the second client device. If the target loss value is less than the fourth loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and the update operation of the client model corresponding to the first client device is stopped. The target loss value may be the sum of the loss values of the client model corresponding to the first client device and the client model corresponding to the second client device.
[0150] A data processing method proposed in an embodiment of the present application, when receiving model training information sent by a client device, determines a second client device associated with a first client device, and uses the model training information of the second client device to train the server model corresponding to the first client device to obtain a target network model, sends the model parameters of the target network model to the first client device, and instructs the first client device to update the client model corresponding to the first client device using the model parameters of the target network model. Thus, the present application trains the client model by using the model training information of the client device, because the client device does not need to upload training data, the user's privacy can be protected, and the model training information is the model training information of the second client device associated with the first client device, so the present application can safely and comprehensively use the privacy data of multiple parties to jointly train the client model corresponding to the first client device, and at the same time, because the model training information is the model training information of the second client device associated with the first client device, the client model corresponding to the first client device is updated by using the model training information, which can accelerate the convergence speed of the client model corresponding to the first client device, that is, solve the learning problem of non-independent and identically distributed data. In addition, the embodiment of the present application alternately optimizes the server model and the client model, and selects the second client device associated with the first client device based on the attention mechanism in each iteration to cooperate in updating the server model corresponding to the first client device. Subsequently, the first client device can update the client model corresponding to the first client device based on its own data and the model parameters of the target network model sent by the server, thereby quickly realizing the adaptive iterative update of the client model based on the distribution characteristics of non-independent and identically distributed data in different periods. In addition, the embodiment of the present application can determine the convergence conditions of the first client device in different ways, which increases the flexibility of model training.
[0151] An embodiment of the present application provides a data processing method, which can be applied to a first client device of a data processing system, wherein the data processing system further comprises a server, and the server is connected to a plurality of client devices, see Fig.13 , the data processing method may include steps S410 to 420.
[0152] Step S410: receiving the model parameters of the target network model sent by the server.
[0153] In an embodiment of the present application, the target network model is obtained by training the server model corresponding to the first client device using the model training information of the second client device associated with the first client device when the server receives model training information sent by multiple client devices, wherein the model training information is the network model parameters obtained by each client device using its own data to train the server model sent by the server.
[0154] Step S420: using the model parameters of the target network model to update the client model corresponding to the first client device.
[0155] As a method, when the client device receives the model parameters of the target network model sent by the server, it can use the model parameters to update the client model corresponding to the first client device.
[0156] A data processing method proposed in an embodiment of the present application, wherein a client device updates a client model corresponding to a first client device by acquiring model parameters of a target network model sent by a server. Because the target network model sent by the server is acquired by the server by utilizing model training information of a second client device associated with the first client device, the client model corresponding to the first client device finally acquired is more accurate and has better effects. In addition, the embodiment of the present application updates the client model corresponding to the first client device by utilizing model training information of the second client device associated with the first client device, which can accelerate the convergence speed of the client model corresponding to the first client device to a certain extent.
[0157] See also Fig.14 The embodiment of the present application provides a data processing device 500, which can be applied to a server of a data processing system, and the server can be connected to multiple client devices, wherein the multiple client devices include a first client device. In a specific embodiment, the data processing device 500 includes: a receiving module 510, a determining module 520, a training module 530, and an updating module 540.
[0158] The receiving module 510 is used to receive the model training information sent by the multiple client devices, where the model training information is the network model parameters obtained by each client device using its own data to train the server model sent by the server.
[0159] The determination module 520 is configured to determine a second client device associated with the first client device.
[0160] Furthermore, the multiple client devices include multiple other client devices, and the other client devices are multiple client devices other than the first client device. The determination module 520 is also used to determine the information difference between the model training information of the first client device and the model training information of each of the other client devices by using the attention mechanism, and the information difference is used to characterize the difference between the data in the multiple client devices; determine the association between the first client device and each of the other client devices based on the information difference; if the association between the first client device and the other client devices meets the preset conditions, the other client devices that meet the preset conditions are used as second client devices.
[0161] The training module 530 is used to train the server model corresponding to the first client device using the model training information of the second client device to obtain a target network model.
[0162] Furthermore, the training module 530 is also used to obtain the correlation between each of the second client devices and the first client if there are multiple second client devices; obtain target training information based on the correlation and the model training information of the second client device; and use the target training information to train the server model corresponding to the first client device to obtain a target network model.
[0163] Furthermore, the training module 530 is also used to assign a corresponding weight to each second client device according to the degree of association between each second client device and the first client, and the weight is positively correlated with the degree of association; and obtain the target training information according to the weight of each second client device and the model training information.
[0164] The updating module 540 is used to send the model parameters of the target network model to the first client device, and instruct the first client device to update the client model corresponding to the first client device using the model parameters of the target network model.
[0165] Furthermore, the update module 540 is also used to encrypt the model parameters of the target network model and send the encrypted model parameters to the first client device. Wherein, encrypting the model parameters of the target network model and sending the encrypted model parameters to the first client device includes: encrypting the model parameters of the target network model using a homomorphic encryption method, and sending the encrypted model parameters to the first client device.
[0166] Furthermore, the data processing device 500 is also used to obtain the working status of each of the client devices before determining the second client device associated with the first client device, and use the client device whose working status meets the preset working status as the first client device.
[0167] Furthermore, the data processing device 500 is also used to receive update information sent by at least one client device, where the update information is network parameters corresponding to a client model stored in at least one of the client devices; if it is determined based on the update information that the client model corresponding to the first client device meets the convergence conditions, the update operation of the client model corresponding to the first client device is stopped.
[0168] Furthermore, at least one client device may be a first client device, and the data processing device 500 is further used to obtain a loss value of a client model corresponding to the first client device based on update information sent by the first client device; if the loss value of the client model corresponding to the first client device is less than the first loss value, it is determined that the client model corresponding to the first client device meets the convergence conditions, and the update operation of the client model corresponding to the first client device is stopped.
[0169] Furthermore, at least one client device may include all client devices, each of which corresponds to a client model, and the data processing device 500 is also used to obtain the loss value of each client model based on the update information sent by all the client devices; obtain the target loss value based on the loss values of all the client models; if the target loss value is less than the second loss value, it is determined that the client model corresponding to the first client device meets the convergence conditions, and then the update operation of the client model corresponding to the first client device is stopped.
[0170] Furthermore, at least one client device includes all the client devices, and the all client devices include a first client device and multiple other client devices, each of the client devices corresponds to a client model, and the data processing device 500 is also used to obtain the loss value of each of the client models based on the update information sent by all the client devices, and take the sum of the loss values of all the client models as the target loss value; obtain the correlation between the first client device and each of the other client devices according to the attention mechanism, and sum the multiple correlations to obtain the target correlation; if the sum of the target loss value and the target correlation is less than the third loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and then the update operation of the client model corresponding to the first client device is stopped.
[0171] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0172] A data processing device proposed in an embodiment of the present application, when receiving model training information sent by a client device, the present application determines a second client device associated with a first client device, and uses the model training information of the second client device to train the server model corresponding to the first client device to obtain a target network model, sends the model parameters of the target network model to the first client device, and instructs the first client device to update the client model corresponding to the first client device using the model parameters of the target network model. Thus, the present application trains the client model by using the model training information of the client device, because the client device does not need to upload training data, the user's privacy can be protected, and the model training information is the model training information of the second client device associated with the first client device, so the present application can safely and comprehensively use the privacy data of multiple parties to jointly train the client model corresponding to the first client device, and at the same time, because the model training information is the model training information of the second client device associated with the first client device, the client model corresponding to the first client device is updated by using the model training information, which can accelerate the convergence speed of the client model corresponding to the first client device, that is, solve the learning problem of non-independent and identically distributed data.
[0173] See also Fig.15 , which shows a structural block diagram of a data processing system 600 provided in an embodiment of the present application. The data processing system 600 in the present application may include a server 610, a first client device 620, and a second client device (no reference numerals are given in the figure), and the first client device 620 and the second client device may be connected to the server 610 by wire or wirelessly.
[0174] Among them, the server 610 includes one or more of the following components: a first processor 611, a first memory 612, and one or more applications, wherein the one or more applications can be stored in the first memory 612 and configured to be executed by one or more first processors 611, and the one or more applications are configured to execute the method described in the aforementioned method embodiment.
[0175] The first processor 611 may include one or more processing cores. The first processor 611 uses various interfaces and lines to connect various parts of the entire server 610, and executes various functions and processes data of the server 610 by running or executing instructions, programs, code sets or instruction sets stored in the first memory 612, and calling data stored in the first memory 612. Optionally, the first processor 611 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The first processor 611 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the first processor 611, and may be implemented separately through a communication chip.
[0176] The first memory 612 may include a random access memory (RAM) or a read-only memory (ROM). The first memory 612 may be used to store instructions, programs, codes, code sets or instruction sets. The first memory 612 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the server 610 during use, etc.
[0177] The first client device 620 may be an electronic device such as a smart phone, a tablet computer, an e-book, etc. that can run applications, and may include one or more second processors 621, a second memory 622, and one or more applications, wherein the one or more applications in the first client device 620 are stored in the memory 622 of the first client device 620 and are configured to be executed by the one or more processors 621 in the first client device 620, and the one or more applications in the first client device 620 are configured to execute the method as described in the aforementioned method embodiment.
[0178] See also Fig.16 , which shows a structural block diagram of a computer-readable storage medium 700 provided in an embodiment of the present application. The computer-readable storage medium 700 stores program codes, and the program codes can be called by a processor to execute the method described in the above method embodiment.
[0179] The computer readable storage medium 700 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer readable storage medium 700 has storage space for program code 710 that executes any method steps in the above method embodiments. These program codes can be read from or written to one or more computer program products. The program code 710 can be compressed, for example, in an appropriate form.
[0180] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: The method is applied to a server of a data processing system, the server is connected to a plurality of client devices, the plurality of client devices include a first client device and a plurality of other client devices, the other client devices are a plurality of client devices other than the first client device, the method comprises: Receiving model training information sent by the multiple client devices, the model training information is network model parameters obtained by each client device using its own data to train the server model sent by the server; Determine, by using an attention mechanism, an information difference between the model training information of the first client device and the model training information of each of the other client devices, wherein the information difference is used to characterize a difference between data in the plurality of client devices; Determining the degree of association between the first client device and each of the other client devices according to the information difference; If the association between the first client device and other client devices meets the preset condition, the other client devices meeting the preset condition are used as second client devices; If there are multiple second client devices, obtaining the association degree between each of the second client devices and the first client device; Acquire target training information according to the degree of association and model training information of the second client device; Using the target training information to train a server model corresponding to the first client device to obtain a target network model; The model parameters of the target network model are sent to the first client device, and the first client device is instructed to update the client model corresponding to the first client device using the model parameters of the target network model.
2. The method according to claim 1, characterized in that The acquiring target training information according to the correlation degree and the model training information of the second client device includes: According to the degree of association between each of the second client devices and the first client device, assigning a corresponding weight to each of the second client devices, wherein the weight is positively correlated with the degree of association; The target training information is obtained according to the weight of each of the second client devices and the model training information.
3. The method according to claim 1, characterized in that After sending the model parameters of the target network model to the first client device and instructing the first client device to update the client model corresponding to the first client device using the model parameters of the target network model, the method includes: Receiving update information sent by at least one client device, wherein the update information is a network parameter corresponding to a client model stored in at least one of the client devices; If it is determined according to the update information that the client model corresponding to the first client device meets the convergence condition, the update operation on the client model corresponding to the first client device is stopped.
4. The method according to claim 3, characterized in that The at least one client device is a first client device, and if it is determined according to the update information that the client model corresponding to the first client device meets the convergence condition, stopping the update operation of the client model corresponding to the first client device includes: Acquire a loss value of a client model corresponding to the first client device according to the update information sent by the first client device; If the loss value of the client model corresponding to the first client device is less than the first loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and the update operation of the client model corresponding to the first client device is stopped.
5. The method according to claim 3, characterized in that: The at least one client device includes all the client devices, each of the client devices corresponds to a client model, and if it is determined according to the update information that the client model corresponding to the first client device meets the convergence condition, stopping the update operation of the client model corresponding to the first client device includes: Obtaining a loss value of each of the client models according to update information sent by all the client devices; Obtain a target loss value according to the loss values of all the client models; If the target loss value is less than the second loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and the update operation of the client model corresponding to the first client device is stopped.
6. The method according to claim 3, characterized in that: The at least one client device includes all the client devices, the all client devices include a first client device and a plurality of other client devices, each of the client devices corresponds to a client model; If it is determined according to the update information that the client model corresponding to the first client device meets the convergence condition, stopping the update operation of the client model corresponding to the first client device includes: Acquire the loss value of each of the client models according to the update information sent by all the client devices, and take the sum of the loss values of all the client models as the target loss value; Acquire a correlation degree between the first client device and each of the other client devices according to the attention mechanism, and sum the multiple correlation degrees to obtain a target correlation degree; If the sum of the target loss value and the target correlation degree is less than the third loss value, it is determined that the client model corresponding to the first client device meets the convergence condition, and the update operation of the client model corresponding to the first client device is stopped.
7. The method according to claim 1, characterized in that The sending the model parameters of the target network model to the first client device includes: The model parameters of the target network model are encrypted, and the encrypted model parameters are sent to the first client device.
8. The method according to claim 7, characterized in that The step of encrypting the model parameters of the target network model and sending the encrypted model parameters to the first client device includes: The model parameters of the target network model are encrypted using a homomorphic encryption method, and the encrypted model parameters are sent to the first client device.
9. The method according to any one of claims 1 to 8, characterized in that: Before determining the second client device associated with the first client device, the method includes: The working status of each of the client devices is obtained, and a client device whose working status matches a preset working status is used as a first client device.
10. A data processing method, characterized in that: The method is applied to a first client device of a data processing system, the data processing system further comprising a server, the server being connected to a plurality of client devices, the plurality of client devices comprising a first client device and a plurality of other client devices, the other client devices being a plurality of client devices other than the first client device, the method comprising: Receive model parameters of a target network model sent by the server, wherein the target network model is model training information sent by the multiple client devices received by the server, wherein the model training information is network model parameters obtained by each client device using its own data to train the server-side model sent by the server, and use an attention mechanism to determine the information difference between the model training information of the first client device and the model training information of each of the other client devices, wherein the information difference is used to characterize the difference between the data in the multiple client devices, and determine the association degree between the first client device and each of the other client devices based on the information difference; if the association degree between the first client device and the other client devices meets a preset condition, use the other client devices that meet the preset condition as second client devices; if there are multiple second client devices, obtain the association degree between each of the second client devices and the first client device, obtain target training information based on the association degree and the model training information of the second client device, and use the target training information to train and obtain the server-side model corresponding to the first client device; The client model corresponding to the first client device is updated using the model parameters of the target network model.
11. A data processing device, characterized in that: The apparatus is applied to a server of a data processing system, the server is connected to a plurality of client devices, the plurality of client devices include a first client device and a plurality of other client devices, the other client devices are a plurality of client devices other than the first client device, and the apparatus includes: A receiving module, used to receive model training information sent by the multiple client devices, wherein the model training information is network model parameters obtained by each client device using its own data to train the server model sent by the server; A determination module, configured to determine, by using an attention mechanism, an information difference between the model training information of the first client device and the model training information of each of the other client devices, wherein the information difference is used to characterize the difference between the data in the plurality of client devices; determine the association degree between the first client device and each of the other client devices according to the information difference; if the association degree between the first client device and the other client devices meets a preset condition, use the other client devices that meet the preset condition as second client devices; A training module, for obtaining, if there are multiple second client devices, a correlation between each of the second client devices and the first client device; obtaining target training information according to the correlation and the model training information of the second client device; and training the server model corresponding to the first client device using the target training information to obtain a target network model; An updating module is used to send the model parameters of the target network model to the first client device, and instruct the first client device to update the client model corresponding to the first client device using the model parameters of the target network model.
12. A data processing system, characterized in that: Including a server, a first client device, and a second client device: The server comprises one or more processors, a memory, and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method according to any one of claims 1 to 9; The first client device includes one or more processors, a memory, and one or more applications, wherein the one or more applications in the first client device are stored in the memory of the first client device and are configured to be executed by the one or more processors in the first client device, and the one or more applications in the first client device are configured to execute the method as claimed in claim 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 9.
