Training method, device, electronic device and storage medium of federated learning model
By iteratively updating the teacher model and student model between the server and participant devices, the problem of inefficient training of traditional federated learning models is solved, and the rapid convergence and efficient training of federated learning models are achieved.
Patent Information
- Application Number
- CN202110982129.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-25
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2041-08-25
AI Technical Summary
During the training process of traditional federated learning models, the convergence speed is slow and the training efficiency is low, which affects the efficiency of the recommendation system.
By obtaining the initial teacher model and public data set on the server, the student models of each participant device are obtained based on the teacher model and public data set, and the participant device updates the student model based on the private training data, and finally the teacher is updated by the server. model until preset convergence conditions are met.
The rapid convergence of the federated learning model is achieved, training efficiency is improved, and information to be recommended is quickly obtained in the recommendation system, improving efficiency.
Smart Images

Figure CN113689000B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and is related to but not limited to a training method, device, electronic device, computer-readable storage medium, and computer program product for a federated learning model. Background Art
[0002] Federated learning technology is an emerging privacy protection technology that can effectively combine data from all parties for model training without leaving the local data.
[0003] The traditional method of using federated learning to jointly train multiple clients is to initialize the federated learning model and send the initialized federated learning model to each participant for local training to obtain a local model. Then the server aggregates multiple local models based on the federated average algorithm, and takes the weighted average of multiple local models as the updated federated learning model. Repeat the above steps to obtain a trained federated learning model. This traditional method has a slow convergence speed and low training efficiency during the training process of the federated learning model. When the model is applied to the recommendation system, it affects the efficiency of obtaining recommendation information. Summary of the invention
[0004] The embodiments of the present application provide a training method, device, electronic device, computer-readable storage medium and computer program product for a federated learning model, which can enable the federated learning model to converge quickly during the training process and improve the training efficiency of the federated learning model.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application embodiment provides a method for training a federated learning model, which is applied to a server device, and the method includes:
[0007] Obtain an initial teacher model and a public dataset, where the public dataset is jointly held by multiple participant devices participating in federated training;
[0008] Based on the teacher model and the public data set, a student model corresponding to each participant's device is obtained by training;
[0009] Sending each student model to a corresponding participant device, so that each participant device updates the corresponding student model according to its own private training data to obtain an updated student model;
[0010] According to the updated student models sent by the devices of each participant, the teacher model is updated to obtain an updated teacher model;
[0011] When the updated teacher model meets the preset convergence condition, the updated teacher model is determined as the trained federated learning model.
[0012] The present application embodiment provides a method for training a federated learning model, which is applied to a participant device, and the method includes:
[0013] Receiving a student model sent by a server device, where the student model is trained by the server device according to a teacher model and a public data set, where the public data set is jointly held by multiple participant devices participating in the federated training;
[0014] Acquiring private training data of the participant device;
[0015] Updating the student model according to the private training data to obtain an updated student model;
[0016] The updated student model is sent to the server device so that the server device updates the teacher model according to the updated student model, and when the updated teacher model meets the preset convergence condition, the updated teacher model is determined as the trained federated learning model.
[0017] The present application embodiment provides a training device for a federated learning model, the device comprising:
[0018] A first acquisition module is used to acquire an initial teacher model and a public data set, where the public data set is jointly held by multiple participant devices participating in the federated training;
[0019] A first training module is used to train a student model corresponding to each participant device based on the teacher model and the public data set;
[0020] A first sending module is used to send each student model to a corresponding participant device, so that each participant device updates the corresponding student model according to the training data held by each participant device to obtain an updated student model;
[0021] A first updating module, configured to update the teacher model according to the updated student model sent by each participant device to obtain an updated teacher model;
[0022] The first determination module is used to determine the updated teacher model as a trained federated learning model when the updated teacher model meets a preset convergence condition.
[0023] In some embodiments, the training device of the federated learning model further includes: a first receiving module, configured to receive the weight of each public data in the public data set sent by each of the participant devices;
[0024] Before the training is performed to obtain the student model corresponding to each participant device, the first training module is further used to:
[0025] Based on the weight of each public data in the public data set sent by each of the participant devices, adjust each public data in the corresponding public data set to obtain a target data set corresponding to each of the participant devices;
[0026] Based on the teacher model and the target data set corresponding to each participant's device, a student model corresponding to each participant's device is trained.
[0027] In some embodiments, the first receiving module is further used to receive request information sent by the participant device, where the request information is used to obtain a trained federated learning model;
[0028] The first sending module is also used to send the trained federated learning model to the participant device in response to the request information, so that the participant device determines the target information for the target user based on the feature data of the target user and the trained federated learning model.
[0029] In some embodiments, the first training module is further used to:
[0030] Inputting multiple data in the target data set into the teacher model respectively to obtain corresponding prediction results;
[0031] Using the prediction results as labels for corresponding data, constructing training samples of the student model corresponding to the participant device;
[0032] Based on the constructed training samples, the student model corresponding to the participant device is trained.
[0033] In some embodiments, the first acquisition module is further used to:
[0034] Get the initialized federated learning model;
[0035] Sending the initialized federated learning model to the multiple participant devices, so that each of the participant devices updates the initialized federated learning model according to its own private training data to obtain an updated federated learning model;
[0036] Receiving an updated federated learning model sent by each of the participating devices;
[0037] The updated federated learning models sent by the participating devices are aggregated to obtain an initial teacher model.
[0038] In some embodiments, the first training module is further used to train, based on the updated teacher model and the public data set, to obtain an updated student model corresponding to each participant device when the updated teacher model does not meet a preset convergence condition;
[0039] The first sending module is further used to send each updated student model to a corresponding participant device, so that each participant device updates the corresponding updated student model again according to its own private training data to obtain a re-updated student model;
[0040] The first updating module is also used to aggregate the updated federated learning models sent by each of the participating devices to obtain a further updated teacher model.
[0041] The present application embodiment provides a training device for a federated learning model, the device comprising:
[0042] A second receiving module is used to receive a student model sent by a server device, where the student model is trained by the server device according to a teacher model and a public data set, and the public data set is jointly held by multiple participant devices participating in the federated training;
[0043] A second acquisition module, used to acquire private training data of the participant device;
[0044] A second updating module, used for updating the student model according to the training data to obtain an updated student model;
[0045] The second sending module is used to send the updated student model to the server device so that the server device updates the teacher model according to the updated student model, and when the updated teacher model meets the preset convergence condition, determines the updated teacher model as the trained federated learning model.
[0046] In some embodiments, the training device of the federated learning model further includes:
[0047] A third acquisition module is used to acquire the public data set and the trained classification model;
[0048] A classification module, used to input each public data in the public data set into the trained classification model to obtain a classification prediction value of each public data, wherein the classification prediction value of the public data is used to characterize the probability that the public data comes from the device of the participant;
[0049] A second determination module is used to determine the weight of each public data according to the classification prediction value of each public data;
[0050] The second sending module is also used to send the weights of the various public data to the server device, so that the server device trains the student model according to the teacher model, the public data set and the weights of the various public data.
[0051] In some embodiments, the second sending module is further used to send request information to the server device in response to an operation instruction for obtaining target information for a target user;
[0052] The second receiving module is further used to receive the trained federated learning model sent by the server device;
[0053] A fourth acquisition module, configured to acquire characteristic data of the target user, wherein the characteristic data includes at least one of attribute data and behavior data of the target user;
[0054] An input module is used to input the feature data into the trained federated learning model to obtain target information for the target user.
[0055] In some embodiments, the training device of the federated learning model further includes:
[0056] a fifth acquisition module, configured to acquire a preset classification model and a classification training data set, wherein the classification training data set includes a first data subset and a second data subset, wherein the first data subset includes the private training data and corresponding labels, and the second data subset includes the public data and corresponding labels;
[0057] The second training module is used to train the preset classification model according to the first data subset and the second data subset to obtain a trained classification model.
[0058] In some embodiments, before receiving the student model sent by the server device, the second receiving module is further used to receive the initialized federated learning model sent by the server device;
[0059] The second updating module is further used to update the initialized federated learning model according to the private training data to obtain an updated federated learning model;
[0060] The second sending module is also used to send the updated federated learning model to the server device, so that the server device determines the initial teacher model according to the updated federated learning model.
[0061] The present application embodiment provides a training device for a federated learning model, the device comprising:
[0062] A memory for storing executable instructions;
[0063] The processor is used to implement the training method of the federated learning model provided in the embodiment of the present application when executing the executable instructions stored in the memory.
[0064] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement the training method of the federated learning model provided in the embodiment of the present application.
[0065] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the training method of the federated learning model provided in the embodiment of the present application.
[0066] The embodiments of the present application have the following beneficial effects:
[0067] Compared with the method of training a federated learning model based on a federated average algorithm in the related art, the embodiment of the present application obtains an initial teacher model and a public data set through a server-side device, and the public data set is jointly held by multiple participant devices participating in the federated training; based on the teacher model and the public data set, a student model corresponding to each participant device is trained; each student model is sent to the corresponding participant device, so that each participant device updates the corresponding student model according to its own private training data to obtain an updated student model; according to the updated student model sent by each participant device, the teacher model is updated to obtain an updated teacher model; when the updated teacher model meets the preset convergence condition, the updated teacher model is determined as a trained federated learning model. Training the student model on the server-side device according to the public data set and the teacher model can enable the federated learning model to converge quickly and improve the training efficiency of the federated learning model. Applying the trained federated learning model to the recommendation system can quickly obtain the information to be recommended and improve the efficiency of obtaining the information to be recommended. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 It is a schematic diagram of a network architecture of a training system for a federated learning model provided in an embodiment of the present application;
[0069] Figure 2 It is a schematic diagram of the composition structure of a training device for a federated learning model provided in an embodiment of the present application;
[0070] Figure 3 This is a schematic diagram of an implementation flow of a training method for a federated learning model provided in an embodiment of the present application;
[0071] Figure 4 A schematic diagram of another implementation flow of the training method of the federated learning model provided in the embodiment of the present application;
[0072] Figure 5 A schematic diagram of an implementation flow of obtaining an initial teacher model provided in an embodiment of the present application;
[0073] Figure 6 This is another implementation flow diagram of the training method of the federated learning model provided in the embodiment of the present application;
[0074] Figure 7 A schematic diagram of another implementation flow of the training method of the federated learning model provided in the embodiment of the present application;
[0075] Figure 8 A schematic diagram of another implementation flow of the training method of the federated learning model provided in the embodiment of the present application;
[0076] Fig. 9 A schematic diagram of a network architecture of a recommendation system applying a federated learning model provided in an embodiment of the present application;
[0077] Fig.10 A schematic diagram of an implementation flow of a recommended method for applying a federated learning model provided in an embodiment of the present application;
[0078] Fig.11 A schematic diagram of an implementation flow of a personalized federated learning method based on model distillation provided in an embodiment of the present application. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0080] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0081] In the following description, the terms "first\second\third" involved are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0082] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0083] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0084] 1) Federated Learning, an emerging basic AI technology, is designed to carry out efficient machine learning among multiple parties or computing nodes while ensuring information security during big data exchange, protecting terminal data and personal data privacy, and ensuring legality and compliance.
[0085] 2) Horizontal Federated Learning: When two data sets have different users and little overlap, but have more overlap in user features, the data sets are split horizontally (i.e., user dimension) and the data with the same user features but different users are taken out for machine learning training.
[0086] 3) Knowledge Distilling: A common method for model compression. Model compression refers to distilling the feature representation "knowledge" learned by a complex network with strong learning ability in a teacher-student framework and passing it to a network with small parameters and weak learning ability, so that the small model (student model) can learn the knowledge of the large model (teacher model).
[0087] Based on the above explanations of the nouns and terms involved in the embodiments of the present application, the training system of the federated learning model provided in the embodiments of the present application is first explained. Figure 1 is a schematic diagram of a network architecture of a training system for a federated learning model provided in an embodiment of the present application, such as Figure 1As shown, in the training system of the federated learning model, at least a server device 100, at least two participant devices 200 (for distinction, multiple participant devices are respectively recorded as participant device 200-1, participant device 200-2, ..., participant device 200-k, k is an integer greater than 1) and a network 300. To support an exemplary application, the server device 100 is a service terminal of federated learning, such as a server, etc. The server device 100 can be an independent physical server, or a server cluster or 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, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms. The participant device 200 is a participating terminal of federated learning, such as a terminal, etc. The participant device 200 can be a laptop, a tablet computer, a desktop computer, a smart phone, a dedicated messaging device, a portable gaming device, a smart speaker, a smart watch, etc., but is not limited to this. The server device 100 is connected to at least two participant devices 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two, and data transmission is achieved using wireless or wired links.
[0088] When the training system of the federated learning model provided by the embodiment of the present application is used to train the federated learning model, the server device 100 obtains the initial teacher model and obtains the public data set jointly held by each participant device 200 participating in the federated training. The public data included in the public data set is public between each participant device 200. Then, the server device 100 trains the student model corresponding to each participant device 200 according to the teacher model and the public data set, and trains the first student model corresponding to the participant device 200-1, the second student model corresponding to the participant device 200-2, ..., and the kth student model corresponding to the participant device 200-k. Then, the server device 100 sends the first student model to the participant device 200-1, the second student model to the participant device 200-2, ..., and the kth student model to the participant device 200-k.
[0089] The i-th participant device 200-i receives the i-th student model, obtains its own private training data, updates the i-th student model according to the private training data, obtains the updated i-th student model, and returns the updated i-th student model to the server device 100. Here, the private training data of each participant device is hidden from other participant devices and the server device, thus ensuring that the data privacy of each participant device is not leaked. Here i = 1, 2, ..., k.
[0090] The server device 100 receives the updated student models returned by the participant device 200-1, the participant device 200-2, ..., the participant device 200-k, and updates the teacher model according to these updated student models to obtain an updated teacher model. Then, it is determined whether the updated teacher model has converged according to the preset convergence condition. When it is determined that the updated teacher model meets the preset convergence condition, the training is terminated, and the updated teacher model is determined as the trained federated learning model. In an embodiment of the present application, the server device 100 trains the student model according to the teacher model and the public data set, and then distributes the student model to the corresponding participant devices for updating, so that the federated learning model can converge quickly during the training process, thereby improving the training efficiency of the federated learning model.
[0091] See also Figure 2 , Figure 2 400 is a schematic diagram of a structure of a training device for a federated learning model provided in an embodiment of the present application. In practical applications, the training device 400 for a federated learning model can be implemented as Figure 1 The server device 100 or the participant device 200 in the example below takes the training device 400 of the federated learning model as an example. Figure 1 Taking the server device 100 shown as an example, the training method of the federated learning model of the embodiment of the present application is explained. Figure 2 The training device 400 of the federated learning model shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the training device 400 of the federated learning model are coupled together through a bus system 440. It can be understood that the bus system 440 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 2 Various buses are labeled as bus system 440 .
[0092] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0093] The user interface 430 includes one or more output devices 431, such as one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, a mouse, a microphone, a touch screen display, a camera, other input buttons and controls.
[0094] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0095] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0096] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0097] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0098] A network communication module 452, for reaching other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus (USB);
[0099] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
[0100] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
[0101] In some embodiments, the training device of the federated learning model provided in the embodiments of the present application can be implemented in software. Figure 2 A training device 455 of a federated learning model stored in a memory 450 is shown, which may be software in the form of a program or a plug-in, and includes the following software modules: a first acquisition module 4551, a first training module 4552, a first sending module 4553, a first updating module 4554, and a first determining module 4555. These modules are logical, and thus may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0102] In other embodiments, the training device of the federated learning model provided in the embodiments of the present application can be implemented in hardware. As an example, the training device of the federated learning model provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the training method of the federated learning model provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0103] The following will illustrate the training method of the federated learning model provided in the embodiment of the present application in combination with the exemplary application and implementation of the training device of the federated learning model provided in the embodiment of the present application. Figure 3 This is a schematic diagram of an implementation flow of the training method of the federated learning model provided in the embodiment of the present application, which is applied to Figure 1 The server device of the network architecture shown will be combined with Figure 3 The steps shown are explained.
[0104] Step S301, obtaining the initial teacher model and public data set.
[0105] In an embodiment of the present application, the server device may obtain an initial teacher model from other devices, or may train an initial teacher model based on the private training data of each participant device. One implementation method for obtaining the initial teacher model by training may be: the server device initializes a federated learning model, sends the federated learning model to each participant device, and each participant device trains the federated learning model using its own private training data to obtain a trained federated learning model. Each participant device sends its trained federated learning model to the server device, and the server device aggregates the trained federated learning models of these participant devices to obtain an aggregated model, and the server device uses the aggregated model as the initial teacher model.
[0106] Here, the public data set obtained by the server device is jointly held by multiple participating devices participating in the federated training. Therefore, when the server device obtains the public data set, it can obtain it from any participating device.
[0107] Step S302: Based on the teacher model and the public data set, a student model corresponding to each participant's device is trained.
[0108] The server-side device inputs the public data included in the public data set into the initial teacher model respectively to obtain the prediction results corresponding to each public data; uses the prediction results corresponding to each public data as the label of the corresponding public data to construct the training samples of the student model corresponding to the participant device; based on the constructed training samples, the student model corresponding to each participant device is trained to obtain the student model corresponding to each participant device, and the student model is trained by the public data of the participant device.
[0109] Step S303, sending each student model to the corresponding participant device, so that each participant device updates the corresponding student model according to its own private training data to obtain an updated student model.
[0110] The student model trained by the server device in step S302 only considers the public data of each participant device, and does not consider the private data held by each participant device. The private data of each participant device is confidential to the server device, so it is necessary to send the student model trained in step S302 to each participant device for further training. In one implementation, after the server device sends each student model to the corresponding participant device, such as after the server device sends the first student model to the first participant device, the first participant device trains the first student model according to its own private data to obtain a trained first student model, that is, an updated first student model. The updated first student model is not only applicable to the public data of the first participant device, but also to the private data of the first participant. Each participant device trains the corresponding student model according to its own private data to obtain an updated student model, and then each participant device sends its own trained updated student model to the server device.
[0111] Step S304: Update the teacher model according to the updated student model sent by each participating device to obtain an updated teacher model.
[0112] The server device receives a corresponding trained updated student model from each participating device, aggregates each updated student model, and obtains an updated teacher model.
[0113] Here, when the server device aggregates the updated student models, the weighted average of the multiple updated student models can be used as the updated teacher model.
[0114] Step S305, when the updated teacher model meets the preset convergence condition, the updated teacher model is determined as the trained federated learning model.
[0115] The server device is pre-set with the end training condition. In the embodiment of the present application, the end training condition may include satisfying the preset convergence condition. During the training process, after obtaining the updated teacher model, the server device determines whether the updated teacher model satisfies the preset convergence condition. When the updated teacher model satisfies the preset convergence condition, it is determined that the end training condition is met, and the updated teacher model at this time is determined as the trained federated learning model. When the updated teacher model does not meet the preset convergence condition, it is determined that the end training condition is not met, and the updated student model is continued to be trained according to the updated teacher model and the public data set, and the updated student model is sent to the corresponding participant device for re-updating to obtain the re-updated student model, and then the server device updates the teacher model again according to the re-updated student model to obtain the re-updated teacher model, and determines whether the re-updated teacher model meets the preset convergence condition. If not, continue to update until a teacher model that meets the preset convergence condition is obtained.
[0116] In other embodiments, the end training condition may also include reaching a preset number of training rounds. During the training process, each time an updated teacher model is obtained, the number of training rounds is incremented by one, and then the server device determines whether the number of training rounds has reached the preset number of training rounds. When the number of training rounds reaches the preset number of training rounds, it is determined that the end training condition has been reached, and the updated teacher model at this time is determined as the trained federated learning model. When the number of training rounds is less than the preset number of training rounds, it is determined that the end training condition has not been reached, and the updated student model is continued to be trained according to the updated teacher model and the public data set, and the updated student model is sent to the corresponding participant device for re-updating to obtain the re-updated student model, and then the server device updates the teacher model again according to the re-updated student model to obtain the re-updated teacher model, and the number of training rounds is incremented by one again, and it is determined again whether the number of training rounds has reached the preset number of training rounds. If it has not reached, the teacher model and the student model are continued to be updated until the number of training rounds reaches the preset number of training rounds.
[0117] In some other embodiments, the end training condition may include satisfying a preset convergence condition and reaching a preset number of training rounds. During the training process, when the updated teacher model satisfies the preset convergence condition, or when the number of training rounds reaches the preset number of training rounds, it is determined that the end training condition is met; when the updated teacher model does not satisfy the preset convergence condition, and when the number of training rounds does not reach the preset number of training rounds, it is determined that the end training condition is not met.
[0118] It should be noted that when the training is terminated based on the preset number of training rounds, the federated learning model obtained through training may have converged or may not have converged. When the training is terminated based on the preset convergence condition, the federated learning model obtained through training is converged.
[0119] The training method of the federated learning model provided in the embodiment of the present application is applied to a server-side device. The training of the federated learning model includes: obtaining an initial teacher model and a public data set, the public data set being jointly held by multiple participant devices participating in the federated training; based on the teacher model and the public data set, training to obtain a student model corresponding to each participant device; sending each student model to the corresponding participant device so that each participant device updates the corresponding student model according to its own private training data to obtain an updated student model; updating the teacher model according to the updated student model sent by each participant device to obtain an updated teacher model; when the updated teacher model meets the preset convergence condition, the updated teacher model is determined as a trained federated learning model. Training the student model on the server-side device according to the public data set and the teacher model can enable the federated learning model to converge quickly and improve the training efficiency of the federated learning model. Applying the trained federated learning model to the recommendation system can quickly obtain the information to be recommended and improve the efficiency of obtaining the information to be recommended.
[0120] exist Figure 3 On the basis of the illustrated embodiment, when the server-side device trains the student model corresponding to each participant device, the data distribution of each participant device can be further considered so that the trained student model adapts to the data distribution of each participant device, which can be achieved as follows.
[0121] Figure 4 Another implementation flow diagram of the training method of the federated learning model provided in the embodiment of the present application is applied to Figure 1 The server device of the network architecture shown in FIG. Figure 4 As shown, the training method of the federated learning model includes the following steps:
[0122] Step S401, obtaining the initial teacher model and public data set.
[0123] In an embodiment of the present application, the server device may obtain an initial teacher model from other devices, or may train an initial teacher model based on the private training data of each participant device. One implementation method for obtaining the initial teacher model by training may be: the server device initializes a federated learning model, sends the federated learning model to each participant device, and each participant device trains the federated learning model using its own private training data to obtain a trained federated learning model. Each participant device sends its trained federated learning model to the server device, and the server device aggregates the trained federated learning models of these participant devices to obtain an aggregated model, and the server device uses the aggregated model as the initial teacher model.
[0124] Here, the public data set obtained by the server device is jointly held by multiple participating devices participating in the federated training. Therefore, when the server device obtains the public data set, it can obtain it from any participating device.
[0125] Step S402: receiving the weight of each public data in the public data set sent by each participant device.
[0126] Since the private data of each participant's device is confidential to other participant's devices and the server device, the server device cannot obtain the distribution of the data (including public data and private data) held by each participant's device, but the server device can obtain the distribution of each public data in the public data set by each participant's device. Based on this, in the embodiment of the present application, each participant's device determines the weight of each public data in the public data set, and each participant's device sends the determined weight of each public data in the public data set to the server device, and the server device adjusts each public data in the corresponding public data set according to the weight of each public data in the public data set sent by each participant's device, so that the student model trained by the server device conforms to the data distribution of each participant's device.
[0127] Step S403: Based on the weight of each public data in the public data set sent by each participant device, each public data in the corresponding public data set is adjusted to obtain a target data set corresponding to each participant device.
[0128] Here, the product of the public data and the corresponding weight can be determined as the target data obtained after adjusting the public data. According to the weight corresponding to each public data, all public data in the public data set are adjusted to obtain the target data set.
[0129] Step S404: Based on the teacher model and the target data set corresponding to each participant's device, a student model corresponding to each participant's device is trained.
[0130] In one implementation, when the server-side device trains and obtains the student model corresponding to each participant device, the following operations are performed for the target data set corresponding to each participant device: multiple data in the target data set are respectively input into the teacher model to obtain corresponding prediction results; the prediction results are used as labels for the corresponding data to construct training samples of the student model corresponding to the participant device; and based on the constructed training samples, the student model corresponding to the participant device is trained.
[0131] Step S405: Send each student model to the corresponding participant device, so that each participant device updates the corresponding student model according to its own private training data to obtain an updated student model.
[0132] The student model trained by the server device in step S404 only considers the public data of each participant device and the distribution of public data, and does not consider the private data held by each participant device and the distribution of private data. Therefore, the student model trained in step S404 needs to be sent to each participant device for further training. The training method of the student model by the participant device is the same as the training method when the server device does not consider the distribution of data, that is, after the server device sends each student model to the corresponding participant device, each participant device trains the corresponding student model according to its own private data to obtain an updated student model. The updated student model is not only applicable to the public data of the participant device, but also to the private data of the participant, and takes into account the distribution of data held by the participant device, so that the teacher model aggregated according to the updated student model is adapted to the personalized data distribution of each participant device.
[0133] Step S406: Update the teacher model according to the updated student model sent by each participating device to obtain an updated teacher model.
[0134] Each participant device sends the updated student model to the server device. The server device receives a corresponding trained updated student model from each participant device, aggregates each updated student model, and obtains an updated teacher model.
[0135] Here, when the server device aggregates the updated student models, the weighted average of the multiple updated student models can be used as the updated teacher model.
[0136] Step S407, when the updated teacher model meets the preset convergence condition, the updated teacher model is determined as the trained federated learning model.
[0137] The server device is pre-set with the end training condition. In the embodiment of the present application, the end training condition may include satisfying the preset convergence condition, or may include reaching the preset number of training rounds, or may include satisfying the preset convergence condition and reaching the preset number of training rounds. During the training process, when it is determined that the end training condition is met, the updated teacher model is determined as the trained federated learning model; otherwise, the training continues until the end training condition is met.
[0138] It should be noted that when the training is terminated based on the preset number of training rounds, the federated learning model obtained through training may have converged or may not have converged. When the training is terminated based on the preset convergence condition, the federated learning model obtained through training is converged.
[0139] The training method of the federated learning model provided in the embodiment of the present application is applied to a server-side device, and the training of the federated learning model includes: obtaining an initial teacher model and a public data set, wherein the public data set is jointly held by multiple participant devices participating in the federated training; receiving the weight of each public data in the public data set sent by each participant device; adjusting each public data in the corresponding public data set based on the weight of each public data in the public data set sent by each participant device to obtain a target data set corresponding to each participant device; training a student model corresponding to each participant device based on the teacher model and the target data set corresponding to each participant device; sending each student model to the corresponding participant device so that each participant device updates the corresponding student model according to its own private training data to obtain an updated student model; updating the teacher model according to the updated student model sent by each participant device to obtain an updated teacher model; when the updated teacher model meets the preset convergence condition, determining the updated teacher model as the trained federated learning model. In this way, the server-side device trains the student model based on the public data set and the teacher model, which can make the federated learning model converge quickly and improve the training efficiency of the federated learning model; and the server-side device considers the weight of the public data in the devices of each participant when training the student model, and realizes the training of the federated learning model in combination with the data distribution of the devices of each participant, so that the trained federated learning model adapts to the personalized distribution of data in the devices of each participant, and can greatly improve the availability of the federated learning model when the data of each participant is independent and non-identical. Applying the trained federated learning model to the recommendation system can not only quickly obtain the information to be recommended and improve the efficiency of obtaining the information to be recommended, but also can recommend targeted target information to the user in combination with the user's feature data, so that the target information can match the feature data of the target user and improve the accuracy of the recommended target information.
[0140] In some embodiments, the above Figure 3 The initial teacher model in the embodiment shown can be obtained by the server device according to the initialized federated learning model. Figure 5 , Figure 5 A schematic diagram of an implementation flow of obtaining an initial teacher model provided in an embodiment of the present application, the above Figure 3 In the illustrated embodiment, "obtaining an initial teacher model" in step S301 can be implemented through steps S3011 to S3014, which will be described in conjunction with each step.
[0141] Step S3011, obtaining an initialized federated learning model.
[0142] Step S3012, sending the initialized federated learning model to multiple participant devices, so that each participant device updates the initialized federated learning model according to its own private training data to obtain an updated federated learning model.
[0143] The server device can send the overall structure of the initialized federated learning model to each participating device for training, or send the local structure of the initialized federated learning model to each participating device for training. In other words, the structure of the initialized federated learning model received by each participating device can be the same or different.
[0144] When the participating device receives the overall structure, the participating device trains the received federated learning model of the overall structure according to its own private training data to obtain an updated federated learning model. The updated federated learning model updates all parameters of the federated learning model constructed by the server device. In this way, the overall structure of the federated learning model can be trained quickly to improve the training efficiency of the federated learning model. However, each participating device can know the overall structure of the federated learning model, which may result in certain privacy leakage.
[0145] When the participating device receives a local structure, the participating device trains the federated learning model of the received local structure according to its own private training data to obtain an updated federated learning model. Each participating device can only know the partial structure of the federated learning model, so that the updated federated learning model updates some parameters of the federated learning model constructed by the server device. Each participating device cannot know the overall structure of the federated learning model, thereby achieving privacy protection of the federated learning module structure. However, with this training method, each participating device can only train part of the structure of the federated learning model each time, and more training times are required to obtain a converged federated learning model. The training efficiency of the federated learning model is low.
[0146] Step S3013, receiving the updated federated learning model sent by each participating device.
[0147] If the server device sends an initialized federated learning model of the overall structure, what is received is the overall updated federated learning model; when the server device sends an initialized federated learning model of the local structure, what is received is the locally updated federated learning model.
[0148] Step S3014, aggregate the updated federated learning models sent by each participating device to obtain an initial teacher model.
[0149] The server device simultaneously receives updated federated learning models sent by multiple participating devices, aggregates the multiple updated federated learning models to obtain an aggregated model, and determines the aggregated model as the initial teacher model. In an embodiment of the present application, when aggregating multiple updated federated learning models, a federated averaging algorithm can be used for aggregation, that is, the parameters of each updated federated learning model are weighted averaged to obtain updated parameters.
[0150] The method provided in the embodiment of the present application is to train the initialized federated learning model through the devices of each participant, and the server device aggregates the federated learning models trained by the devices of each participant, so as to obtain the initial teacher model.
[0151] In some embodiments, after the above step S304 obtains the updated teacher model, the server device determines whether the updated teacher model meets the preset convergence conditions. When the updated teacher model meets the preset convergence conditions, it is considered that the updated teacher model has converged, and step S305 is entered; when the updated teacher model does not meet the preset convergence conditions, it is considered that the updated teacher model has not converged, and steps S306 to S308 are continued to be executed to continue training the updated teacher model until a teacher model that meets the preset convergence conditions is obtained.
[0152] Step S306: When the updated teacher model does not meet the preset convergence condition, an updated student model corresponding to each participant device is trained based on the updated teacher model and the public data set.
[0153] The server-side device determines whether the updated teacher model meets the preset convergence conditions. When the updated teacher model meets the preset convergence conditions, the training is terminated and the updated teacher model is determined as the trained federated learning model. When the updated teacher model does not meet the preset convergence conditions, the server-side device inputs the public data included in the public data set into the updated teacher model respectively, and obtains the updated prediction results corresponding to each public data. The updated prediction results corresponding to each public data are used as the labels of the corresponding public data, and based on the constructed training samples, the student models corresponding to each participating device are trained again to obtain the updated student models corresponding to each participating device.
[0154] Step S307, sending each updated student model to the corresponding participant device, so that each participant device updates the corresponding updated student model again according to its own private training data to obtain a further updated student model.
[0155] After the server device sends each updated student model to the corresponding participant device, such as after the server device sends the updated first student model to the first participant device, the first participant device again trains the updated first student model according to its own private data to obtain the trained first student model, that is, the updated first student model.
[0156] Step S308, aggregating the updated federated learning models sent by the devices of each participant to obtain an updated teacher model.
[0157] Each participating device sends its trained federated learning model to the server device, which aggregates the federated learning models trained by these participating devices to obtain an aggregated model. The server device uses the aggregated model as an updated teacher model.
[0158] In an embodiment of the present application, during the training process, after obtaining the updated teacher model, the server-side device determines whether the updated teacher model satisfies the preset convergence conditions. When the updated teacher model satisfies the preset convergence conditions, it is determined that the training end conditions are met, and the updated teacher model at this time is determined as the trained federated learning model. When the updated teacher model does not meet the preset convergence conditions, it is determined that the training end conditions are not met, and the updated student model is continued to be trained according to the updated teacher model and the public data set, and the updated student model is sent to the corresponding participant device for re-update to obtain the re-updated student model, and then the server-side device updates the teacher model again according to the re-updated student model to obtain the re-updated teacher model, and determines whether the re-updated teacher model meets the preset convergence conditions. If not, continue to update until a teacher model that meets the preset convergence conditions is obtained.
[0159] Figure 6 This is another implementation flow diagram of the training method of the federated learning model provided in the embodiment of the present application, which is applied to Figure 1 The participating devices of the network architecture shown will be combined Figure 6 The steps shown are explained.
[0160] Step S601, receiving the student model sent by the server device.
[0161] The student model is trained by the server device based on the teacher model and a public dataset, which is jointly held by multiple participant devices participating in the federated training.
[0162] Step S602: Acquire private training data of the participant's device.
[0163] The participant device obtains private data from its own storage space as training data. The private training data of the participant device is not shared, and other participant devices cannot obtain the private data of the participant device.
[0164] Step S603, updating the student model according to the private training data to obtain an updated student model.
[0165] The participating device updates the student model based on its own private training data to obtain an updated student model. During the update process, the private data of each participating device does not leave the local area, which can ensure the privacy protection of the private data of each participating device. In addition, each participating party updates the student model based on its own data, so that the updated student model matches its own data distribution, so that the trained federated learning model conforms to the personalized data distribution characteristics of each participating device, and solves the problem in related technologies that the data of each participating device is not distributed in the same way, resulting in the trained federated learning model failing to achieve good results on the data of all participating devices.
[0166] Step S604, sending the updated student model to the server device, so that the server device updates the teacher model according to the updated student model, and when the updated teacher model meets the preset convergence condition, determines the updated teacher model as the trained federated learning model.
[0167] The server device receives the updated student models sent by each participating device, aggregates the updated student models, and updates the teacher model.
[0168] The training method of the federated learning model provided in the embodiment of the present application is applied to the participant device. The training of the federated learning model includes: receiving the student model sent by the server device, the student model is obtained by the server device according to the teacher model and the public data set, and the public data set is jointly held by multiple participant devices participating in the federated training; obtaining the private training data of the participant device; updating the student model according to the private training data to obtain the updated student model; sending the updated student model to the server device, so that the server device updates the teacher model according to the updated student model, and when the updated teacher model meets the preset convergence condition, the updated teacher model is determined as the trained federated learning model. In this way, the server device trains the student model according to the public data set and the teacher model, and then the participant device trains the student model according to the private training data, which can make the federated learning model converge quickly and improve the training efficiency of the federated learning model. In addition, in the process of updating the student model by the participant device, the private data of each participant device does not leave the local, which can ensure the privacy protection of the private data of each participant device. In addition, each participant updates the student model based on its own data, so that the updated student model matches its own data distribution, so that the trained federated learning model meets the personalized data distribution characteristics of each participant's device, solving the problem in related technologies that the data of each participant's device is not uniformly distributed, resulting in the trained federated learning model being unable to achieve good results on the data of all participants' devices. Applying the trained federated learning model to the recommendation system can quickly obtain the information to be recommended, thereby improving the efficiency of obtaining the information to be recommended.
[0169] exist Figure 6 Based on the embodiment shown, the participant device can first obtain the distribution information of its own private training data, and send the distribution information to the server device so that the server device can train the corresponding student model based on the distribution of the data held by the participant device. Based on this, the embodiment of the present application further provides a training method for a federated learning model. Figure 7 , Figure 7 A schematic diagram of another implementation flow of the training method of the federated learning model provided in the embodiment of the present application, which is applied to Figure 1 The participating devices of the network architecture shown will be combined Figure 7 The steps shown are explained.
[0170] Step S701, obtaining a trained classification model and a public data set.
[0171] One implementation method for obtaining a trained classification model is: obtaining a preset classification model and a classification training data set, the classification training data set including a first data subset and a second data subset, wherein the first data subset includes private training data and corresponding labels, and the second data subset includes public data and corresponding labels; training the preset classification model according to the first data subset and the second data subset to obtain a trained classification model.
[0172] The private training data included in the first data subset comes from the own data D n , the label is 1, and the second data subset includes public data from the public dataset D G , the label is -1. The nth participant device P n Use own data D n With the public dataset D G Train the preset classification model, and the trained classification model is recorded as φ n , the classification model is used to determine the probability that the data comes from the participant device. Here n is an integer between 1 and N, and N is the number of participant devices for federated training.
[0173] Step S702: input each public data in the public data set into the trained classification model to obtain the classification prediction value of each public data.
[0174] The dataset D will be made public G Each public data in is input into the classification model φ trained by the nth participant device n , and obtain the classification prediction value of each public data. Here, the classification prediction value of the public data obtained is used to characterize the probability that the public data comes from the device of the participant. The classification prediction value is any value between [0,1]. If the classification prediction value of a public data determined by the classification model trained by the first participant device is closer to 1, it indicates that the probability that the public data comes from the first participant device is greater.
[0175] Step S703: Determine the weight of each public data according to the classification prediction value of each public data.
[0176] Determine the probability that the i-th public data comes from the n-th participant’s device, and the obtained classification prediction value is recorded as The classification prediction value of each public data Substitute them into the following formula (1) to obtain the weight w of each public data in ,
[0177]
[0178] Among them, w in Represents the weight of the ith public data determined by the nth participant device, 1≤n≤N, 1≤i≤G.
[0179] Step S704, sending the weights of each public data to the server device, so that the server device trains the student model according to the teacher model, the public data set and the weights of each public data.
[0180] The server device receives the weight of each public data sent by each participating device, and considers the weight of each public data when training the student model, that is, considers the probability that each public data comes from each participating device, so that the trained student model takes into account the data distribution of each participating device.
[0181] Step S705, receiving the student model sent by the server device.
[0182] The student model is trained by the server device based on the teacher model and a public dataset, which is jointly held by multiple participant devices participating in the federated training.
[0183] Steps S705 to S708 in the embodiment of the present application are respectively Figure 6 In the illustrated embodiment, steps S601 to S604 correspond to each other one by one. For the implementation manner and effect of steps S705 to S708, refer to the detailed description of the above steps S601 to S604.
[0184] Step S706: Acquire private training data of the participant's device.
[0185] Step S707, updating the student model according to the private training data to obtain an updated student model.
[0186] Step S708, sending the updated student model to the server device, so that the server device updates the teacher model according to the updated student model, and when the updated teacher model meets the preset convergence condition, determines the updated teacher model as the trained federated learning model.
[0187] The training method of the federated learning model provided in the embodiment of the present application is that the server-side device trains the student model according to the public data set and the teacher model, and then the participant device trains the student model according to the private training data, which can make the federated learning model converge quickly and improve the training efficiency of the federated learning model; and the server-side device considers the weight of the public data in each participant device when training the student model, and realizes the training of the federated learning model in combination with the data distribution of each participant device, so that the trained federated learning model adapts to the personalized distribution of data in each participant device, and can greatly improve the availability of the federated learning model when the data of each participant is independent and non-identical. Applying the trained federated learning model to the recommendation system can not only quickly obtain the information to be recommended and improve the efficiency of obtaining the information to be recommended, but also can recommend targeted target information to the user in combination with the user's feature data, so that the target information can match the feature data of the target user, and improve the accuracy of the recommended target information.
[0188] Based on the above embodiments, the present application further provides a method for training a federated learning model, which is applied to Figure 1 The network architecture shown, Figure 8 A schematic diagram of another implementation flow of the training method of the federated learning model provided in the embodiment of the present application is as follows: Figure 8 As shown, the training method of the federated learning model provided in the embodiment of the present application is illustrated by taking two participant devices (a first participant device and a second participant device) as an example.
[0189] Step S801: The server device obtains an initialized federated learning model.
[0190] In step S802, the server device sends the initialized federated learning model to each participating device.
[0191] During implementation, the server device can send the overall structure of the initialized federated learning model to each participating device for training, or send the local structure of the initialized federated learning model to each participating device for training. In other words, the structure of the initialized federated learning model received by each participating device can be the same or different.
[0192] When the participating device receives the overall structure, the overall structure of the federated learning model can be trained quickly, but each participating device can know the overall structure of the federated learning model, which may lead to certain privacy leakage. When the participating device receives the partial structure, each participating device can only know the partial structure of the federated learning model, but cannot know the overall structure of the federated learning model, thus achieving privacy protection for the structure of the federated learning module. However, with this training method, since the participating devices can only train part of the structure of the federated learning model each time, more training is required to obtain a converged federated learning model, and the training efficiency of the federated learning model is low.
[0193] Step S803: Each participant device updates the initialized federated learning model according to its own private training data to obtain an updated federated learning model.
[0194] Each participant's device trains the initialized federated learning model locally based on its own private data to obtain an updated federated learning model. The private data of each participant's device does not leave the local location, ensuring the privacy protection of the private data of each participant's device.
[0195] Step S804: Each participant's device obtains the trained classification model and public data set.
[0196] Obtaining a trained classification model can be implemented as follows: obtaining a preset classification model and a classification training data set, the classification training data set including a first data subset and a second data subset, the first data subset including the private training data and corresponding labels, the second data subset including the public data and corresponding labels; training the preset classification model according to the first data subset and the second data subset to obtain a trained classification model.
[0197] In step S805, each participant's device inputs each public data in the public data set into the trained classification model to obtain a classification prediction value for each public data.
[0198] The classification prediction value of the public data obtained by the first participant device is used to characterize the probability that the public data comes from the first participant device. Similarly, the classification prediction value of the public data obtained by the second participant device is used to characterize the probability that the public data comes from the second participant device.
[0199] Step S806: Each participant device determines the weight of each public data according to the classification prediction value of each public data.
[0200] The nth participant device sends the ith public data Input to the trained nth classification model φ n , get the i-th public data The classification prediction value of according to The weight w of the i-th public data determined by the n-th participant device is determined by the above formula (1): in .
[0201] In step S807, each participant device sends the weight of each public data and the updated federated learning model to the server device.
[0202] In step S808, the server device aggregates the updated federated learning models sent by each participating device to obtain an initial teacher model.
[0203] Here, when the server device aggregates the updated federated learning models sent by each participating device, a federated averaging algorithm can be used to perform weighted averaging on the updated federated learning models sent by each participating device to obtain an initial teacher model.
[0204] Step S809: The server device obtains a public data set.
[0205] This public dataset is jointly held by multiple participant devices participating in federated training.
[0206] Step S810: The server device adjusts each public data in the corresponding public data set based on the weight of each public data in the public data set sent by each participant device, and obtains a target data set corresponding to each participant device.
[0207] The weight w of the ith public data determined by the nth participant's device in , for the i-th public data When adjusting the phase, the following formula (2) can be used for adjustment:
[0208]
[0209] That is, the value obtained by multiplying each public data by the corresponding weight is determined as the target data, and according to the weight of each public data in the public data set determined by each participant's device, each public data in the public data set is adjusted to obtain the target data set corresponding to each participant's device.
[0210] Step S811: The server device trains the student model corresponding to each participant device based on the teacher model and the target data set corresponding to each participant device.
[0211] When the server-side device trains the student model corresponding to each participant device, the following operations are performed for the target data set corresponding to each participant device: multiple data in the target data set are input into the teacher model respectively to obtain the corresponding prediction results; the prediction results are used as labels for the corresponding data to construct the training samples of the student model corresponding to the participant device; based on the constructed training samples, the student model corresponding to the participant device is trained, which is recorded as Where j = 1, 2, 3, ..., indicating the number of training times.
[0212] Step S812: The server device sends each student model to the corresponding participant device.
[0213] The server device will Send to the first party's device, Send to the second party device, ..., Sent to the Nth participant's device.
[0214] Step S813: Each participant's device obtains private training data of each participant's device.
[0215] Step S814: Each participant's device updates the student model according to the private training data to obtain an updated student model.
[0216] After the server device sends each student model to the corresponding participant device, each participant device compares the corresponding student model based on its own private data. Train and get the updated student model The updated student model is not only applicable to the public data of the participating devices, but also to the private data of the participating devices, and takes into account the distribution of data held by the participating devices, so that the teacher model aggregated according to the updated student model is adapted to the personalized data distribution of each participating device.
[0217] Step S815: Each participant device sends the updated student model to the server device.
[0218] Step S816: The server device updates the teacher model according to the updated student models sent by each participant device to obtain an updated teacher model.
[0219] Here, when the server device aggregates the updated student models, the weighted average of the multiple updated student models can be used as the updated teacher model. The teacher model after the jth update is denoted as Θ j ,but
[0220] Step S817: The server device determines whether the updated teacher model meets the preset convergence condition.
[0221] The server device is pre-set with the end training condition. In the embodiment of the present application, the end training condition can be to meet the preset convergence condition. After obtaining the updated teacher model, the server device determines whether the current teacher model meets the preset convergence condition (such as the cumulative decrease in the loss function value of the teaching model for 5 consecutive rounds of training does not exceed the preset threshold δ). When the preset convergence condition is met, step S818 is entered to determine the updated teacher model as the trained federated learning model; otherwise, return to step S811 and continue training until the end training condition is met.
[0222] In step S818, the server device determines the updated teacher model as the trained federated learning model.
[0223] The training method of the federated learning model provided in the embodiment of the present application is that the server device trains the student model according to the public data set and the teacher model, and the participant device then trains the student model according to the private training data, which can make the federated learning model converge quickly and improve the training efficiency of the federated learning model; and when the server device trains the student model, the weight of the public data in the device of each participant is considered, and the federated learning model is trained in combination with the data distribution of the device of each participant, so that the trained federated learning model adapts to the personalized distribution of data in the device of each participant, which can greatly improve the availability of the federated learning model when the data of each participant is independent and non-identically distributed.
[0224] The federated learning model trained according to the training method of the federated learning model provided in the embodiment of the present application can be used in systems such as information recommendation and behavior prediction. Below, an exemplary description is given in the application scenario of applying the federated learning model provided in the embodiment of the present application to the recommendation system. Fig. 9 A schematic diagram of a network architecture of a recommendation system applying a federated learning model provided in an embodiment of the present application, such as Fig. 9As shown, in the recommendation system, at least a user terminal 500, a server device 100, a participant device 200-1 and a network 300 are included. To realize supporting an exemplary application, the server device 100 is a service terminal of federated learning, such as a server, etc. The server device 100 can be an independent physical server, or a server cluster or 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, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms. The participant device 200-1 is a participating terminal of federated learning, and the user terminal 500 and the participant device 200-1 can be a laptop, a tablet computer, a desktop computer, a smart phone, a dedicated messaging device, a portable gaming device, a smart speaker, a smart watch, etc., but are not limited to this. The server device 100 and the user terminal 500 are respectively connected to the participant device 200-1 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two, and data transmission is achieved using wireless or wired links.
[0225] When using the recommendation system provided in the embodiment of the present application to recommend information, the participant device 200-1 responds to the operation instruction for obtaining the target information for the target user and sends a request message to the server device 100. The server device 100 receives and responds to the request message and sends the pre-trained federated learning model to the participant device 200-1. The participant device 200-1 obtains the characteristic data of the target user, which includes at least one of the attribute data and behavior data of the target user, and then inputs the characteristic data into the trained federated learning model to obtain the target information for the target user, and sends the target information to the user terminal 500, which displays the target information for the user to view. In the embodiment of the present application, the federated learning model is obtained by training based on knowledge distillation by the server device 100 and the participant device 200-1, the participant device 200-2, ..., the participant device 200-k. Using the trained federated learning model for information recommendation can quickly obtain the information to be recommended and improve the efficiency of obtaining the information to be recommended.
[0226] Fig.10 A schematic diagram of an implementation flow of a recommended method for applying a federated learning model provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the recommendation method provided in the embodiment of the present application is implemented by the user terminal, the first participant device and the server device in collaboration, and the recommendation method includes the following steps:
[0227] Step S1001: The first participant device sends a request message to the server device in response to an operation instruction for obtaining target information for a target user.
[0228] The operation instruction may be actively triggered by the first participant device, or may be triggered in response to a specific operation performed by the target user on the user terminal (such as a search operation in a search bar of an application). The request information is used to obtain a pre-trained federated learning model from the server device.
[0229] Step S1002: The server device sends the trained federated learning model to the participant device in response to the request information.
[0230] The training process of the trained federated learning model can refer to the detailed description of the above embodiment of the present application. The server device sends the trained federated learning model to the participant device, so that the participant device determines the target information for the target user based on the feature data of the target user and the trained federated learning model.
[0231] Step S1003: The first participant device obtains characteristic data of the target user.
[0232] Here, the first participant device may obtain the characteristic data of the target user from the user terminal. In other embodiments, the first participant device may also obtain the characteristic data of the target user from the user terminal in advance, store it in a preset storage space, and obtain the characteristic data of the target user from the preset storage space when information recommendation is required for the target user. The characteristic data includes at least one of the attribute data and behavior data of the target user. The attribute data may be data such as the date of birth, mobile phone number, height, preferences, etc. of the target user, and the behavior data may be data such as operation preferences, historical purchase behavior, etc.
[0233] Step S1004: The first participant device inputs the feature data into the trained federated learning model to obtain target information for the target user.
[0234] The trained federated learning model is obtained by training a server device and multiple participant devices based on knowledge distillation. By using the trained federated learning model for information recommendation, the information to be recommended can be obtained quickly, thereby improving the efficiency of obtaining the information to be recommended.
[0235] Step S1005: The first participant device sends the target information to the user terminal.
[0236] Step S1006: the user terminal outputs target information.
[0237] Since the first participant device obtains the target information based on the characteristic data of the target user itself, the target information can be matched with the attribute data and behavior data of the target user. For example, the recommendation method can be applied in a shopping application, so that the target information recommended to the target user is targeted, which can improve the success rate of the transaction.
[0238] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0239] In horizontal federated learning, all participants need to send the updated model to the server after completing the local model update to complete the model aggregation process. Existing federated learning model aggregation is based on the federated average algorithm. Although this type of algorithm is easy to implement, during the federated learning process, the server collects the models uploaded by the participants and takes the weighted average of the uploaded models as the updated global model. However, the federated average algorithm converges slowly in practical applications, and the final model after convergence is not effective. At the same time, the federated learning method cannot solve the problem that the data of the participants are independent but differently distributed, resulting in the same federated learning model trained for all participants not being able to achieve relatively good results on the data of all participants. The related technology cannot train the federated learning model for different participants in a personalized manner.
[0240] Based on the above problems, an embodiment of the present application provides a new model aggregation algorithm to ensure that the updated global model converges quickly, and considers the data distribution characteristics of each participant when training the federated learning model, realizes personalized federated learning for each participant, and finally trains a federated learning model suitable for the data distribution of each participant, which can improve the performance of the federated learning model.
[0241] Fig.11 A schematic diagram of an implementation flow of a personalized federated learning method based on model distillation provided in an embodiment of the present application is shown below in conjunction with Fig.11 The training process of the federated learning model of the embodiment of the present application is explained in detail.
[0242] In the embodiment of the present application, it is assumed that there are N participants (corresponding to the participant devices in the above embodiment) and 1 server (corresponding to the server device in the above embodiment). Each has its own training data set D n ,in All participants have a public dataset D G ,in Set the maximum number of training rounds J, and the termination condition: the global model is in the public dataset D G The minimum loss change on the .
[0243] Step S1101: Each participant trains a domain classifier.
[0244] Each participant P n Use your own data D n With the public dataset D G Train a domain classifier φ n (corresponding to the above classification model). During the training process, the n Data, labelled 1, from D G The data label is -1. The domain classifier can be a three-layer fully connected neural network. The output layer is processed by the activation function Sigmoid(), and the output value is used to represent the probability that the sample comes from the participant. A vector with n dimensions, each dimension output value is in the interval [0, 1]. The output value of the nth dimension is used to represent the probability that the input sample comes from the nth participant.
[0245] Step S1102: Each participant predicts the weight of the public data and sends it to the server.
[0246] Weight prediction: Each participant P n All data features of the dataset will be made public Input domain classification model φ n In the model output value represents the i-th sample From participant P n Continue to obtain samples from the common data to train the participant P n The corresponding weights in the student model process
[0247] All participants P n Find the public dataset D G Each piece of training data corresponds to its own weight w in . And send the calculated weight to the server.
[0248] Step S1103: The server initializes the federated learning model.
[0249] Step S1104: the server distributes the federated learning model to each participant.
[0250] Start federated learning. Initialize the first round of federated training. The server initializes the federated learning model Θ1 and sends the federated learning model to all participants. The server sends the trained federated learning model to each participant.
[0251] Step S1105: Each participant updates the model locally.
[0252] All parties involved Based on their respective datasets Dn Update model θ j , and get the updated model Here θ j is θ j The global structure or partial structure of .
[0253] Step S1106: Each participant uploads the updated model to the server.
[0254] Step S1107: the server generates an integrated model and initializes the parameters of the integrated model.
[0255] The server integrates the received models to obtain an integrated model:
[0256] Step S1108: The server uses the trained integrated model as a teacher model.
[0257] In step S1109, the server trains the student model for each participant based on weighted public data using a knowledge distillation method.
[0258] In step S1110, the server sends the trained student model to the corresponding participant, and the participant verifies the model locally.
[0259] The server will integrate the model Θ j As a teacher model, in the public dataset D G Train N student models on The training method is the knowledge distillation method. During the training process, for the participant P n , the server has data on each public dataset Multiply the corresponding weight w received in step S1102 in .
[0260] The server will train each student model Sent to participant P n .
[0261] Step S1111, the participants determine whether the convergence conditions are met, and if so, exit the training.
[0262] P n Testing on local data If the cumulative decrease of the loss function value of θ does not exceed δ for 5 consecutive rounds of training, then P n To exit the training, other participants return to step S1105; otherwise, proceed to step S1112.
[0263] Step S1112: The server determines whether the training termination condition is met.
[0264] If j+1>J, the maximum number of training rounds is reached, and all participants stop training and return to their respective As a participant P n The final model is obtained, and the federated learning ends, and the process goes to step S1113 to stop the training. Otherwise, the process returns to step S1105, and the server and the remaining participants continue the personalized federated learning training.
[0265] Step S1113, end the training.
[0266] The training method of the federated learning model provided in the embodiment of the present application replaces the previous federated learning model aggregation method based on model averaging with a federated learning model aggregation method based on model distillation and model averaging during the training process. At the same time, each participant trains a domain classifier to obtain a sample weight of a public data set. The server distills a personalized federated learning model for each participant's knowledge based on the sample weight of the public data set of each participant. After multiple iterations, each participant will obtain a personalized federated learning model.
[0267] It should be noted that the models between the participants in the embodiments of the present application do not need to have the same structure, only that all models need to have the same input and output dimensions.
[0268] The model aggregation method based on model distillation used in the embodiment of the present application integrates the models of all participants, and further trains an ensemble model (ensemble) based on the output results of the participant models. The integrated ensemble model is used as a teacher model to train a student model. The trained student model is distributed to all participants as an updated global model. The student model performance obtained by this updating method is better than the model performance obtained based on the model averaging method. The trained model converges more quickly, and the final global model performance is better than the global model obtained based on the model averaging method. At the same time, the embodiment of the present application proposes a personalized federated learning method based on knowledge distillation, which trains a personalized model for each participant, which can greatly improve the availability of the model when the data of the participants are not independent and identically distributed.
[0269] The following is an exemplary structure of a software module implemented as a training device for a federated learning model provided in an embodiment of the present application. In some embodiments, Figure 2 As shown, the software modules stored in the training device 455 of the federated learning model in the memory 450 may include:
[0270] A first acquisition module 4551 is used to acquire an initial teacher model and a public data set, where the public data set is jointly held by multiple participant devices participating in the federated training;
[0271] A first training module 4552 is used to train a student model corresponding to each participant device based on the teacher model and the public data set;
[0272] The first sending module 4553 is used to send each student model to a corresponding participant device, so that each participant device updates the corresponding student model according to the training data held by each participant device to obtain an updated student model;
[0273] A first updating module 4554 is used to update the teacher model according to the updated student model sent by each participant device to obtain an updated teacher model;
[0274] The first determination module 4555 is used to determine the updated teacher model as a trained federated learning model when the updated teacher model meets a preset convergence condition.
[0275] In some embodiments, the training device of the federated learning model further includes: a first receiving module, configured to receive the weight of each public data in the public data set sent by each of the participant devices;
[0276] Before the training is performed to obtain the student model corresponding to each participant device, the first training module 4552 is further used to:
[0277] Based on the weight of each public data in the public data set sent by each of the participant devices, adjust each public data in the corresponding public data set to obtain a target data set corresponding to each of the participant devices;
[0278] Based on the teacher model and the target data set corresponding to each participant's device, a student model corresponding to each participant's device is trained.
[0279] In some embodiments, the first receiving module is further used to receive request information sent by the participant device, where the request information is used to obtain a trained federated learning model;
[0280] The first sending module 4553 is also used to send the trained federated learning model to the participant device in response to the request information, so that the participant device determines the target information for the target user based on the feature data of the target user and the trained federated learning model.
[0281] In some embodiments, the first training module 4552 is further used to:
[0282] Inputting multiple data in the target data set into the teacher model respectively to obtain corresponding prediction results;
[0283] Using the prediction results as labels for corresponding data, constructing training samples of the student model corresponding to the participant device;
[0284] Based on the constructed training samples, the student model corresponding to the participant device is trained.
[0285] In some embodiments, the first acquisition module 4551 is further used to:
[0286] Get the initialized federated learning model;
[0287] Sending the initialized federated learning model to the multiple participant devices, so that each of the participant devices updates the initialized federated learning model according to its own private training data to obtain an updated federated learning model;
[0288] Receiving an updated federated learning model sent by each of the participating devices;
[0289] The updated federated learning models sent by the participating devices are aggregated to obtain an initial teacher model.
[0290] In some embodiments, the first training module 4552 is further used to train an updated student model corresponding to each participant device based on the updated teacher model and the public data set when the updated teacher model does not meet the preset convergence condition;
[0291] The first sending module 4553 is further used to send each updated student model to a corresponding participant device, so that each participant device updates the corresponding updated student model again according to its own private training data to obtain a re-updated student model;
[0292] The first updating module 4554 is also used to aggregate the updated federated learning models sent by each of the participating devices to obtain a further updated teacher model.
[0293] The present application embodiment provides a training device for a federated learning model, the device comprising:
[0294] A second receiving module is used to receive a student model sent by a server device, where the student model is trained by the server device according to a teacher model and a public data set, and the public data set is jointly held by multiple participant devices participating in the federated training;
[0295] A second acquisition module, used to acquire private training data of the participant device;
[0296] A second updating module, used for updating the student model according to the training data to obtain an updated student model;
[0297] The second sending module is used to send the updated student model to the server device so that the server device updates the teacher model according to the updated student model, and when the updated teacher model meets the preset convergence condition, determines the updated teacher model as the trained federated learning model.
[0298] In some embodiments, the training device of the federated learning model further includes:
[0299] A third acquisition module is used to acquire the public data set and the trained classification model;
[0300] A classification module, used to input each public data in the public data set into the trained classification model to obtain a classification prediction value of each public data, wherein the classification prediction value of the public data is used to characterize the probability that the public data comes from the device of the participant;
[0301] A second determination module is used to determine the weight of each public data according to the classification prediction value of each public data;
[0302] The second sending module is also used to send the weights of the various public data to the server device, so that the server device trains the student model according to the teacher model, the public data set and the weights of the various public data.
[0303] In some embodiments, the second sending module is further used to send request information to the server device in response to an operation instruction for obtaining target information for a target user;
[0304] The second receiving module is further used to receive the trained federated learning model sent by the server device;
[0305] A fourth acquisition module, configured to acquire characteristic data of the target user, wherein the characteristic data includes at least one of attribute data and behavior data of the target user;
[0306] An input module is used to input the feature data into the trained federated learning model to obtain target information for the target user.
[0307] In some embodiments, the training device of the federated learning model further includes:
[0308] a fifth acquisition module, configured to acquire a preset classification model and a classification training data set, wherein the classification training data set includes a first data subset and a second data subset, wherein the first data subset includes the private training data and corresponding labels, and the second data subset includes the public data and corresponding labels;
[0309] The second training module is used to train the preset classification model according to the first data subset and the second data subset to obtain a trained classification model.
[0310] In some embodiments, before receiving the student model sent by the server device, the second receiving module is further used to receive the initialized federated learning model sent by the server device;
[0311] The second updating module is further used to update the initialized federated learning model according to the private training data to obtain an updated federated learning model;
[0312] The second sending module is also used to send the updated federated learning model to the server device, so that the server device determines the initial teacher model according to the updated federated learning model.
[0313] It should be noted here that the description of the above federated learning model training device embodiment is similar to the above method description and has the same beneficial effects as the method embodiment. For technical details not disclosed in the training device embodiment of the federated learning model of this application, technicians in this field should refer to the description of the method embodiment of this application for understanding.
[0314] The present application embodiment provides a storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the method provided by the present application embodiment, for example, Figure 3 The method shown.
[0315] In some embodiments, the storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories.
[0316] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0317] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0318] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0319] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A training method for a federated learning model, characterized in that: Applied to a server device, the method comprises: Obtain an initial teacher model and a public dataset, where the public dataset is jointly held by multiple participant devices participating in federated training; Based on the teacher model and the public data set, a student model corresponding to each participant's device is obtained by training; Sending each student model to a corresponding participant device, so that each participant device updates the corresponding student model according to its own private training data to obtain an updated student model; According to the updated student models sent by the devices of each participant, the teacher model is updated to obtain an updated teacher model; When the updated teacher model meets the preset convergence condition, determining the updated teacher model as a trained federated learning model; Before the training obtains the student model corresponding to each participant device, the method further includes: Receiving the weight of each public data in the public data set sent by each of the participating party devices; The training of obtaining a student model corresponding to each participant device based on the teacher model and the public data set includes: Based on the weight of each public data in the public data set sent by each of the participant devices, adjust each public data in the corresponding public data set to obtain a target data set corresponding to each of the participant devices; Based on the teacher model and the target data set corresponding to each participant's device, a student model corresponding to each participant's device is trained; Wherein, the method further comprises: The participant device sends request information to the server device in response to an operation instruction for obtaining target information for a target user; The participant device receives the trained federated learning model sent by the server device; The participant device acquires feature data of the target user, where the feature data includes at least one of attribute data and behavior data of the target user; The participant device inputs the feature data into the trained federated learning model to obtain target information for the target user.
2. The method according to claim 1, characterized in that The method further comprises: Receiving request information sent by the participant device, where the request information is used to obtain a trained federated learning model; In response to the request information, the trained federated learning model is sent to the participant device, so that the participant device determines the target information for the target user according to the feature data of the target user and the trained federated learning model.
3. The method according to claim 1, characterized in that The training of obtaining a student model corresponding to each participant device based on the teacher model and the target data set corresponding to each participant device includes: For the target data set corresponding to each participant's device, perform the following operations: Inputting multiple data in the target data set into the teacher model respectively to obtain corresponding prediction results; Using the prediction results as labels for corresponding data, constructing training samples of the student model corresponding to the participant device; Based on the constructed training samples, the student model corresponding to the participant device is trained.
4. The method according to claim 1, characterized in that: The obtaining of the initial teacher model comprises: Get the initialized federated learning model; Sending the initialized federated learning model to the multiple participant devices, so that each of the participant devices updates the initialized federated learning model according to its own private training data to obtain an updated federated learning model; Receiving an updated federated learning model sent by each of the participating devices; The updated federated learning models sent by the participating devices are aggregated to obtain an initial teacher model.
5. The method according to claim 1, characterized in that: The method further comprises: When the updated teacher model does not meet the preset convergence condition, based on the updated teacher model and the public data set, training to obtain an updated student model corresponding to each participant device; Sending each updated student model to a corresponding participant device, so that each participant device updates the corresponding updated student model again according to its own private training data to obtain a further updated student model; The updated federated learning models sent by the participating devices are aggregated to obtain an updated teacher model.
6. A method for training a federated learning model, characterized in that: Applied to a participant device, the method comprises: Receiving a student model sent by a server device, where the student model is trained by the server device according to a teacher model and a public data set, where the public data set is jointly held by multiple participant devices participating in the federated training; Acquiring private training data of the participant device; Updating the student model according to the private training data to obtain an updated student model; Sending the updated student model to the server device so that the server device updates the teacher model according to the updated student model, and determining the updated teacher model as a trained federated learning model when the updated teacher model meets a preset convergence condition; Wherein, the method further comprises: In response to an operation instruction for obtaining target information for a target user, sending request information to the server device; Receiving the trained federated learning model sent by the server device; Acquire characteristic data of the target user, wherein the characteristic data includes at least one of attribute data and behavior data of the target user; Inputting the feature data into the trained federated learning model to obtain target information for the target user; The method comprises: The server device receives the weight of each public data in the public data set sent by each participant device; The student model is trained by the server device according to the teacher model and the public data set, including: The server device adjusts each public data in the corresponding public data set based on the weight of each public data in the public data set sent by each participant device to obtain a target data set corresponding to each participant device; The server device trains a student model corresponding to each participant device based on the teacher model and the target data set corresponding to each participant device.
7. The method according to claim 6, characterized in that Before receiving the student model sent by the server device, the method further includes: Obtaining a trained classification model and the public dataset; Input each public data in the public data set into the trained classification model to obtain a classification prediction value of each public data, where the classification prediction value of the public data is used to characterize the probability that the public data comes from the device of the participant; Determining the weight of each public data according to the classified prediction value of each public data; The weights of the various public data are sent to the server device, so that the server device trains the student model according to the teacher model, the public data set and the weights of the various public data.
8. The method according to claim 7, characterized in that The step of obtaining a trained classification model comprises: Acquire a preset classification model and a classification training data set, wherein the classification training data set includes a first data subset and a second data subset, wherein the first data subset includes the private training data and corresponding labels, and the second data subset includes the public data and corresponding labels; The preset classification model is trained according to the first data subset and the second data subset to obtain a trained classification model.
9. The method according to claim 6, characterized in that Before receiving the student model sent by the server device, the method further includes: Receiving the initialized federated learning model sent by the server device; Updating the initialized federated learning model according to the private training data to obtain an updated federated learning model; The updated federated learning model is sent to the server device so that the server device determines an initial teacher model according to the updated federated learning model.
10. A training device for a federated learning model, characterized in that: The device comprises: A first acquisition module is used to acquire an initial teacher model and a public data set, where the public data set is jointly held by multiple participant devices participating in the federated training; A first training module is used to train a student model corresponding to each participant device based on the teacher model and the public data set; A first sending module is used to send each student model to a corresponding participant device, so that each participant device updates the corresponding student model according to the training data held by each participant device to obtain an updated student model; A first updating module, configured to update the teacher model according to the updated student model sent by each participant device to obtain an updated teacher model; A first determination module, configured to determine the updated teacher model as a trained federated learning model when the updated teacher model meets a preset convergence condition; The apparatus further includes: receiving a weight of each public data in the public data set sent by each of the participant devices; The training of obtaining a student model corresponding to each participant device based on the teacher model and the public data set includes: Based on the weight of each public data in the public data set sent by each of the participant devices, adjust each public data in the corresponding public data set to obtain a target data set corresponding to each of the participant devices; Based on the teacher model and the target data set corresponding to each participant's device, a student model corresponding to each participant's device is trained; The apparatus further includes: the participant device sending request information to the server device in response to an operation instruction for obtaining target information for a target user; The participant device receives the trained federated learning model sent by the server device; The participant device acquires feature data of the target user, where the feature data includes at least one of attribute data and behavior data of the target user; The participant device inputs the feature data into the trained federated learning model to obtain target information for the target user.
11. A training device for a federated learning model, characterized in that: The device comprises: A second receiving module is used to receive a student model sent by a server device, where the student model is trained by the server device according to a teacher model and a public data set, and the public data set is jointly held by multiple participant devices participating in the federated training; A second acquisition module, used to acquire private training data of the participant device; A second updating module, used for updating the student model according to the training data to obtain an updated student model; A second sending module is used to send the updated student model to the server device, so that the server device updates the teacher model according to the updated student model, and when the updated teacher model meets the preset convergence condition, determines the updated teacher model as the trained federated learning model; The device further comprises: sending request information to the server device in response to an operation instruction for obtaining target information for a target user; Receiving the trained federated learning model sent by the server device; Acquire characteristic data of the target user, wherein the characteristic data includes at least one of attribute data and behavior data of the target user; Inputting the feature data into the trained federated learning model to obtain target information for the target user; The device comprises: The server device receives the weight of each public data in the public data set sent by each participant device; The student model is trained by the server device according to the teacher model and the public data set, including: The server device adjusts each public data in the corresponding public data set based on the weight of each public data in the public data set sent by each participant device to obtain a target data set corresponding to each participant device; The server device trains a student model corresponding to each participant device based on the teacher model and the target data set corresponding to each participant device.
12. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor, used to implement the training method of the federated learning model described in any one of claims 1 to 5 or claims 6 to 9 when executing the executable instructions stored in the memory.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores executable instructions for causing the processor to execute and implement the training method of the federated learning model described in any one of claims 1 to 5 or claims 6 to 9.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the training method of the federated learning model described in any one of claims 1 to 5 or claims 6 to 9 is implemented.
Citation Information
Patent Citations
Small classification model training method and device based on knowledge distillation
CN111709476A
Machine learning model training method and device
CN111832591A