Federal learning-based model training method and device, equipment and storage medium

By adding noise to the data features in the terminal device and conducting training, the problem of terminal device data being stolen or tampered with during the communication process is solved, and both data protection and model training are achieved.

CN119338023APending Publication Date: 2025-01-21GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310900504.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-20
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

During the communication between the terminal device and the mobile edge server, the local data of the terminal device may be stolen or tampered with, resulting in the disclosure of the user's personal privacy.

Method used

By receiving the sub-model in the terminal device, the features of the input data are extracted and noise is added to form protected features so that the sub-model can be trained and sent to the network device.

Benefits of technology

It realizes the protection of terminal device data, avoids the leakage of data privacy, and allows the normal progress of model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119338023A_ABST
    Figure CN119338023A_ABST
Patent Text Reader

Abstract

The invention discloses a federated learning-based model training method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: receiving at least one sub-model, wherein the at least one sub-model is used for performing federated learning of a global model; extracting a first feature of input data based on the at least one sub-model, wherein the input data is data used for training the at least one sub-model in the terminal device; noise is added to the first feature to obtain a second feature, and the noise is used for protecting the first feature; training the at least one sub-model based on the second feature; and sending the trained at least one sub-model to network equipment. According to the method, the data used for training the sub-model in the terminal equipment can be protected, so that the data privacy of the terminal equipment is prevented from being leaked.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a model training method, apparatus, device and storage medium based on federated learning. Background Art

[0002] With the development of smart devices and communication technologies, Mobile Edge Computing (MEC) has emerged as a technology that supports Quality of Service (QoS) requirements and can provide real-time services with local computing power, low latency, and large-bandwidth communications.

[0003] In the related technology, by combining Federated Learning (FL) and MEC, a communication connection is established between the terminal device and the mobile edge server, so that the local data corresponding to the terminal device is moved to the edge of the network for calculation.

[0004] However, during the communication between the terminal device and the mobile edge server, the local data corresponding to the terminal device may be stolen or tampered with during the transmission process, which may cause the user's personal privacy to be leaked. Summary of the invention

[0005] The embodiment of the present application provides a model training method, apparatus, device and storage medium based on federated learning. The technical solution is as follows:

[0006] According to one aspect of the present application, a model training method based on federated learning is provided, the method being executed by a terminal device, the method comprising:

[0007] receiving at least one sub-model, wherein the at least one sub-model is used for performing federated learning of a global model;

[0008] Extracting a first feature of input data based on the at least one sub-model, the input data being data in the terminal device used for training the at least one sub-model;

[0009] adding noise to the first feature to obtain a second feature, wherein the noise is used to protect the first feature;

[0010] Training the at least one sub-model based on the second feature;

[0011] The at least one sub-model that has been trained is sent to the network device.

[0012] According to another aspect of the present application, a model training method based on federated learning is provided, the method being executed by a network device, the method comprising:

[0013] Divide the global model into n sub-models;

[0014] Allocating at least one sub-model of the n sub-models to each of the m terminal devices, wherein the at least one sub-model is used for performing federated learning of the global model;

[0015] receiving the n sub-models that have been trained, where the n sub-models are trained by the m terminal devices by adding noise to a first feature of input data, the input data is data used in the m terminal devices for training the n sub-models, and the noise is used to protect the first feature;

[0016] Wherein, the value of n is a positive integer greater than 1, and the value of m is a positive integer greater than 0.

[0017] According to another aspect of the present application, a model training device based on federated learning is provided, the device comprising:

[0018] A receiving module, configured to receive at least one sub-model, wherein the at least one sub-model is used for performing federated learning of a global model;

[0019] an extraction module, configured to extract a first feature of input data based on the at least one sub-model, wherein the input data is data in the terminal device used for training the at least one sub-model;

[0020] An adding module, used for adding noise to the first feature to obtain a second feature, wherein the noise is used to protect the first feature;

[0021] A training module, configured to train the at least one sub-model based on the second feature;

[0022] The sending module is used to send the at least one sub-model that has been trained to the network device.

[0023] According to another aspect of the present application, a model training device based on federated learning is provided, the device comprising:

[0024] A partitioning module is used to partition the global model into n sub-models;

[0025] A sending module, used to allocate at least one sub-model of the n sub-models to each of the m terminal devices, wherein the at least one sub-model is used to perform federated learning of the global model;

[0026] a receiving module, configured to receive the n sub-models that have been trained, wherein the n sub-models that have been trained are obtained by adding noise to a first feature of input data of the m terminal devices, the input data is data used in the m terminal devices for training the n sub-models, and the noise is used to protect the first feature;

[0027] Wherein, the value of n is a positive integer greater than 1, and the value of m is a positive integer greater than 0.

[0028] According to another aspect of the present application, a terminal device is provided, which includes: a processor, a memory and a transceiver, the processor is connected to the transceiver, at least one program is stored in the memory, and the at least one program is loaded and executed by the processor to implement the model training method based on federated learning as described above.

[0029] According to another aspect of the present application, a network device is provided, comprising: a processor, a memory and a transceiver, the processor being connected to the transceiver, the memory storing at least one program, and the at least one program being loaded and executed by the processor to implement the model training method based on federated learning as described above.

[0030] According to another aspect of the present application, a computer-readable storage medium is provided, in which at least one program is stored. The at least one program is loaded and executed by a processor to implement the model training method based on federated learning as described above.

[0031] According to another aspect of the present application, a computer program product is provided, which includes at least one program segment, and the at least one program segment is stored in a computer-readable storage medium; a processor of a communication device reads the at least one program segment from the computer-readable storage medium, and the processor executes the at least one program segment, so that the communication device performs the model training method based on federated learning as described above.

[0032] According to another aspect of the present application, a computer program is provided, which includes at least one program segment, and the at least one program segment is stored in a computer-readable storage medium; a processor of a communication device reads the at least one program segment from the computer-readable storage medium, and the processor executes the at least one program segment, so that the communication device performs the model training method based on federated learning as described above.

[0033] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0034] The terminal device receives at least one sub-model for performing federated learning of a global surface model sent by a network device, extracts a first feature of data in the terminal device for training the at least one sub-model through the at least one sub-model, and obtains a second feature with noise by adding noise for protection to the first feature, so that the terminal device can train the at least one sub-model using the second feature with noise, and protects the data of the terminal device through noise, thereby preventing the data privacy of the terminal device from being leaked. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0036] Figure 1 is a schematic diagram of federated learning provided by an exemplary embodiment of the present application;

[0037] Figure 2 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0038] Figure 3 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0039] Figure 4 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0040] Figure 5 is a schematic diagram of dividing sub-matrices provided by another exemplary embodiment of the present application;

[0041] Figure 6 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0042] Figure 7 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0043] Figure 8 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0044] Fig. 9 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0045] Fig.10 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0046] Fig.11 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0047] Fig.12 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0048] Fig.13 is a flowchart of a model training method based on federated learning provided by another exemplary embodiment of the present application;

[0049] Fig.14 is a block diagram of a model training device based on federated learning provided by another exemplary embodiment of the present application;

[0050] Fig.15 It is a block diagram of a model training device based on federated learning provided by another exemplary embodiment of the present application. DETAILED DESCRIPTION

[0051] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0052] First, the relevant terms involved in the embodiments of the present application are introduced:

[0053] Federated learning: refers to a distributed machine learning method. A federated learning process consists of multiple rounds of training, where multiple terminal devices work together to build a global model and jointly train the global model. Only some terminal devices are selected to participate in each round of training.

[0054] Mobile edge computing: It is a distributed computing method based on mobile communication networks, which performs computing and storage resources by moving them to the edge of the network.

[0055] Mobile edge server: A server used to provide mobile edge computing to terminal devices.

[0056] Normalization layer: used to normalize the feature values ​​output by the model so that the feature values ​​output by the model are within the standard threshold. The standard threshold is used to indicate the maximum and minimum values ​​of the feature values ​​output by the model.

[0057] Figure 1 FIG. 1 is a schematic diagram of federated learning provided by an exemplary embodiment of the present application. In some embodiments, the federated learning is performed by the network device 10 and the terminal device 20 together.

[0058] In some embodiments, the network device 10 and the terminal device 20 form a communication system. In some embodiments, the communication system is one of a fourth generation (4G) mobile communication system, a fifth generation (5G) mobile communication system, a Beyond Fifth Generation (B5G) mobile communication system, and a sixth generation (6G) mobile communication system.

[0059] In some embodiments, the network device 10 in the embodiment of the present application includes a cloud server 11, a base station 12 and a mobile edge server 13. The cloud server 11 communicates and interacts with the base station 12, and the cloud server 11 is used to divide the global model for federated learning into n sub-models or reconstruct the n sub-models into a global model for federated federated learning, where n is a positive integer greater than 1. The base station 12 also communicates and interacts with the terminal device 20, and the base station 12 assigns the n sub-models divided by the cloud server 11 to the terminal device 20, or uploads the n sub-models trained by the terminal device 20 to the cloud server 11. The mobile edge server 13 is used to communicate and interact with the terminal device 20, and the mobile edge server 13 receives the data sent by the terminal device 20 for training the sub-model, and the mobile edge server 13 performs mobile edge computing on the data, and sends the calculated data to the terminal device 20.

[0060] For example, Figure 1 As shown, the base station 12 includes a first base station 14, a second base station 16, and a third base station 18, the mobile edge server 13 includes a first mobile edge server 15, a second mobile edge server 17, and a third mobile edge server 19, and the terminal device 20 includes a first terminal device 21, a second terminal device 22, and a third terminal device 23. Exemplarily, the cloud server 11 communicates and interacts with the first base station 14, the first base station 14 also communicates and interacts with the first terminal device 21, and the first terminal device 21 also communicates and interacts with the first mobile edge server 15. Exemplarily, the cloud server 11 also communicates and interacts with the second base station 16, the second base station 16 also communicates and interacts with the second terminal device 22, and the second terminal device 22 also communicates and interacts with the second mobile edge server 17. Exemplarily, the cloud server 11 also communicates and interacts with the third base station 18, the third base station 18 also communicates and interacts with the third terminal device 23, and the third terminal device 23 also communicates and interacts with the third mobile edge server 19.

[0061] In some embodiments, the network device 10 is used to provide wireless communication functions, and the network device 10 includes but is not limited to: Evolved Node B (eNB), Radio Network Controller (RNC), Node B (NB), Base Station Controller (BSC), Base Transceiver Station (BTS), Home Base Station (e.g., Home Evolved Node B, or Home Node B, HNB), Baseband Unit (BBU), Access Point (AP) in Wireless Fidelity (Wi-Fi) system, Wireless Relay Node, Wireless Backhaul Node, Transmission Point (TP) or Transmission and Reception Point (TRP), etc., and can also be the Next Generation Node B (Next Generation Node B) in the fifth generation (5G) mobile communication system. The network device 10 in the present application may also be a device that provides wireless communication functions for terminals in other communication systems that may appear in the future. The network device 10 in the present application may also be a device that provides wireless communication functions for terminals in other communication systems that may appear in the future. As communication technology evolves, the name "network device" may change. For the convenience of description, in the embodiments of the present application, the devices that provide wireless communication functions for the terminal are collectively referred to as network devices.

[0062] In some embodiments, the terminal device 20 is a device that can provide voice and / or data connectivity to a user. Terminal device, also known as access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent, user device. The terminal device 20 includes but is not limited to: handheld devices, wearable devices, vehicle-mounted devices and Internet of Things devices, such as: mobile phones, tablet computers, e-book readers, laptop computers, desktop computers, televisions, game consoles, mobile Internet devices (Mobile Internet Device, MID), augmented reality (Augmented Reality, AR) terminals, virtual reality (Virtual Reality, VR) terminals and mixed reality (Mixed Reality, MR) terminals, wearable devices, handles, electronic tags, controllers, wireless terminals in industrial control (Industrial Control), wireless terminals in self-driving (Self Driving), wireless terminals in remote medical care (Remote Medical), wireless terminals in smart grids (Smart Grid), wireless terminals in transportation safety (Transportation Safety), wireless terminals in smart cities (Smart City), wireless terminals in smart homes (Smart Home), wireless terminals in remote medical surgery (Remote Medical Surgery), cellular phones, cordless phones, Session Initiation Protocol (Session Initiation Protocol, SIP) phones, wireless local loops (Wireless Local Loops) Local Loop, WLL) station, Personal Digital Assistant (PDA), TV Set Top Box (STB), Customer Premise Equipment (CPE), etc.

[0063] The network device 10 and the terminal device 20 communicate with each other through a certain air interface technology. Exemplarily, there are two communication scenarios between the network device 10 and the terminal device 20: uplink communication scenario and downlink communication scenario. Among them, uplink communication refers to the terminal device 20 sending a signal to the network device 10; downlink communication refers to the network device 10 sending a signal to the terminal device 20.

[0064] Figure 2 is a flowchart of a model training method based on federated learning provided by an exemplary embodiment of the present application. The method is composed of Figure 1 The terminal device 20 shown in the figure performs the method, which includes:

[0065] Step 110: receiving at least one sub-model;

[0066] In some embodiments, the terminal device receives at least one sub-model sent by the network device, and the at least one sub-model is used to perform federated learning of the global model.

[0067] In some embodiments, the network device divides the global model into n sub-models, and the at least one sub-model is one or more of the n sub-models, and the value of n is a positive integer greater than 1.

[0068] In some embodiments, at least one sub-model among n sub-models sent by a network device is received by m terminal devices, and the value of m is a positive integer greater than 0.

[0069] Step 120: extracting a first feature of the input data based on at least one sub-model;

[0070] In some embodiments, the terminal device extracts the first feature of the input data based on the received at least one sub-model. The input data is data used to train the at least one sub-model in the terminal device. Exemplarily, if the terminal device runs an album management program, at least one of the picture data and the video data in the album management program is obtained as the input data.

[0071] In some embodiments, at least one sub-model received by the terminal device includes a feature extraction layer, and the feature extraction layer is used to extract features of input data input into the at least one sub-model to obtain a first feature. The first feature is a feature corresponding to the input data. Exemplarily, assuming that the sub-model is an image label classification model, the image k in the terminal device is input into the sub-model for feature extraction to obtain X z,j,k Among them, X z,j,k Represents the first feature of image k at position (z, j), where k is a positive integer greater than 0, z is a real number greater than or equal to 0, and j is a real number greater than or equal to 0.

[0072] Step 130: adding noise to the first feature to obtain a second feature;

[0073] In some embodiments, noise is added to the first feature to obtain a second feature. The second feature is also a feature corresponding to the input data. At the same time, the second feature is a feature with noise added to the first feature.

[0074] In some embodiments, the noise is used to protect the first feature. Exemplarily, the noise is Laplace noise. The noise is used to mask useful information in the first feature to achieve privacy protection.

[0075] Step 140: training at least one sub-model based on the second feature;

[0076] In some embodiments, the second feature with noise is used as a training sample of at least one sub-model, and the at least one sub-model is trained by the second feature with noise.

[0077] In some embodiments, the terminal device uploads the second feature with noise to a mobile edge server in the network device; the mobile edge server performs mobile edge computing based on the second feature with noise to obtain a computing result; the mobile edge server returns the computing result to the terminal device; the terminal device trains at least one sub-model based on the computing result. In some embodiments, the computing result at least includes a training loss for training at least one sub-model.

[0078] Step 150: Send at least one trained sub-model to a network device.

[0079] In some embodiments, the terminal device sends at least one trained sub-model to the network device, and the network device reconstructs the sub-model into a global model for federated learning.

[0080] To summarize, in the method provided in this embodiment, a terminal device receives at least one sub-model for performing federated learning of a global surface model sent by a network device, extracts a first feature of data in the terminal device for training the at least one sub-model through the at least one sub-model, and obtains a second feature with noise by adding noise for protection to the first feature, so that the terminal device can train the at least one sub-model using the second feature with noise, and protects the data of the terminal device through noise, thereby preventing the data privacy of the terminal device from being leaked.

[0081] In some embodiments, at least one sub-model received by the terminal device includes a normalization layer. Figure 3 As shown, the above step 130 can be replaced by the following sub-steps:

[0082] Step 131: input the first feature into a normalization layer to obtain a normalized feature;

[0083] In some embodiments, the normalization layer is used to normalize the first feature into a canonical feature.

[0084] In some embodiments, the first feature is input into a normalization layer to obtain a normalized feature like:

[0085]

[0086] Among them, X z,j,krepresents the first feature of image k at position (z, j), k is a positive integer greater than 0, z is a real number greater than or equal to 0, and j is a real number greater than or equal to 0; N refers to the batch size of the first feature used for normalization, and the first feature is normalized in each batch in batches, so that the data in the batch has a smaller variance and a larger mean, so as to reduce the internal covariate shift problem during training; Indicates that the value range is from arrive

[0087] In some embodiments, the mean satisfies:

[0088]

[0089] In some embodiments, the variance satisfies:

[0090]

[0091] In some embodiments, Figure 4 As shown, the above step 131 can be replaced by the following sub-steps:

[0092] Step 1311: Input the first feature into the normalization layer to obtain a feature matrix.

[0093] In some embodiments, the feature matrix includes at least one standard feature. Exemplarily, the first feature is input into the normalization layer to obtain a feature matrix C, which includes at least one standard feature

[0094] Step 132: Add noise to the standard feature to obtain a second feature.

[0095] In some embodiments, when the first feature is normalized to a standard feature through a normalization layer, noise is added to the standard feature to obtain a second feature. The noise is used to protect useful information in the standard feature.

[0096] In some embodiments, the specification features are included in a feature matrix. Figure 4 As shown, the above step 132 can be replaced by the following sub-steps:

[0097] Step 1321: Divide the feature matrix into x sub-matrices;

[0098] In some embodiments, a feature matrix is ​​divided into x sub-matrices, and the feature matrix is ​​obtained by normalizing the first feature. The value of x is a positive integer greater than 1. Alternatively, it can be understood that a feature matrix is ​​divided into at least two sub-matrices.

[0099] In some embodiments, the x sub-matrices include at least one standard feature, or it can be understood that each of the x sub-matrices includes at least one standard feature.

[0100] For example, Figure 5 As shown, a feature matrix 24 is obtained based on the first feature, and the feature matrix is ​​divided into sub-matrix 1 25 , sub-matrix 2 26 , and finally sub-matrix x 27 .

[0101] In some embodiments, a uniform grid partitioning method is used to divide the feature matrix into x sub-matrices of the same size. Specifically, the following steps are included:

[0102] Step 1: Determine the matrix size of the feature matrix. In some embodiments, the matrix size is determined by the value range of the feature matrix, including determining the maximum value and the minimum value of the feature matrix.

[0103] Step 2: Determine the grid size. In some embodiments, the grid size is used to indicate the size of the submatrix. The grid size is determined by the matrix size of the feature matrix and the number of submatrices. For example, if the matrix size of the feature matrix is ​​16*16 and the number of submatrices is 16, the grid size is 16*16 / 16=16=4*4.

[0104] In some embodiments, when the feature matrix cannot be evenly divided into x sub-matrices of the same size, padding is added to the feature matrix to obtain a padding matrix. The padding is used to make the padding matrix evenly divided into x sub-matrices of the same size. In some embodiments, the size of the padding is determined by the matrix size of the feature matrix and the size and number of the sub-matrices. According to the matrix size of the feature matrix and the number of sub-matrices, the size of the padding to be added is calculated. Exemplarily, if the matrix size of the feature matrix is ​​15*15, the size of the sub-matrix is ​​4*4, and the number of sub-matrices is 16, then the size of the padding is 4*4*16-15*15=15*1+15*1+1*1.

[0105] Step 3: Divide the feature matrix into x grids of the same size according to the grid size. Each grid has the same size, and x grids correspond to x sub-matrices.

[0106] In some embodiments, feature information in the x grids or x sub-matrices is further counted, and the feature information includes at least one of feature quantity, mean, and variance. The feature information is used for subsequent data processing and analysis.

[0107] Step 1322: Add noise to the x sub-matrices respectively to obtain x noise sub-matrices.

[0108] In some embodiments, noise is added to each of the x submatrices to obtain x noise submatrices. The x submatrices and the x noise submatrices are in one-to-one correspondence. Exemplarily, noise 1 is added to submatrix 1 to obtain noise submatrix 1; noise 2 is added to submatrix 2 to obtain noise submatrix 2; until noise x is added to submatrix x to obtain noise submatrix x. It is worth noting that noise 1, noise 2 to noise x can be the same or different. The embodiments of the present application are only distinguished by 1, 2 to x, and are not used to illustrate the addition of different noises in different submatrices.

[0109] In some embodiments, the x noise sub-matrices include a second feature corresponding to the standard feature. In some embodiments, the second feature is a feature with noise corresponding to the first feature. After the first feature is normalized to obtain the standard feature, the second feature corresponds to the standard feature. Since each of the x sub-matrices includes at least one standard feature, after adding noise to each of the x sub-matrices, the second feature corresponding to the standard feature in the x noise sub-matrices is obtained.

[0110] In summary, the method provided in this embodiment normalizes the first feature through a normalization layer, so that multiple data have a smaller variance and a larger mean, so as to reduce the internal covariate shift problem in the training process.

[0111] The method provided in this embodiment also divides the feature matrix into x sub-matrices so as to convert adding noise in the first feature into adding noise in x sub-matrices, thereby dividing the calculation amount corresponding to the feature matrix into x sub-matrices, thereby speeding up the calculation and further helping to improve the training efficiency.

[0112] In some embodiments, the noise includes at least two types. In some embodiments, the noise includes a first noise and a second noise, the first noise and the second noise are different noises, and the first noise is greater than the second noise.

[0113] In some embodiments, Figure 6 As shown, the above step 1322 can be replaced by the following sub-steps:

[0114] Step 13221: Calculate the eigenvalues ​​of the x sub-matrices respectively to obtain x eigenvalues;

[0115] In some embodiments, based on the eigenvalues ​​in the x submatrices, the eigenvalues ​​of the x submatrices are calculated. The eigenvalue is the sum of the eigenvalues ​​in each submatrix. In some embodiments, based on the eigenvalues ​​in each submatrix in the x submatrix, the eigenvalue of each submatrix in the x submatrix is ​​calculated.

[0116] In some embodiments, the x feature quantities correspond to the x sub-matrices one by one. Exemplarily, the feature quantity of the first sub-matrix is ​​calculated to obtain the first feature quantity; the feature quantity of the second sub-matrix is ​​calculated to obtain the second feature quantity; and until the feature quantity of the x-th sub-matrix is ​​calculated to obtain the x-th feature quantity. The value of x is a positive integer greater than 1.

[0117] Optionally, all x feature quantities are the same, such as the first feature quantity=the second feature quantity=...=the xth feature quantity.

[0118] Optionally, a of the x feature quantities are the same, and xa of the feature quantities are different. The value of a is a positive integer greater than 1 and less than x.

[0119] Optionally, all x feature quantities are different.

[0120] In the embodiment of the present application, an example is given by taking that all x feature quantities are different.

[0121] In some embodiments, the eigenvalue of each submatrix in the x eigenvalues ​​is calculated based on a linear algebra method, and the eigenvalue of each submatrix is ​​determined based on the eigenvalue of each submatrix. Calculate the eigenvalue of submatrix 1, add the eigenvalues ​​of submatrix 1 to get the sum of the eigenvalues, and use the sum of the eigenvalues ​​as the eigenvalue of submatrix 1. If submatrix 1 is represented by A, the eigenvalue of submatrix 1 is represented by λ, and I represents the unit matrix, |A-λI|=0 is satisfied. That is, Get the first eigenvalue λ of submatrix 1 1 =2, the second eigenvalue λ of submatrix 1 2 =4, the eigenvalue of submatrix 1 is the first eigenvalue + the second eigenvalue = 2 + 4 = 6.

[0122] Step 13222: Determine the maximum feature value among the x feature values;

[0123] In some embodiments, the x feature quantities are sorted, and the feature quantity with the largest value is determined as the maximum feature quantity. Optionally, the x feature quantities are sorted from large to small according to the values. The first feature quantity in the sequence is determined as the maximum feature quantity. Optionally, the x feature quantities are sorted from small to large according to the values. The last feature quantity in the sequence is determined as the maximum feature quantity.

[0124] For example, Figure 5 As shown, submatrix 1 25 corresponds to feature quantity 1, submatrix 2 26 corresponds to feature quantity 2, and submatrix x 27 corresponds to feature quantity x. If feature quantity 2> feature quantity 1> ...> feature quantity x> ..., feature quantity 2 is determined as the maximum feature quantity.

[0125] Step 13223: adding the first noise to the submatrix corresponding to the maximum feature value to obtain a first noise submatrix;

[0126] In some embodiments, a first noise is added to the canonical feature in the submatrix corresponding to the maximum feature quantity to obtain a first noise feature; and a first noise submatrix is ​​obtained based on the first noise feature.

[0127] Exemplarily, according to the Laplace mechanism, a size of where N represents the batch size for normalization and ∈ represents the privacy budget.

[0128] Step 13224: adding second noise to x-1 sub-matrices except the sub-matrix corresponding to the maximum characteristic quantity, to obtain x-1 second noise sub-matrices;

[0129] In some embodiments, a second noise is added to each submatrix except the submatrix corresponding to the maximum characteristic quantity. Exemplarily, if the characteristic quantity 2 corresponding to submatrix 2 is the maximum characteristic quantity, a second noise is added to each submatrix except submatrix 2, including adding a second noise to submatrix 1 to obtain noise submatrix 1; adding a second noise to submatrix 3 to obtain noise submatrix 2; until a second noise is added to submatrix x to obtain noise submatrix x-1. Among them, noise submatrix 1, noise submatrix 2, and noise submatrix x-1 are all second noise submatrices. That is, based on noise submatrix 1, noise submatrix 2, and noise submatrix x-1, x-1 second noise submatrices are obtained.

[0130] In some embodiments, the second noise corresponds to x-1 submatrices one by one. Or it can be understood that the second noise includes x-1. In some embodiments, the b-th second noise is added to the b-th submatrix in the x-1 submatrices. The value of x is a positive integer greater than 1. The value of b is a positive integer greater than 1 and less than x. Exemplarily, the size of the second noise is added to the b-th submatrix in the x-1 submatrix. where N represents the batch size for normalization, b represents the b-th submatrix in the x-1 submatrices, A represents the ratio of the maximum feature value to the feature value corresponding to the b-th submatrix, and ∈ represents the privacy budget.

[0131] It is worth noting that the above steps 13223 and 13224 are distinguished in order. In some embodiments, step 13223 and step 13224 are performed simultaneously. In some embodiments, step 13223 precedes step 13224. In some embodiments, step 13224 precedes step 13223.

[0132] Step 13225: Based on the first noise sub-matrix and x-1 second noise sub-matrices, obtain x noise sub-matrices.

[0133] In some embodiments, the first noise submatrix and x-1 second noise submatrices are determined as x noise submatrices with noise. Alternatively, it can be understood that the first noise submatrix and x-1 second noise submatrices form a set including x noise submatrices, and the first noise submatrix and x-1 second noise submatrices are both subsets in the set.

[0134] In summary, the method provided in this embodiment can control the amount of added noise according to specific needs by adding noise to the sub-matrices respectively. By using the first noise and the second noise of different sizes, it is avoided to add noise of the same size, so that the amount of added noise is reduced due to the reduction of the second noise, thereby controlling the impact of noise on data information, so that the added noise can protect privacy and minimize the impact on data information.

[0135] In some embodiments, Figure 7 As shown, before the above step 110, the following steps are also included:

[0136] Step 100: Sending the training capability of the terminal device for training at least one sub-model to the network device.

[0137] In some embodiments, when federated learning starts, each terminal device participating in the federated learning sends the corresponding training capability to the network device. For example, terminal device 1 sends training capability 1 corresponding to terminal device 1 to the network device; terminal device 2 sends training capability 2 corresponding to terminal device 2 to the network device. In some embodiments, the training capability of each of the m terminal devices is the same or different.

[0138] In some embodiments, the training capability includes at least one of communication capability, data storage capability, and computing capability. The training capability of the terminal device is compared with a capability threshold. If the training capability of the terminal device is less than the capability threshold, it reflects that the training capability of the terminal device is poor; if the training capability of the terminal device is greater than or equal to the capability threshold, it reflects that the training capability of the terminal device is good.

[0139] Optionally, the training capability includes communication capability. The communication capability is used to indicate the capability of the terminal device to perform communication transmission. Indicators used to indicate the communication capability include communication bandwidth and communication delay.

[0140] The communication bandwidth is used to indicate the ability of the terminal device to transmit data. For example, assuming that the communication bandwidth threshold is 20Mbps, if the communication bandwidth of terminal device 1 is 2Mbps, since 2Mbps is much smaller than 20Mbps, it means that the communication capability of terminal device 1 is poor; if the communication bandwidth of terminal device 1 is 19Mbps, since 19Mbps is close to 20Mbps, it means that the communication capability of terminal device 1 is good.

[0141] The communication delay is used to indicate the time required for the terminal device to transmit data. For example, assuming that the communication delay threshold is 10ms, if the communication delay of terminal device 1 is 50ms, since 50ms is much greater than 10ms, it means that the communication capability of terminal device 1 is poor; if the communication delay of terminal device 1 is 8ms, since 8ms is less than 10ms, it means that the communication capability of terminal device 1 is good.

[0142] The communication capability of the terminal device is compared with the first capability threshold. If the communication capability of the terminal device is less than the first capability threshold, it reflects that the communication capability of the terminal device is poor; if the communication capability of the terminal device is greater than or equal to the first capability threshold, it reflects that the communication capability of the terminal device is good.

[0143] Optionally, the training capability includes data storage capability. The data storage capability is used to indicate the ability of the terminal device to store data. Indicators used to indicate the data storage capability include data volume and data quality.

[0144] Optionally, the data volume size is used to indicate the size of the data volume stored in the terminal device. Exemplarily, assuming that the data volume size threshold is 50MB, if the data volume size of terminal device 1 is 1MB, since 1MB is much smaller than 50MB, it means that the data storage capacity of terminal device 1 is poor; if the data volume size of terminal device 1 is 60MB, since 60MB is greater than 50MB, it means that the data storage capacity of terminal device 1 is good. Optionally, the data volume size is used to indicate the maximum storage capacity of data that the terminal device can store.

[0145] The data quality is used to indicate the quality of the data stored in the terminal device. In some embodiments, the data quality is determined by at least one of the authenticity, accuracy, precision, completeness, comprehensiveness, and relevance of the data stored in the terminal device. Exemplarily, assuming that the authenticity threshold is 80%, if the authenticity of the data stored in the terminal device 1 is 50%, since 50% < 80%, it means that the data storage capacity of the terminal device 1 is poor; if the authenticity of the data stored in the terminal device 1 is 90%, since 80% < 90%, it means that the data storage capacity of the terminal device 1 is good.

[0146] The data storage capacity of the terminal device is compared with the second capacity threshold. If the data storage capacity of the terminal device is less than the second capacity threshold, it reflects that the data storage capacity of the terminal device is poor; if the data storage capacity of the terminal device is greater than or equal to the second capacity threshold, it reflects that the data storage capacity of the terminal device is good.

[0147] Optionally, the training capability includes computing capability. The computing capability is used to indicate the capability of the terminal device to analyze and calculate data. Indicators used to indicate computing capability include computing resources and computing time.

[0148] The computing resource is used to indicate the size of the central processing unit, memory, hard disk, graphics card and other resources in the terminal device. For example, assuming that the computing resource threshold is the memory size of 32G, if the memory size in the terminal device 1 is 16G, since 16G is less than 32G, it means that the computing power of the terminal device 1 is poor; if the memory size in the terminal device 1 is 64G, since 32G is less than 64G, it means that the computing power of the terminal device 1 is good.

[0149] The calculation time is used to indicate the time required for the terminal device to perform the calculation work. For example, assuming that the calculation time threshold is 5s, if the time required for the terminal device 1 to perform the calculation work is 20s, it reflects that the calculation ability of the terminal device 1 is poor; if the time required for the terminal device 1 to perform the calculation work is 3s, it reflects that the calculation ability of the terminal device 1 is good.

[0150] The computing capability of the terminal device is compared with the third capability threshold. If the computing capability of the terminal device is less than the third capability threshold, it reflects that the computing capability of the terminal device is poor; if the computing capability of the terminal device is greater than or equal to the third capability threshold, it reflects that the computing capability of the terminal device is good.

[0151] To sum up, the method provided in this embodiment, by having the terminal device send the training capability corresponding to each terminal device to the network device, enables the network device to allocate sub-models to each terminal device in a targeted manner based on the training capability corresponding to each terminal device, thereby making the entire federated learning more efficient and also helping to improve resource utilization.

[0152] In some embodiments, Figure 8 As shown, after the above step 140, the following steps are also included:

[0153] Step 160: Send data indicators of input data to the network device.

[0154] In some embodiments, after training at least one sub-model, the terminal device synchronously sends a data indicator corresponding to the data used to train the at least one sub-model to the network device. The data indicator is used to determine the contribution score of the terminal device, and the data indicator includes at least one of the data authenticity of the input data, the data quality of the input data, the data volume of the input data, and the convergence degree of the at least one sub-model that has been trained.

[0155] Optionally, the data indicator includes data authenticity of the input data. The data authenticity is used to indicate the authenticity of the data used to train at least one sub-model. Exemplarily, H is used to represent the data authenticity, and H is a percentage. When the proportion of real data in the training data is greater than or equal to the real threshold, H=100%. When the proportion of real data in the training data is less than the real threshold, the value of H decreases as the proportion of real data decreases.

[0156] Optionally, the data indicator includes a data quality degree of the input data. The data quality degree is determined by data distribution and / or data types. Exemplarily, the more balanced the data distribution and / or the more data types there are, the greater the value of the data quality; the more unbalanced the data distribution and / or the fewer data types there are, the smaller the value of the data quality.

[0157] Optionally, the data indicator includes the data volume of the input data, which is used to indicate the data volume used by the terminal device to train at least one sub-model.

[0158] Optionally, the data indicator includes the degree of convergence of at least one trained sub-model.

[0159] It is worth noting that the above steps 150 and 160 do not distinguish between the order of precedence. In some embodiments, steps 150 and 160 are performed simultaneously. In some embodiments, step 150 precedes step 160. In some embodiments, step 150 precedes step 160.

[0160] To summarize, the method provided in this embodiment enables the network device to timely calculate the contribution of the terminal device by sending data indicators corresponding to the data used to train at least one sub-model from the terminal device to the network device, and timely adjust the corresponding terminal device's strategy for participating in training and / or timely incentivize terminal devices with better performance based on the contribution of the terminal device.

[0161] In some embodiments, federated learning of the global model is performed jointly by the terminal device and the network device. Fig. 9 is a flowchart of a model training method based on federated learning provided by an exemplary embodiment of the present application. The method is composed of Figure 1 The network device 10 shown is executed. The method includes:

[0162] Step 220: Divide the global model into n sub-models;

[0163] In some embodiments, the network device divides the global model into n sub-models, where the value of n is a positive integer greater than 1.

[0164] Step 240: Allocate at least one sub-model of the n sub-models to each of the m terminal devices;

[0165] In some embodiments, n sub-models are allocated to m terminal devices, where m is a positive integer greater than 0. One or more sub-models of the n sub-models are allocated to each of the m terminal devices.

[0166] In some embodiments, the number of sub-models allocated to each of the m terminal devices is the same or different. For example, terminal device 1 and terminal device 2 are both allocated to 2 sub-models, and terminal device 3 is allocated to 3 sub-models.

[0167] In some embodiments, the same sub-model can only be assigned to one terminal device. For example, assuming that there are two terminal devices, if sub-model 1 has been assigned to terminal device 1, sub-model 1 cannot be assigned to terminal device 2.

[0168] In some embodiments, the same sub-model can be assigned to different terminal devices. For example, when sub-model 1 has been assigned to terminal device 1, sub-model 1 can be assigned to terminal device 2.

[0169] In some embodiments, at least one sub-model is used to perform federated learning of the global model.

[0170] Step 260: Receive the n trained sub-models.

[0171] In some embodiments, the trained n sub-models are obtained by training m terminal devices by adding noise to the first feature of the input data, the input data is the data in the m terminal devices used to train the n sub-models, and the noise is used to protect the first feature.

[0172] In some embodiments, each of the m terminal devices runs a photo album management program. The input data is at least one of picture data and video data in the photo album management program.

[0173] In some embodiments, the i-th terminal device among the m terminal devices receives at least one sub-model; the i-th terminal device extracts a first feature of input data based on the at least one sub-model, and the input data is data used to train the at least one sub-model in the i-th terminal device; the i-th terminal device adds noise to the first feature to obtain a second feature; the i-th terminal device trains the at least one sub-model based on the second feature to obtain at least one trained sub-model; the i-th terminal device sends the at least one trained sub-model to the network device. The value of m is a positive integer greater than 0, and the value of i is a positive integer greater than 0 and less than or equal to m.

[0174] To sum up, in the method provided in this embodiment, the n trained sub-models received by the network device are obtained by training after adding noise to the first feature of the input data. By adding noise during the training process, the data of the terminal device can be protected, thereby avoiding the data privacy of the terminal device from being leaked.

[0175] In some embodiments, the network device allocates n sub-models to the terminal device based on the allocation strategy. Fig.10 As shown, the above step 240 can be replaced by the following sub-steps:

[0176] Step 241: receiving a training capability of each of the m terminal devices for training at least one sub-model among the n sub-models;

[0177] In some embodiments, when federated learning starts, each terminal device participating in federated learning sends the corresponding training capability to the network device. For example, terminal device 1 sends training capability 1 corresponding to terminal device 1 to the network device; terminal device 2 sends training capability 2 corresponding to terminal device 2 to the network device. In some embodiments, m training capabilities corresponding to m terminal devices are received, and the m training capabilities are the same or different.

[0178] In some embodiments, the training capability includes at least one of communication capability, data storage capability, and computing capability. The training capability of the terminal device is compared with a capability threshold. If the training capability of the terminal device is less than the capability threshold, it reflects that the training capability of the terminal device is poor; if the training capability of the terminal device is greater than or equal to the capability threshold, it reflects that the training capability of the terminal device is good.

[0179] Step 242: Determine, based on the training capability, a distribution strategy for distributing the n sub-models to the m terminal devices;

[0180] In some embodiments, the network device determines an allocation strategy for allocating n sub-models to the m terminal devices based on the m training capabilities received from the m terminal devices. The allocation strategy is used to indicate the allocation objects and / or allocation time of the n sub-models. In some embodiments, the allocation strategy is determined based on the model size of each sub-model in the n sub-models. The training capability includes at least one of communication capability, data storage capability, and computing capability.

[0181] Exemplarily, the network device determines to assign sub-model 1 of the n sub-models to terminal device 1 at the first time based on the received training capability 1 corresponding to terminal device 1.

[0182] In some embodiments, based on the training capability, m weight coefficients of the m terminal devices are calculated respectively, and the m weight coefficients correspond one to one to the m terminal devices. Based on the m weight coefficients, an allocation strategy for allocating n sub-models to the m terminal devices is determined. In some embodiments, the weight coefficient is calculated by the training capability, that is, the weight coefficient is used to indicate the training capability of the terminal device. In some embodiments, the training capability includes at least one of communication capability, data storage capability, and computing capability. In some embodiments, the weight of the communication capability is greater than the data storage capability, and the weight of the communication capability is greater than the computing capability. Exemplarily, it is assumed that the weight of the communication capability is 50%, the weight of the data storage capability is 25%, and the weight of the computing capability is 25%.

[0183] In some embodiments, a weighted average of the training capabilities corresponding to each terminal device is calculated based on the training capabilities corresponding to each terminal device in the m terminal devices, and the weighted average is used as the weight coefficient of the terminal device, such as weight coefficient = weighted average of training capabilities = 50% communication capability + 25% data storage capability + 25% computing capability. Exemplarily, based on training capability 1 corresponding to terminal device 1, weighted average 1 is calculated, and weighted average 1 is used as weight coefficient 1 of terminal device 1; based on training capability 2 corresponding to terminal device 2, weighted average 2 is calculated, and weighted average 2 is used as weight coefficient 2 of terminal device 2.

[0184] Step 243: Based on the allocation strategy, allocate at least one sub-model among the n sub-models to the i-th terminal device among the m terminal devices.

[0185] In some embodiments, when the training capability of the terminal device includes the communication capability, an allocation strategy for allocating n sub-models to m terminal devices is determined based on the communication capability. The communication capability is determined by the communication bandwidth and / or the communication delay. If the communication bandwidth is greater than the bandwidth threshold and / or the communication delay is less than the delay threshold, it reflects that the communication capability is greater than the first capability threshold, that is, it reflects that the communication capability of the terminal device is good; if the communication bandwidth is less than the bandwidth threshold and / or the communication delay is greater than the delay threshold, it reflects that the communication capability is less than the first capability threshold, that is, it reflects that the communication capability of the terminal device is poor.

[0186] Exemplarily, when the communication bandwidth is greater than the bandwidth threshold and / or the communication delay is less than the delay threshold, that is, when the communication capability is good, a sub-model with a larger data volume is allocated to the corresponding terminal device to fully utilize the communication resources. When the communication bandwidth is less than the bandwidth threshold and / or the communication delay is greater than the delay threshold, that is, when the communication capability is poor, a sub-model with a smaller data volume is allocated to the corresponding terminal device to reduce the communication volume and / or avoid communication delay.

[0187] In some embodiments, when the training capability of the terminal device includes data storage capability, an allocation strategy for allocating n sub-models to m terminal devices is determined based on the data storage capability. The data storage capability is determined by the data volume size and / or data quality. If the data volume size is greater than the data volume threshold and / or the data quality is greater than the quality threshold, it reflects that the data storage capability is greater than the second capability threshold, that is, it reflects that the data storage capability of the terminal device is good; if the data volume size is less than the data volume threshold and / or the data quality is less than the quality threshold, it reflects that the data storage capability is less than the second capability threshold, that is, it reflects that the data storage capability of the terminal device is poor.

[0188] Exemplarily, when the data volume is larger than the data volume threshold and / or the data quality is larger than the quality threshold, that is, when the data storage capacity is good, the sub-model with a larger data volume is allocated to the corresponding terminal device to make full use of data resources. When the data volume is smaller than the data volume threshold and / or the data quality is smaller than the quality threshold, that is, when the data storage capacity is poor, the sub-model with a smaller data volume is allocated to the corresponding terminal device to avoid overfitting or instability of the sub-model due to small data volume and / or poor data quality when the terminal device trains the sub-model.

[0189] In some embodiments, when the training capability of the terminal device includes computing capability, an allocation strategy for allocating n sub-models to m terminal devices is determined based on the computing capability. The computing capability is determined by computing resources and / or computing time. If the computing resources are greater than the resource threshold and / or the computing time is less than the time threshold, it reflects that the computing capability is greater than the third capability threshold, that is, it reflects that the computing capability of the terminal device is good; if the computing resources are less than the resource threshold and / or the computing time is greater than the time threshold, it reflects that the computing capability is less than the third capability threshold, that is, it reflects that the computing capability of the terminal device is poor.

[0190] Exemplarily, when the computing resources are greater than the resource threshold and / or the computing time is less than the time threshold, that is, when the computing power is good, a sub-model with a larger amount of data is allocated to the corresponding terminal device to fully utilize the computing resources to improve the training efficiency. When the computing resources are less than the resource threshold and / or the computing time is greater than the time threshold, that is, when the computing power is poor, a sub-model with a smaller amount of data is allocated to the corresponding terminal device to avoid computing bottlenecks caused by insufficient computing resources when the terminal device trains the sub-model.

[0191] To sum up, the method provided in this embodiment, by having the terminal device send the training capability corresponding to each terminal device to the network device, enables the network device to allocate sub-models to each terminal device in a targeted manner based on the training capability corresponding to each terminal device, thereby making the entire federated learning more efficient and also helping to improve resource utilization.

[0192] In some embodiments, each of the m terminal devices participates in y rounds of training, where m is a positive integer greater than 0, and y is a positive integer greater than 2. In some embodiments, the terminal device and the network device repeatedly perform the above steps in each round of training in the y rounds of training.

[0193] In some embodiments, Fig.11 As shown, the above method also includes:

[0194] Step 320: receiving a data indicator of input data used for training at least one sub-model in the r+1th round of training from the i-th terminal device among the m terminal devices;

[0195] In some embodiments, the i-th terminal device among the m terminal devices sends a data indicator of the input data used to train at least one sub-model in the r+1th round of training to the network device, and the network device receives the data indicator. The data indicator includes at least one of the data authenticity of the input data, the data quality of the input data, the data volume of the input data, and the convergence degree of at least one sub-model after training. The value of m is a positive integer greater than 0, the value of i is a positive integer greater than 0 and less than or equal to m, and the value of r is a positive integer greater than 0 and less than or equal to y-2.

[0196] Optionally, the data indicator includes data authenticity of the input data. The data authenticity is used to indicate the authenticity of the data used to train at least one sub-model. Exemplarily, H is used to represent the data authenticity, and H is a percentage. When the proportion of real data in the training data is greater than or equal to the real threshold, H=100%. When the proportion of real data in the training data is less than the real threshold, the value of H decreases as the proportion of real data decreases.

[0197] Optionally, the data indicator includes a data quality degree of the input data. The data quality degree is determined by data distribution and / or data types. Exemplarily, the more balanced the data distribution and / or the more data types there are, the greater the value of the data quality; the more unbalanced the data distribution and / or the fewer data types there are, the smaller the value of the data quality.

[0198] Optionally, the data indicator includes the data volume of the input data, which is used to indicate the data volume used by the terminal device to train at least one sub-model.

[0199] Optionally, the data indicator includes the degree of convergence of at least one trained sub-model.

[0200] Step 340: Determine the contribution score of the i-th terminal device in the r+1th round based on the data indicators;

[0201] In some embodiments, the contribution score of the i-th terminal device in the r+1th round is calculated based on the data indicator.

[0202] The data indicator includes the convergence degree of at least one trained sub-model. In some embodiments, based on the convergence degree of at least one trained sub-model, the contribution score of the i-th terminal device in the r+1th round is determined.

[0203] In some embodiments, the convergence degree of at least one trained sub-model has two cases:

[0204] First case:

[0205] In some embodiments, when the convergence degree of at least one sub-model is greater than or equal to the convergence threshold, the first contribution score of the i-th terminal device in the r+1 round is calculated; the first contribution score is used as the contribution score of the i-th terminal device in the r+1 round. When the convergence degree of at least one sub-model is greater than or equal to the convergence threshold, it reflects that the convergence degree of the at least one sub-model is good, and the first contribution score is:

[0206] S i,r+1 =S i.r +H i,r ×(Q i,r +G i,r +C i,r )

[0207] Among them, S i,r+1 is the first contribution score, and also the contribution score of the i-th terminal device after the (r+1)th round of training. i,r H is the contribution score of the i-th terminal device after the r-th round of training. i,r is the data authenticity of the input data of the i-th terminal device after the r-th round of training, Q i,r is the data quality of the input data of the i-th terminal device after the r-th round of training, G i,r is the amount of input data of the i-th terminal device after the r-th round of training, C i,r is the convergence degree of the sub-model of the i-th terminal device after the r-th round of training.

[0208] In some embodiments, before step 220, that is, before training begins, the terminal device assigns the same initial contribution score to each terminal device participating in the federated learning task, such as:

[0209] S i =S i,0

[0210] Wherein, i represents the number of the terminal device, the value of i is a positive integer greater than 0 and less than or equal to m, and the value of m is a positive integer greater than 0, such as terminal device 1, terminal device 2, and so on to terminal device i; S i represents the contribution score of the i-th terminal device; S i,0 Represents the initial contribution score of the i-th terminal device.

[0211] Second case:

[0212] In some embodiments, when the convergence degree of at least one sub-model is less than the convergence threshold, the second contribution score of the i-th terminal device in the r+1 round is calculated; the second contribution score is used as the contribution score of the i-th terminal device in the r+1 round. When the convergence degree of at least one sub-model is less than the convergence threshold, it reflects that the convergence degree of the at least one sub-model is poor, and the second contribution score is:

[0213] S i,r+1 =S i,r -B

[0214] Among them, S i,r+1 is the second contribution score, and also the contribution score of the i-th terminal device after the (r+1)th round of training. i,r is the contribution score of the ith terminal device after the rth round of training, and B is the penalty contribution score deducted when the model does not converge or converges too quickly.

[0215] Step 360: Update the contribution score of the i-th terminal device in the r-th round based on the contribution score of the i-th terminal device in the r+1-th round.

[0216] In some embodiments, after the contribution score of the i-th terminal device in the r+1 round is calculated, the contribution score of the i-th terminal device in the r round is updated to the contribution score of the i-th terminal device in the r+1 round.

[0217] To summarize, the method provided in this embodiment enables the network device to timely calculate the contribution of the terminal device by sending data indicators corresponding to the data used to train at least one sub-model from the terminal device to the network device, and timely adjust the corresponding terminal device's strategy for participating in training and / or timely incentivize terminal devices with better performance based on the contribution of the terminal device.

[0218] In some embodiments, the contribution score of the terminal device in the r+1th round is also used to determine whether the terminal device continues to participate in the r+2th round of training, where r is a positive integer greater than 0 and less than or equal to y-2, and y is a positive integer greater than 2. Fig.12 As shown, the above method also includes:

[0219] Step 380: Based on the contribution score of the i-th terminal device in the r+1-th round, determine whether the i-th terminal device continues to participate in the r+2-th round of training.

[0220] In some embodiments, based on the contribution score of the i-th terminal device in the r+1th round, determining whether the i-th terminal device continues to participate in the r+2th round of training includes the following two methods:

[0221] First method:

[0222] In some embodiments, the contribution score of the i-th terminal device in the r+1th round is compared with the contribution threshold to determine whether the i-th terminal device continues to participate in the r+2th round of training, and the contribution threshold is used to indicate the minimum contribution score for the i-th terminal device to participate in the training. i,r+1 and S min For comparison, S i,r+1 S is the contribution score of terminal device i after the (r+1) round of training, min is the contribution threshold, S min <S i,0 , S i,0 Represents the initial contribution score of the i-th terminal device.

[0223] In some embodiments, when the contribution score of the i-th terminal device in the r+1 round is less than the contribution threshold, it is determined that the i-th terminal device does not continue to participate in the r+2 round of training. When the contribution score of the i-th terminal device in the r+1 round is less than the contribution threshold, it reflects that the contribution of the i-th terminal device in the r+1 round of training is less than the minimum contribution, and the i-th terminal device cannot continue to participate in the r+2 round of training. That is, in S i,r+1 <S min In the case of , it is determined that the i-th terminal device does not continue to participate in the r+2-th round of training.

[0224] In some embodiments, when the contribution score of the i-th terminal device in the r+1 round is greater than or equal to the contribution threshold, it is determined that the i-th terminal device continues to participate in the r+2 round of training. When the contribution score of the i-th terminal device in the r+1 round is greater than or equal to the contribution threshold, it reflects that the contribution of the i-th terminal device in the r+1 round of training is greater than or equal to the minimum contribution, and the i-th terminal device can continue to participate in the r+2 round of training. That is, in S i,r+1 ≥S min In the case of , it is determined that the i-th terminal device continues to participate in the r+2-th round of training.

[0225] Second method:

[0226] In some embodiments, the contribution score of the i-th terminal device in the r+1th round is compared with the penalty threshold to determine whether the i-th terminal device continues to participate in the r+2th round of training. The penalty threshold is used to indicate that the convergence degree of at least one sub-model of the i-th terminal device after t consecutive trainings is less than the convergence threshold. The value of t is a positive integer greater than 0 and less than r. The penalty threshold is:

[0227] S i,r-t -(t+1)B

[0228] Among them, S i,r-t is the contribution score of the ith terminal device after the (rt)th round of training, and B is the penalty contribution score deducted when the model does not converge or converges too quickly.

[0229] For example, S i,r+1 and S i,r-t -(t+1)B for comparison, where S i,r+1 Score the contribution of terminal device i after the (r+1)th round of training.

[0230] In some embodiments, when the contribution score of the i-th terminal device in the r+1th round is equal to the penalty threshold, it is determined that the i-th terminal device does not continue to participate in the r+2th round of training. When the contribution score of the i-th terminal device in the r+1th round is equal to the penalty threshold, it reflects that the convergence degree of at least one sub-model of the i-th terminal device after t consecutive trainings is less than the convergence threshold, then the i-th terminal device cannot continue to participate in the r+2th round of training. That is, in S i,r+1 =S i,r-t -(t+1)B, it is determined that the i-th terminal device does not continue to participate in the r+2-th round of training.

[0231] In some embodiments, when the contribution score of the i-th terminal device in the r+1th round is not equal to the penalty threshold, it is determined that the i-th terminal device continues to participate in the r+2th round of training. When the contribution score of the i-th terminal device in the r+1th round is not equal to the penalty threshold, it reflects that the convergence degree of at least one sub-model of the i-th terminal device after t consecutive trainings is less than the convergence threshold, then the i-th terminal device can continue to participate in the r+2th round of training. That is, in S i,r+1 ≠S i,r-t -(t+1)B, it is determined that the i-th terminal device continues to participate in the r+2-th round of training.

[0232] It is worth noting that the above steps 360 and 380 do not distinguish between the order of the previous and the next. In some embodiments, steps 360 and 380 are performed simultaneously. In some embodiments, steps 360 and 380 are performed before each other. In some embodiments, steps 360 and 380 are performed before each other.

[0233] In summary, the method provided in this embodiment determines whether a terminal device can continue to participate in the next round of training by calculating the contribution score of the terminal device. This enables timely adjustment of the terminal device's participation in training according to the real-time contribution score of the terminal device. On the one hand, it can incentivize terminal devices with better resources or capabilities through contribution scores, and on the other hand, it can timely discover and eliminate terminal devices with poor resources or capabilities, so as to avoid the impact of terminal devices with poor resources or capabilities on global training.

[0234] In some embodiments, each of the m terminal devices runs an album management program, and at least one of the picture data and the video data is stored in the album management program. In some embodiments, the video data includes at least two picture frames. At least one of the picture data and the video data is used as input data for training at least one sub-model of the terminal device. In the embodiment of the present application, the input data includes picture data and video data as an example for illustration.

[0235] A model training method based on federated learning is proposed in the embodiment of the present application, and the specific steps are as follows:

[0236] Step 11: The network device divides the global model into n sub-models;

[0237] In some embodiments, the network device divides the global model into n sub-models, where the value of n is a positive integer greater than 1.

[0238] Step 12: The terminal device sends a training capability for training at least one sub-model to the network device;

[0239] The specific implementation method refers to the above step 100 .

[0240] In some embodiments, each of the m terminal devices sends a training capability for training at least one sub-model to the network device.

[0241] Step 13: The network device allocates at least one sub-model of the n sub-models to each of the m terminal devices;

[0242] For the specific implementation, refer to the above step 240 .

[0243] Step 14: The terminal device receives at least one sub-model;

[0244] In some embodiments, the terminal device receives at least one sub-model sent by the network device for performing federated learning of the global model. The at least one sub-model is trained in the terminal device.

[0245] In some embodiments, each of the m terminal devices receives at least one sub-model.

[0246] Step 15: The terminal device extracts the first feature of the image data and the video data based on at least one sub-model;

[0247] For the specific implementation, refer to the above step 120 .

[0248] In some embodiments, at least one sub-model received by the terminal device includes a feature extraction layer, and the feature extraction layer is used to extract features of the image data and video data input into the at least one sub-model to obtain a first feature. The first feature is a feature corresponding to the image data and the video data. Exemplarily, the first feature includes at least one of a color feature, a texture feature, and an information volume feature in the image data.

[0249] In some embodiments, each of the m terminal devices extracts the first feature of the image data and the video data based on at least one sub-model.

[0250] Step 16: The terminal device adds noise to the first feature to obtain a second feature;

[0251] For the specific implementation, refer to the above step 130 .

[0252] In the embodiment of the present application, an example is taken for illustration that the first feature includes a color feature in the image data.

[0253] In some embodiments, at least one sub-model received by the terminal device includes a normalization layer. The normalization layer is used to normalize the first feature into a normalized feature. The color feature in the image data is input into the normalization layer to obtain a feature matrix corresponding to the color feature in the image data. The feature matrix includes at least one normalized feature. Exemplarily, assuming that the color feature in the image data includes 9*9 eigenvalues, the 9*9 eigenvalues ​​are input into the normalization layer to obtain a 9*9 feature matrix with 9 rows and 9 columns.

[0254] In some embodiments, the feature matrix corresponding to the color feature in the image data is divided into x sub-matrices. For example, a 9*9 feature matrix with 9 rows and 9 columns is divided into 9 3*3 sub-matrices with 3 rows and 3 columns. For example, assuming that a 9*9 feature matrix with 9 rows and 9 columns is:

[0255]

[0256] Then the feature matrix is ​​divided into: sub-matrices Submatrix Submatrix Submatrix Submatrix Submatrix Submatrix Submatrix Submatrix

[0257] In some embodiments, noise is added to each submatrix to obtain x noise submatrices. In some embodiments, each submatrix corresponds to a portion of color features in the image data. Noise is added to each submatrix to obtain x noise submatrices; that is, noise is added to the color features in the image data to obtain color features with noise.

[0258] Step 17: The terminal device trains at least one sub-model based on the second feature;

[0259] For the specific implementation, refer to the above step 140 .

[0260] Step 18: The terminal device sends at least one trained sub-model to the network device;

[0261] For the specific implementation, refer to the above step 150 .

[0262] Step 19: The terminal device sends data indicators of the image data and the video data to the network device;

[0263] For the specific implementation, refer to the above step 160 .

[0264] It is worth noting that the above steps 18 and 19 do not distinguish between the order of the steps 18 and 19. In some embodiments, the terminal device performs step 18 and step 19 simultaneously. In some embodiments, the terminal device first performs step 18 and then performs step 19. In some embodiments, the terminal device first performs step 19 and then performs step 18.

[0265] Step 20: The network device receives the trained n sub-models;

[0266] For the specific implementation, refer to the above step 260 .

[0267] Step 21: The network device receives data indicators of picture data and video data used by the terminal device to train at least one sub-model;

[0268] For the specific implementation, refer to the above step 320 .

[0269] It is worth noting that the above steps 20 and 21 do not distinguish between the order of the previous and the next. In some embodiments, the network device performs step 20 and step 21 simultaneously. In some embodiments, the network device first performs step 20 and then performs step 21. In some embodiments, the network device first performs step 21 and then performs step 20.

[0270] Step 22: The network device determines a contribution score of the terminal device based on the data indicators of the image data and the video data;

[0271] For the specific implementation, refer to the above step 340 .

[0272] Step 23: The network device updates the contribution score of the terminal device in the previous round based on the contribution score of the terminal device;

[0273] For the specific implementation, refer to the above step 360 .

[0274] Step 24: The network device determines whether the terminal device continues to participate in the next round of training based on the contribution score of the terminal device.

[0275] For the specific implementation, refer to the above step 380 .

[0276] In some embodiments, when it is determined that the terminal device continues to participate in the next round of training, the above steps 11 to 23 are repeatedly executed until the training is completed or the global model converges.

[0277] It is worth noting that the above steps 23 and 24 do not distinguish between the order of the steps 23 and 24. In some embodiments, the network device performs step 23 and step 24 simultaneously. In some embodiments, the network device first performs step 23 and then performs step 24. In some embodiments, the network device first performs step 24 and then performs step 23.

[0278] In the embodiment of the present application, a model training method based on federated learning is proposed, which adopts a federated learning method combining end-edge-cloud to train convolutional neural networks, divides the global model into multiple sub-models and assigns them to terminal devices for training using input data, and uses differential privacy technology to protect the privacy of terminal device data during the interaction between the terminal device and the mobile edge server, and performs multiple rounds of training until the global model converges. When photos or videos in the mobile phone album are input, the converged global model will give the category of the photos or videos, thereby helping the terminal device to organize the album. In addition, an incentive mechanism is added to prevent malicious updates from a small number of attackers and attract more terminal devices to participate in federated learning tasks.

[0279] The method comprises the following steps:

[0280] S1. The terminal device uploads the training to the cloud server. The cloud server initializes the global model parameters, divides it into multiple sub-models, and allocates the sub-models to the most suitable terminal device for training through a resource management algorithm.

[0281] S2. The terminal device participating in the federated learning task receives the assigned sub-model, extracts features from the photos in the terminal device's mobile phone album through a convolutional neural network, adds noise to the features through a differential privacy method, and then uploads them to the mobile edge server. The mobile edge server helps train the fully connected layer and returns the training loss to the mobile device to update the previous layer;

[0282] S3: The terminal device uploads the trained sub-model to the cloud server, which performs gradient aggregation and updates the global model parameters.

[0283] S4, the cloud server reallocates the divided sub-models to the terminal devices, starts a new round of training, and repeats the above steps until the model converges;

[0284] S5. After each round of training, the contribution score of the terminal device is updated according to the incentive mechanism. When the global model converges, the terminal device can redeem rewards from the cloud server based on its contribution score.

[0285] Furthermore, the specific steps of S1 are:

[0286] S1-1. The terminal device uploads at least one of the communication capability, data storage capability and computing capability to the cloud server.

[0287] S1-2, the cloud server divides the global model into multiple sub-models. Through model division, different terminal devices can jointly train the same sub-model, or different terminal devices can train different sub-models to effectively coordinate the resources of the terminal devices to complete the sub-model training. In order to balance the use of data resources in the terminal devices, the cloud server will regularly exchange filter blocks between sub-models to ensure that all filters are trained equally by the terminal devices.

[0288] S1-3. The cloud server allocates the sub-model to the most suitable terminal device for training through a new resource management algorithm. The resource management algorithm is as follows:

[0289] Consider the communication capability, data storage capability, and computing capability of the terminal device:

[0290] ① Communication capability: Consider the communication bandwidth and delay of the terminal device. For terminal devices with low communication bandwidth and high delay, a smaller sub-model can be assigned to reduce the communication volume and communication delay. For terminal devices with high communication bandwidth and low delay, a larger sub-model can be assigned to make full use of its communication resources.

[0291] ② Data storage capacity: Consider the data volume and data quality of the terminal device. For terminal devices with small data volume or poor data quality, a smaller sub-model can be assigned to avoid overfitting or unstable models. For terminal devices with large data volume or good data quality, a larger sub-model can be assigned to make full use of its data resources.

[0292] ③ Computing power: Consider the computing resources and time of the terminal device. For terminal devices with weak computing power, smaller sub-models can be allocated to avoid resource bottlenecks during the computing process. For terminal devices with strong computing power, larger sub-models can be allocated to fully utilize their computing resources and improve training efficiency.

[0293] Use a distributed adaptive algorithm to dynamically adjust the allocation strategy of the sub-model according to the communication capability, data storage capability, and computing capability of the terminal device:

[0294] S1-3-1. Establish the communication mechanism topology

[0295] Establish communication mechanisms and topology structures based on the communication equipment and network performance of the terminal devices, such as bandwidth and latency, while ensuring the security of data transmission.

[0296] S1-3-2. Assign sub-models to terminal devices

[0297] The global model is divided into multiple sub-models by grouping filters into blocks. The division factor of the convolutional layer is the number of output channels of the layer. The segmented sub-models are assigned to different terminal devices for training.

[0298] S1-3-3. Collecting terminal equipment training data

[0299] After training the sub-model it is responsible for, the terminal device must upload information such as data volume, task size, training time, and communication delay to the cloud server.

[0300] S1-3-4. Calculate the weight coefficient of each terminal device

[0301] Based on the information uploaded by the terminal devices, the cloud server uses the weighted average method to calculate the weight coefficient of each terminal device, taking into account the importance of each factor and its impact on the model accuracy.

[0302] S1-3-5. Dynamically adjust the allocation strategy of each sub-model

[0303] According to the weight coefficient of each terminal device, the cloud server dynamically adjusts the allocation strategy of each sub-model, including which terminal device to allocate to, the allocation time, etc. The adjustment takes into account factors such as model accuracy, computing efficiency, and load balance.

[0304] S1-3-6. Update model weight values

[0305] During the model training process, the cloud server will use the information uploaded by the terminal device to update the model weight value, and the terminal device will accept the new sub-model assigned by the cloud server for training. This can ensure the accuracy and performance of the entire distributed convolutional neural network.

[0306] By adopting this distributed adaptive algorithm, the allocation strategy of the sub-model is dynamically adjusted according to the operating data of the terminal device, achieving computing load balancing and optimization of operating efficiency.

[0307] S1-4. Multiple copies of the global model are partitioned and trained at the same time. These copies are partitioned in different ways and sent to different terminal devices for training to improve resource utilization efficiency.

[0308] Furthermore, the specific steps of S2 are:

[0309] S2-1. The terminal device uses local data to train the assigned sub-convolutional neural network and adds noise in the normalization layer. Assume that X z,j,k Represents the feature of image k at position (z, j), which becomes feature after normalization layer

[0310] satisfy:

[0311]

[0312] The mean satisfies:

[0313]

[0314] Its variance satisfies:

[0315]

[0316] Among them, X z,j,k Represents the first feature of image k at position (z, j), k is a positive integer greater than 0, z is a real number greater than or equal to 0, and j is a real number greater than or equal to 0; N refers to the batch size of the first feature used for normalization. The first feature is normalized in each batch in batches, so that the data in the batch has a smaller variance and a larger mean, so as to reduce the problem of internal covariate shift during training.

[0317] S2-2, after the normalization layer, the feature matrix C is obtained, and C is divided into x sub-matrices of the same size using the uniform grid partitioning method. The specific steps are as follows:

[0318] S2-2-1. Determine the value range of the feature matrix and set the grid size as needed. When it is impossible to divide the matrix into sub-matrices of the same size, calculate the padding size required for the feature matrix based on the size of the feature matrix and the required sub-matrix size, and add it to the original feature matrix.

[0319] S2-2-2. Calculate the number of divisions for each dimension based on the value range and grid size.

[0320] S2-2-3. Divide each feature in the feature matrix according to the grid to which it belongs, and assign it to the corresponding grid.

[0321] S2-2-4. For each grid, the number of features, mean, variance and other information can be further counted to facilitate subsequent data processing and analysis.

[0322] S2-3. Calculate the feature size of each submatrix and find the submatrix c with the largest feature size. max According to the Laplace mechanism, max Features in Add size independent zero-mean Laplace noise of , where ∈ is the privacy budget.

[0323] For the remaining sub-matrices, add Independent zero-mean Laplace noise of max The ratio of the size of the eigenvalue of this submatrix, A>1.

[0324] The size of the privacy parameter ∈ can be adjusted according to specific application requirements to achieve a balance between privacy protection and data accuracy.

[0325] The effect of reducing the total amount of added noise on improving model accuracy:

[0326] 1) Increase the interpretability of the model: The presence of noise may mask useful information in the original data, resulting in the uninterpretability of the model. If the amount of added noise is reduced, it is possible to improve the model's understanding of the original data, thereby increasing the interpretability of the model. The Laplace noise added to the feature matrix may blur the relationship between the data, thereby affecting the accuracy of the model.

[0327] 2) Reduce the risk of overfitting: Adding noise is a common data enhancement technique that can help the model generalize better to new data. However, if the amount of noise added is too large, it will cause the model to overfit the noise, thereby reducing the accuracy of the model. If the amount of noise added is reduced, the risk of overfitting can be reduced and the generalization ability and accuracy of the model can be improved.

[0328] S2-4. Upload the noisy feature matrix C to the mobile edge server to train the fully connected layer, and return the training loss to the mobile device to update the previous layer.

[0329] Furthermore, the specific steps of S3 are:

[0330] S3-1. The terminal device uploads the trained sub-model to the cloud server.

[0331] S3-2, the cloud server reassembles all sub-models and reconstructs the global model.

[0332] Furthermore, the specific steps of S4 are:

[0333] S4-1. The cloud server uses a distributed adaptive algorithm to reallocate the sub-models to appropriate terminal devices for training.

[0334] S4-2. Repeat the previous steps until the global model converges. The converged model can classify the photos and videos in the mobile phone album of the terminal device.

[0335] Furthermore, the specific steps of S5 are:

[0336] S5-1. The contribution of each terminal device in the entire federated learning process is represented by a contribution score S. Before training begins, the cloud server assigns the same initial contribution score to each terminal device participating in the federated learning task:

[0337] S i =S i,0

[0338] Wherein, i represents the number of the terminal device, the value of i is a positive integer greater than 0 and less than or equal to m, and the value of m is a positive integer greater than 0, such as terminal device 1, terminal device 2, and so on to terminal device i; S i represents the contribution score of the i-th terminal device; S i,0 Represents the initial contribution score of the i-th terminal device.

[0339] S5-2. After each round of training, the terminal device uploads the trained sub-model and data indicators to the cloud server. The cloud server updates the contribution score of each terminal device based on the convergence of the sub-model and the data indicators:

[0340] The indicators for updating the terminal device contribution score are shown in Table 1 below:

[0341] Table 1

[0342]

[0343] 1) When the sub-model converges and the convergence speed is normal:

[0344] S i,r+1 =S i,r +H i,r ×(Q i,r +G i,r +C i,r )

[0345] Among them, S i,r+1is the first contribution score, and also the contribution score of the i-th terminal device after the (r+1)th round of training. i,r H is the contribution score of the i-th terminal device after the r-th round of training. i,r is the data authenticity of the input data of the i-th terminal device after the r-th round of training, Q i,r is the data quality of the input data of the i-th terminal device after the r-th round of training, G i,r is the amount of input data of the i-th terminal device after the r-th round of training, C i,r is the convergence degree of the sub-model of the i-th terminal device after the r-th round of training.

[0346] 2) When the model does not converge or converges too quickly, it is judged as a malicious update:

[0347] S i,r+1 =S i,r -B

[0348] Among them, S i,r+1 is the second contribution score, and also the contribution score of the i-th terminal device after the (r+1)th round of training. i,r is the contribution score of the ith terminal device after the rth round of training, and B is the penalty contribution score deducted when the model does not converge or converges too quickly.

[0349] S5-3. Examine the contribution score of the terminal device. If it is determined to be an attacker, the terminal device cannot continue to participate in the federated learning task:

[0350] If S i,r+1 <S min , then the i-th terminal device is determined to be an attacker, hindering the update of the global model and unable to participate in the next round of training; where S i,r+1 S is the contribution score of terminal device i after the (r+1) round of training, min is the contribution threshold, S min <S i,0 , S i,0 Represents the initial contribution score of the i-th terminal device.

[0351] If S i,r+1 =S i,r-t -(t+1)B, the i-th terminal device is also determined to be an attacker, which hinders the update of the global model and cannot participate in the next round of training; where S i,r+1 =S i,r-t -(t+1)B represents that the i-th terminal device performs malicious updates t times in succession, the value of t is a positive integer greater than 0 and less than r, the value of r is a positive integer greater than 0 and less than or equal to y-2, and the value of y is a positive integer greater than 2.

[0352] For example, Fig.13 As shown, the above step S5 includes:

[0353] Step 30: The network device assigns an initial contribution score to the terminal device;

[0354] S i =S i,0

[0355] Wherein, i represents the number of the terminal device, the value of i is a positive integer greater than 0 and less than or equal to m, and the value of m is a positive integer greater than 0, such as terminal device 1, terminal device 2, and so on to terminal device i; S i represents the contribution score of the i-th terminal device; S i,0 Represents the initial contribution score of the i-th terminal device.

[0356] Step 31: The network device determines the convergence degree of the received sub-model; and compares the convergence degree of the sub-model with a convergence threshold.

[0357] When the convergence degree of the sub-model is greater than or equal to the convergence threshold, continue to execute step 32. When the convergence degree of the sub-model is less than the convergence threshold, continue to execute step 33.

[0358] Step 32: Calculate the first contribution score;

[0359] When the convergence degree of at least one sub-model is greater than or equal to the convergence threshold, it reflects that the convergence degree of the at least one sub-model is good, and the first contribution score is:

[0360] S i,r+1 =S i,r +H i,r ×(Q i,r +G i,r +C i,r )

[0361] Among them, S i,r+1 is the first contribution score, and also the contribution score of the i-th terminal device after the (r+1)th round of training. i,r H is the contribution score of the i-th terminal device after the r-th round of training. i,r is the data authenticity of the input data of the i-th terminal device after the r-th round of training, Q i,r is the data quality of the input data of the i-th terminal device after the r-th round of training, G i,r is the amount of input data of the i-th terminal device after the r-th round of training, C i,r is the convergence degree of the sub-model of the i-th terminal device after the r-th round of training.

[0362] Step 33: Calculate the second contribution score;

[0363] When the convergence degree of at least one sub-model is less than the convergence threshold, it reflects that the convergence degree of the at least one sub-model is poor, and the second contribution score is:

[0364] S i,r+1 =S i,r -B

[0365] Among them, S i,r+1 is the second contribution score, and also the contribution score of the i-th terminal device after the (r+1)th round of training. i,r is the contribution score of the ith terminal device after the rth round of training, and B is the penalty contribution score deducted when the model does not converge or converges too quickly.

[0366] Step 34: Determine whether the contribution score is less than the contribution threshold, and / or determine whether the contribution score is equal to the penalty threshold;

[0367] The contribution score of the i-th terminal device in the r+1th round is compared with the contribution threshold, and / or the contribution score of the i-th terminal device in the r+1th round is compared with the penalty threshold.

[0368] When the contribution score of the i-th terminal device in the r+1 round is less than the contribution threshold, and / or when the contribution score of the i-th terminal device in the r+1 round is equal to the penalty threshold, continue to execute step 35; when the contribution score of the i-th terminal device in the r+1 round is greater than or equal to the contribution threshold, and / or when the contribution score of the i-th terminal device in the r+1 round is not equal to the penalty threshold, continue to execute step 36.

[0369] Step 35: Confirm that you do not want to continue and click to participate in the next round of training;

[0370] Step 36: Confirm to continue to participate in the next round of training.

[0371] S5-4. When the global model converges, the i-th terminal device can redeem corresponding rewards based on its contribution score.

[0372] Fig.14 : is a block diagram of a model training device based on federated learning provided by another exemplary embodiment of the present application. The device includes:

[0373] The receiving module 1410 is used to receive at least one sub-model, and the at least one sub-model is used to perform federated learning of the global model.

[0374] The extraction module 1420 is used to extract the first feature of the input data based on at least one sub-model, and the input data is data in the terminal device used to train at least one sub-model.

[0375] The adding module 1430 is used to add noise to the first feature to obtain the second feature, and the noise is used to protect the first feature.

[0376] The training module 1440 is used to train at least one sub-model based on the second feature.

[0377] The sending module 1450 is used to send at least one trained sub-model to the network device.

[0378] In some embodiments, at least one sub-model includes a normalization layer for normalizing the first feature into a normalized feature.

[0379] The adding module 1430 is also used to input the first feature into the normalization layer to obtain the normalized feature.

[0380] The adding module 1430 is also used to add noise to the standard feature to obtain the second feature.

[0381] The adding module 1430 is further used to input the first feature into the normalization layer to obtain a feature matrix, which includes at least one normalized feature.

[0382] The adding module 1430 is further used to divide the feature matrix into x sub-matrices, each of which includes at least one standard feature.

[0383] The adding module 1430 is further used to add noise to the x sub-matrices respectively to obtain x noise sub-matrices, wherein the x noise sub-matrices include the second feature corresponding to the standard feature.

[0384] Here, the value of x is a positive integer greater than 1.

[0385] The noise includes first noise and second noise, and the first noise is greater than the second noise.

[0386] The adding module 1430 is further used to calculate the feature quantities of the x sub-matrices respectively to obtain x feature quantities, and the x feature quantities correspond to the x sub-matrices one by one.

[0387] The adding module 1430 is further configured to determine the maximum feature value among the x feature values.

[0388] The adding module 1430 is further configured to add the first noise to the submatrix corresponding to the maximum feature value to obtain a first noise submatrix.

[0389] The adding module 1430 is further configured to add second noise to x-1 sub-matrices except the sub-matrix corresponding to the maximum feature value, so as to obtain x-1 second noise sub-matrices.

[0390] The adding module 1430 is further configured to obtain x noise sub-matrices based on the first noise sub-matrix and x-1 second noise sub-matrices.

[0391] The sending module 1450 is also used to send the training capability of the terminal device for training at least one sub-model to the network device.

[0392] The training capability includes at least one of communication capability, data storage capability and computing capability.

[0393] The sending module 1450 is also used to send data indicators of input data to the network device.

[0394] Among them, the data indicators are used to determine the contribution score of the terminal device, and the data indicators include at least one of the data authenticity of the input data, the data quality of the input data, the data volume of the input data, and the convergence degree of at least one sub-model that has been trained.

[0395] In some embodiments, the terminal device runs a photo album management program.

[0396] The device also includes:

[0397] The acquisition module 1460 is used to acquire at least one of the picture data and the video data in the album management program as input data.

[0398] Fig.15 : is a block diagram of a model training device based on federated learning provided by another exemplary embodiment of the present application. The device includes:

[0399] The division module 1510 is used to divide the global model into n sub-models.

[0400] The sending module 1520 is used to allocate at least one sub-model among the n sub-models to each of the m terminal devices, and the at least one sub-model is used for federated learning of the global model.

[0401] The receiving module 1530 is used to receive n trained sub-models. The n trained sub-models are obtained by training m terminal devices by adding noise to the first feature of the input data. The input data is the data in the m terminal devices used to train the n sub-models, and the noise is used to protect the first feature.

[0402] Wherein, the value of n is a positive integer greater than 1, and the value of m is a positive integer greater than 0.

[0403] The receiving module 1530 is also used to receive the training capability of each of the m terminal devices for training at least one sub-model among the n sub-models.

[0404] The device also includes:

[0405] The determination module 1540 is used to determine an allocation strategy for allocating n sub-models to m terminal devices based on the training capability, where the allocation strategy is used to indicate allocation objects and / or allocation time of the n sub-models.

[0406] The sending module 1520 is further configured to allocate at least one sub-model among the n sub-models to the i-th terminal device among the m terminal devices based on the allocation strategy.

[0407] The training capability includes at least one of communication capability, data storage capability and computing capability, and the value of i is a positive integer greater than 0 and less than or equal to m.

[0408] The determination module 1540 is further configured to calculate m weight coefficients of the m terminal devices respectively based on the training capability, and the m weight coefficients correspond to the m terminal devices one by one.

[0409] The determination module 1540 is further configured to determine, based on the m weight coefficients, an allocation strategy for allocating the n sub-models to the m terminal devices.

[0410] In some embodiments, each of the m terminal devices participates in y rounds of training.

[0411] The receiving module 1530 is also used to receive data indicators of input data used for training at least one sub-model in the r+1th round of training by the i-th terminal device among the m terminal devices, the data indicators including data authenticity of the input data, data quality of the input data, data volume of the input data, and at least one of the convergence degree of at least one sub-model after training.

[0412] The determination module 1540 is further used to determine the contribution score of the i-th terminal device in the r+1th round based on the data indicator.

[0413] The device also includes:

[0414] An updating module 1550, configured to update the contribution score of the i-th terminal device in the r-th round based on the contribution score of the i-th terminal device in the r+1-th round;

[0415] The value of y is a positive integer greater than 2, and the value of r is a positive integer greater than 0 and less than or equal to y-2.

[0416] The determination module 1540 is also used to calculate the first contribution score of the i-th terminal device in the r+1 round when the convergence degree of at least one sub-model is greater than or equal to the convergence threshold; and use the first contribution score as the contribution score of the i-th terminal device in the r+1 round.

[0417] The determination module 1540 is also used to calculate the second contribution score of the i-th terminal device in the r+1 round when the convergence degree of at least one sub-model is less than the convergence threshold; and use the second contribution score as the contribution score of the i-th terminal device in the r+1 round.

[0418] The determination module 1540 is further configured to determine whether the i-th terminal device continues to participate in the r+2-th round of training based on the contribution score of the i-th terminal device in the r+1-th round.

[0419] Determination module 1540 is also used to compare the contribution score of the i-th terminal device in the r+1 round with the contribution threshold to determine whether the i-th terminal device continues to participate in the r+2 round of training. The contribution threshold is used to indicate the minimum contribution score for the i-th terminal device to participate in the training.

[0420] Determination module 1540 is also used to compare the contribution score of the i-th terminal device in the r+1 round with the penalty threshold to determine whether the i-th terminal device continues to participate in the r+2 round of training. The penalty threshold is used to indicate that the convergence degree of at least one sub-model of the i-th terminal device after t consecutive trainings is less than the convergence threshold.

[0421] The value of t is a positive integer greater than 0 and less than r.

[0422] The determination module 1540 is further configured to determine that the i-th terminal device does not continue to participate in the r+2-th round of training when the contribution score of the i-th terminal device in the r+1-th round is less than the contribution threshold.

[0423] The determination module 1540 is further configured to determine that the i-th terminal device continues to participate in the r+2-th round of training when the contribution score of the i-th terminal device in the r+1-th round is greater than or equal to the contribution threshold.

[0424] The determination module 1540 is further configured to determine that the i-th terminal device does not continue to participate in the r+2-th round of training when the contribution score of the i-th terminal device in the r+1-th round is equal to the penalty threshold.

[0425] The determination module 1540 is further configured to determine that the i-th terminal device continues to participate in the r+2-th round of training when the contribution score of the i-th terminal device in the r+1-th round is not equal to the penalty threshold.

[0426] In some embodiments, each of the m terminal devices runs an album management program, and the input data is at least one of picture data and video data in the album management program.

[0427] The present application also provides a terminal device, which includes: a processor, a memory and a transceiver, the processor is connected to the transceiver, and the storage medium stores at least one program, which is loaded and executed by the processor to implement the model training method based on federated learning provided in the above-mentioned method embodiments.

[0428] The present application also provides a network device, which includes: a processor, a memory and a transceiver, the processor is connected to the transceiver, the storage medium stores at least one program, and the at least one program is loaded and executed by the processor to implement the model training method based on federated learning provided in the above-mentioned method embodiments.

[0429] The present application also provides a computer-readable storage medium, which stores at least one program, and the at least one program is loaded and executed by a processor to implement the model training method based on federated learning provided by the above-mentioned method embodiments.

[0430] The present application also provides a computer program product, which includes at least one program segment, and the at least one program segment is stored in a computer-readable storage medium; the processor of the communication device reads at least one program segment from the computer-readable storage medium, and the processor executes at least one program segment, so that the communication device executes the model training method based on federated learning provided by the above-mentioned method embodiments.

[0431] The present application also provides a computer program, which includes at least one program segment, and the at least one program segment is stored in a computer-readable storage medium; the processor of the communication device reads at least one program segment from the computer-readable storage medium, and the processor executes at least one program segment, so that the communication device executes the model training method based on federated learning provided in the above-mentioned method embodiments.

[0432] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0433] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0434] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A model training method based on federated learning, characterized in that: The method is performed by a terminal device, and the method includes: receiving at least one sub-model, wherein the at least one sub-model is used for performing federated learning of a global model; Extracting a first feature of input data based on the at least one sub-model, the input data being data in the terminal device used for training the at least one sub-model; adding noise to the first feature to obtain a second feature, wherein the noise is used to protect the first feature; Training the at least one sub-model based on the second feature; The at least one sub-model that has been trained is sent to the network device.

2. The method according to claim 1, characterized in that The at least one sub-model comprises a normalization layer, the normalization layer being used to normalize the first feature into a normalized feature; The adding noise to the first feature to obtain the second feature comprises: Inputting the first feature into the normalization layer to obtain the normalized feature; The noise is added to the standard feature to obtain the second feature.

3. The method according to claim 2, characterized in that The step of inputting the first feature into the normalization layer to obtain the normalized feature comprises: Inputting the first feature into the normalization layer to obtain a feature matrix, wherein the feature matrix includes at least one of the normalized features; The step of adding the noise to the standard feature to obtain the second feature comprises: Dividing the feature matrix into x sub-matrices, each of the x sub-matrices includes at least one of the standard features; Adding the noise to the x sub-matrices respectively to obtain x noise sub-matrices, wherein the x noise sub-matrices include the second feature corresponding to the standard feature; Here, the value of x is a positive integer greater than 1.

4. The method according to claim 3, characterized in that The noise includes a first noise and a second noise, and the first noise is greater than the second noise; The step of adding the noise to the x sub-matrices respectively to obtain x noise sub-matrices comprises: Calculating the characteristic quantities of the x sub-matrices respectively to obtain x characteristic quantities, wherein the x characteristic quantities correspond to the x sub-matrices one by one; Determining a maximum feature value among the x feature values; Adding the first noise to the submatrix corresponding to the maximum characteristic quantity to obtain a first noise submatrix; Adding the second noise to x-1 sub-matrices except the sub-matrix corresponding to the maximum characteristic quantity to obtain x-1 second noise sub-matrices; The x noise sub-matrices are obtained based on the first noise sub-matrix and the x-1 second noise sub-matrices.

5. The method according to any one of claims 1 to 4, characterized in that: Before receiving at least one sub-model, the method further includes: Sending the training capability of the terminal device for training the at least one sub-model to the network device; The training capability includes at least one of communication capability, data storage capability and computing capability.

6. The method according to any one of claims 1 to 4, characterized in that: After training the at least one sub-model based on the second feature, the method further includes: sending a data indicator of the input data to the network device; Among them, the data indicators are used to determine the contribution score of the terminal device, and the data indicators include at least one of the data authenticity of the input data, the data quality of the input data, the data volume of the input data, and the convergence degree of the at least one sub-model that has been trained.

7. The method according to claim 1, characterized in that The terminal device runs a photo album management program; The method further comprises: At least one of the picture data and the video data in the album management program is obtained as the input data.

8. A model training method based on federated learning, characterized in that: The method is performed by a network device, and the method includes: Divide the global model into n sub-models; Allocating at least one sub-model of the n sub-models to each of the m terminal devices, wherein the at least one sub-model is used for performing federated learning of the global model; receiving the n sub-models that have been trained, where the n sub-models are trained by the m terminal devices by adding noise to a first feature of input data, the input data is data used in the m terminal devices for training the n sub-models, and the noise is used to protect the first feature; Wherein, the value of n is a positive integer greater than 1, and the value of m is a positive integer greater than 0.

9. The method according to claim 8, characterized in that The allocating at least one sub-model of the n sub-models to each of the m terminal devices comprises: Receiving a training capability of each of the m terminal devices for training at least one sub-model of the n sub-models; Based on the training capability, determining an allocation strategy for allocating the n sub-models to the m terminal devices, the allocation strategy being used to indicate allocation objects and / or allocation time of the n sub-models; Based on the allocation strategy, at least one sub-model among the n sub-models is allocated to an i-th terminal device among the m terminal devices; The training capability includes at least one of communication capability, data storage capability and computing capability, and the value of i is a positive integer greater than 0 and less than or equal to m.

10. The method according to claim 9, characterized in that The determining, based on the training capability, an allocation strategy for allocating the n sub-models to the m terminal devices comprises: Based on the training capability, respectively calculating m weight coefficients of the m terminal devices, wherein the m weight coefficients correspond to the m terminal devices one by one; Based on the m weight coefficients, the allocation strategy for allocating the n sub-models to the m terminal devices is determined.

11. The method according to any one of claims 8 to 10, characterized in that: Each terminal device among the m terminal devices participates in y rounds of training; The method further comprises: Receiving data indicators of input data used for training the at least one sub-model in the r+1th round of training from the i-th terminal device among the m terminal devices, the data indicators comprising at least one of data authenticity of the input data, data quality of the input data, data volume of the input data, and convergence degree of the at least one sub-model after training; Determining a contribution score of the i-th terminal device in the r+1-th round based on the data indicator; updating the contribution score of the i-th terminal device in the r-th round based on the contribution score of the i-th terminal device in the r+1-th round; The value of y is a positive integer greater than 2, and the value of r is a positive integer greater than 0 and less than or equal to y-2.

12. The method according to claim 11, characterized in that The determining, based on the data indicator, a contribution score of the i-th terminal device in the r+1-th round includes: When the convergence degree of the at least one sub-model is greater than or equal to a convergence threshold, calculating a first contribution score of the i-th terminal device in the r+1th round; and using the first contribution score as the contribution score of the i-th terminal device in the r+1th round; or, When the convergence degree of the at least one sub-model is less than a convergence threshold, a second contribution score of the i-th terminal device in the r+1-th round is calculated; and the second contribution score is used as the contribution score of the i-th terminal device in the r+1-th round.

13. The method according to claim 12, characterized in that The method further comprises: Based on the contribution score of the i-th terminal device in the r+1-th round, it is determined whether the i-th terminal device continues to participate in the r+2-th round of training.

14. The method according to claim 13, characterized in that The determining, based on the contribution score of the i-th terminal device in the r+1-th round, whether the i-th terminal device continues to participate in the r+2-th round of training includes: Compare the contribution score of the i-th terminal device in the r+1th round with a contribution threshold to determine whether the i-th terminal device continues to participate in the r+2th round of training, where the contribution threshold is used to indicate the minimum contribution score for the i-th terminal device to participate in the training; or, Compare the contribution score of the i-th terminal device in the r+1th round with a penalty threshold to determine whether the i-th terminal device continues to participate in the r+2th round of training, wherein the penalty threshold is used to indicate that the convergence degree of the at least one sub-model trained by the i-th terminal device for t consecutive times is less than the convergence threshold; The value of t is a positive integer greater than 0 and less than r.

15. The method according to claim 14, characterized in that The comparing the contribution score of the i-th terminal device in the r+1-th round with the contribution threshold to determine whether the i-th terminal device continues to participate in the r+2-th round of training includes: When the contribution score of the i-th terminal device in the r+1-th round is less than the contribution threshold, determining that the i-th terminal device does not continue to participate in the r+2-th round of training; or, When the contribution score of the i-th terminal device in the r+1-th round is greater than or equal to the contribution threshold, it is determined that the i-th terminal device continues to participate in the r+2-th round of training.

16. The method according to claim 14, characterized in that The comparing the contribution score of the i-th terminal device in the r+1-th round with the penalty threshold to determine whether the i-th terminal device continues to participate in the r+2-th round of training includes: When the contribution score of the i-th terminal device in the r+1-th round is equal to the penalty threshold, determining that the i-th terminal device does not continue to participate in the r+2-th round of training; or, When the contribution score of the i-th terminal device in the r+1-th round is not equal to the penalty threshold, it is determined that the i-th terminal device continues to participate in the r+2-th round of training.

17. The method according to claim 8, characterized in that Each of the m terminal devices runs an album management program, and the input data is at least one of picture data and video data in the album management program.

18. A model training device based on federated learning, characterized in that: The device comprises: A receiving module, configured to receive at least one sub-model, wherein the at least one sub-model is used for performing federated learning of a global model; an extraction module, configured to extract a first feature of input data based on the at least one sub-model, wherein the input data is data in the terminal device used for training the at least one sub-model; An adding module, used for adding noise to the first feature to obtain a second feature, wherein the noise is used to protect the first feature; A training module, configured to train the at least one sub-model based on the second feature; The sending module is used to send the at least one sub-model that has been trained to the network device.

19. A model training device based on federated learning, characterized in that: The device comprises: A partitioning module is used to divide the global model into n sub-models; A sending module, used to allocate at least one sub-model of the n sub-models to each of the m terminal devices, wherein the at least one sub-model is used to perform federated learning of the global model; a receiving module, configured to receive the n sub-models that have been trained, wherein the n sub-models that have been trained are obtained by adding noise to a first feature of input data of the m terminal devices, the input data is data used in the m terminal devices for training the n sub-models, and the noise is used to protect the first feature; Wherein, the value of n is a positive integer greater than 1, and the value of m is a positive integer greater than 0.

20. A terminal device, characterized in that: The terminal device includes: a processor, a memory and a transceiver, the processor is connected to the transceiver, the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the model training method based on federated learning as described in any one of claims 1 to 7.

21. A network device, characterized in that: The network device includes: a processor, a memory and a transceiver, the processor is connected to the transceiver, the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the model training method based on federated learning as described in any one of claims 8 to 17.

22. A computer-readable storage medium, characterized in that: The storage medium stores at least one program, and the at least one program is loaded and executed by the processor to implement the model training method based on federated learning as described in any one of claims 1 to 17.

23. A computer program product, characterized in that The computer program product includes at least one program, which is stored in a computer-readable storage medium; the processor of the communication device reads the at least one program from the computer-readable storage medium, and the processor executes the at least one program, so that the communication device executes the model training method based on federated learning as described in any one of claims 1 to 17.

24. A computer program, characterized in that The computer program includes at least one program segment, and the at least one program segment is stored in a computer-readable storage medium; the processor of the communication device reads the at least one program segment from the computer-readable storage medium, and the processor executes the at least one program segment, so that the communication device executes the model training method based on federated learning as described in any one of claims 1 to 17.