Model training method and device, server, terminal and storage medium
By receiving data distribution information from the receiving terminals for distributed training, the high bandwidth and high computing resource requirements of centralized meta-learning schemes are solved, improving model training efficiency and generalization ability, and enhancing model performance by utilizing edge terminal data.
Patent Information
- Application Number
- CN202080002976.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-23
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2040-10-23
AI Technical Summary
Centralized meta-learning schemes require a large amount of bandwidth and computing resources, and cannot make full use of edge terminal data, resulting in low model training efficiency and weak generalization ability.
By receiving data distribution information from the terminal, the server selects data with the same distribution to form a training set for initial training, and sends the model parameters to the terminal for distributed training. The terminal then uploads the training results for global updates, reducing direct data transmission and utilizing the terminal's computing resources for distributed training.
It reduces bandwidth usage and server computing resource consumption, shortens the training cycle, improves model training efficiency, enhances the correlation and generalization ability between the model and the terminal, and makes full use of edge terminal data.
Smart Images

Figure CN114667523B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of communication, and particularly relates to a model training method and device, a server, a terminal and a storage medium. BACKGROUND
[0002] Meta learning is a learning method that uses past knowledge and experience to guide the learning of new tasks, and has the ability of learning to learn.
[0003] Centralized meta learning is a solution of meta learning, and the steps usually include: a server collects data from each terminal, and integrates and processes the data to generate a training data set; the server randomly initializes a set of model parameters as global model parameters; a set of tasks is extracted from the training data set in each round of training, and each set of tasks includes multiple tasks, and each task includes a support set and a query set; the support set of the extracted task is used for local update to obtain local updated model parameters; the query set of the extracted task is used for model testing on the local updated model parameters to obtain a test gradient; the average value of the test gradient on each task is determined, and the global model is updated by using the gradient descent method; the above process is repeated until the model converges, a meta model is obtained, and is distributed to each terminal; each terminal fine-tunes the model using local data to obtain an adaptive updated model. SUMMARY
[0004] The embodiments of the present disclosure provide a model training method, device, server, terminal and storage medium, which can save transmission bandwidth and save server computing resources. The technical solution is as follows:
[0005] According to an aspect of the embodiments of the present disclosure, a model training method is provided, and the method comprises:
[0006] Receiving data distribution information of a plurality of terminals, the data distribution information comprising categories of data and sample numbers contained in each category;
[0007] Selecting a training data set conforming to the data distribution information of the plurality of terminals;
[0008] Training a model based on the training data set to obtain model parameters;
[0009] Sending the model parameters to at least part of the plurality of terminals;
[0010] Receiving a training result obtained by training the model parameters by the at least part of the plurality of terminals;
[0011] Updating the model parameters based on the training result of the at least part of the plurality of terminals to obtain global model parameters.
[0012] According to another aspect of the embodiments of the present disclosure, a model training method is provided, which includes:
[0013] sending data distribution information of a terminal, the data distribution information including categories of data and sample numbers contained in each category;
[0014] receiving model parameters, the model parameters being obtained by training a training data set selected by a server based on the data distribution information;
[0015] training the model parameters to obtain a training result;
[0016] sending the training result, the training result being used for globally updating the model parameters to obtain global model parameters.
[0017] According to another aspect of the embodiments of the present disclosure, a model training device is provided, which includes:
[0018] a receiving module configured to receive data distribution information of a plurality of terminals, the data distribution information including categories of data and sample numbers contained in each category;
[0019] a selecting module configured to select a training data set conforming to the data distribution information of the plurality of terminals;
[0020] a model training module configured to perform model training based on the training data set to obtain model parameters;
[0021] a sending module configured to send the model parameters to at least part of the plurality of terminals;
[0022] the receiving module is further configured to receive a training result obtained by training the model parameters by the at least part of the plurality of terminals;
[0023] the model training module is further configured to update the model parameters based on the training result of the at least part of the plurality of terminals to obtain global model parameters.
[0024] According to another aspect of the embodiments of the present disclosure, a model training device is provided, which includes:
[0025] a sending module configured to send data distribution information of a terminal, the data distribution information including categories of data and sample numbers contained in each category;
[0026] a receiving module configured to receive model parameters, the model parameters being obtained by training a training data set selected by a server based on the data distribution information;
[0027] a model training module, configured to train the model parameters to obtain a training result;
[0028] The sending module is further configured to send the training result, where the training result is used to globally update the model parameters to obtain global model parameters.
[0029] According to another aspect of the embodiments of the present disclosure, a server is provided, which comprises a processor, a memory for storing processor-executable instructions, wherein the processor is configured to load and execute the executable instructions to implement the foregoing model training method.
[0030] According to another aspect of the embodiments of the present disclosure, a terminal is provided, which comprises a processor, a memory for storing processor-executable instructions, wherein the processor is configured to load and execute the executable instructions to implement the foregoing model training method.
[0031] According to another aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which, when instructions in the computer-readable storage medium are executed by a processor, can execute the foregoing model training method.
[0032] In the embodiments of the present disclosure, the server receives the data distribution information sent by the terminal, then aggregates the data distribution information of each terminal, selects the data with the same distribution to form a training set for preliminary training, then sends the model parameters to the terminal for distributed training, and then the terminal uploads the training result to the server for global update; in this process, the data distribution information, model parameters, etc. are transmitted between the terminal and the server, and the data of the terminal is not directly transmitted, so that the bandwidth occupation is small; and through the distributed training of the terminal, the server computing resource consumption is small.
[0033] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0034] The accompanying drawings, which are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.
[0035] Figure 1 Fig. 1 shows a block diagram of a model training system according to an illustrative embodiment of the present disclosure;
[0036] Figure 2 Fig. 2 shows a flowchart of a model training method according to an illustrative embodiment;
[0037] Figure 3 Fig. 3 shows a flowchart of a model training method according to an illustrative embodiment;
[0038] Figure 4 is a flow chart of a model training method according to an example embodiment;
[0039] Figure 5 is a flow chart of a connection establishment process according to an example embodiment;
[0040] Figure 6 is a flow chart of a model parameter initialization training process according to an example embodiment;
[0041] Figure 7 is a structural schematic diagram of a model training apparatus according to an example embodiment;
[0042] Figure 8 is a structural schematic diagram of a model training apparatus according to an example embodiment;
[0043] Figure 9 is a block diagram of a terminal according to an example embodiment;
[0044] Figure 10 is a block diagram of a server according to an example embodiment. DETAILED DESCRIPTION
[0045] The example embodiments will be described in detail herein with reference to the drawings. When the following description refers to arrangements in the drawings, identical numbers on different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following example embodiments do not represent all implementations consistent with the present disclosure. Instead, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0046] Figure 1 shown is a block diagram of a model training system provided by one illustrative embodiment of the present disclosure, as shown in Figure 1 The model training system can include a network side 12 and a terminal 13.
[0047] The network side 12 includes a server 120, which communicates with the terminal 13 through a wireless channel. In the embodiments of the present disclosure, the server 120 can belong to a functional unit of a network side device, and the network side device can be a base station, which is a device deployed in an access network to provide wireless communication functions for terminals. The terminal 13 is a terminal accessing the network side device, and the network side device coordinates the terminals to participate in distributed cooperative learning.
[0048] The base station can include various forms of macro base stations, micro base stations, relay stations, access points, and the like. In systems employing different wireless access technologies, the names of devices with base station functions can vary. In the 5G New Radio (NR) system, it is called gNodeB or gNB. As communication technology evolves, the name "base station" can change. For ease of description, the above-mentioned devices providing wireless communication functions for terminals are collectively referred to as network side devices.
[0049] The terminal 13 can include various handheld devices, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem with wireless communication functions, as well as various forms of user equipment, mobile stations (MS), terminals, and the like. For ease of description, the above-mentioned devices are collectively referred to as terminals. The access network device 120 and the terminal 13 communicate with each other through certain air interface technologies, such as the Uu interface.
[0050] In related technologies, the server 120 collects data of each terminal to perform centralized meta-learning (or centralized training). This approach requires data transmission on the one hand, which occupies a large bandwidth. On the other hand, all training work is completed by the server, which takes a long time to train and consumes a large amount of server computing resources. Moreover, meta-learning does not pursue an optimal global model, but hopes to train an initialized model that can quickly adapt to new tasks. Therefore, the performance improvement brought by the long model convergence period in the centralized meta-learning scheme is small, and the model training efficiency is low.
[0051] In addition, in related technologies, many edge terminals of the access network cannot upload data (small sample data) to the server for training due to data privacy, security issues, and the like. The data of these edge terminals often contains a large amount of information, which is very important for improving the performance of the learning model. The centralized meta-learning scheme cannot fully utilize the data of the edge terminals. Moreover, the centralized meta-learning scheme indiscriminately uses server data as training data. If the server data has weak correlation with the terminals, the model trained has weak generalization ability for the tasks of the terminals.
[0052] The model training system and business scenarios described in the embodiments of the present disclosure are used to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. Those skilled in the art can know that, as the model training system evolves and new business scenarios appear, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.
[0053] Figure 2 is a flowchart of a model training method according to an example embodiment. Referring to Figure 2The method comprises the following steps:
[0054] In step 101, the server receives data distribution information of a plurality of terminals.
[0055] The data distribution information comprises categories of data and sample numbers of each category.
[0056] The categories of data are used for classifying data in a data set, for example, in training a picture classification model, pictures in the data set can be classified into multiple categories according to the classification requirements, such as people, plants, landscapes, etc., each of which belongs to a category. The sample number of each category refers to the number of data of each category, for example, the number of pictures of the category of people.
[0057] In step 102, the server selects a training data set that meets the data distribution information of the plurality of terminals.
[0058] After receiving the data distribution information of the plurality of terminals, the server selects data with the same category and sample number as the data distribution information to form a training data set according to the data distribution information of the plurality of terminals.
[0059] In step 103, the server trains a model based on the training data set to obtain model parameters.
[0060] In step 104, the server sends the model parameters to at least part of the plurality of terminals.
[0061] The server can select terminals that meet the requirements of distributed training based on user scheduling information of the terminals, and let these terminals participate in distributed training.
[0062] In step 105, the server receives training results obtained by training the model parameters by the at least part of the terminals.
[0063] In step 106, the server updates the model parameters based on the training results of the at least part of the terminals to obtain global model parameters.
[0064] After training the model parameters provided by the server, the terminal reports the training results to the server, and the server can complete global update based on the training results of each terminal to obtain global model parameters. The global model parameters not only achieve the training target, but also are suitable for the at least part of the terminals due to the integration of the training results of the at least part of the terminals.
[0065] In the embodiments of the present disclosure, the server receives the data distribution information sent by the terminal, then aggregates the data distribution information of each terminal, selects the data with the same distribution to form a training set for preliminary training, then sends the model parameters to the terminal for distributed training, and then the terminal uploads the training result to the server for global update; in this process, the data distribution information and model parameters are transmitted between the terminal and the server, and the data of the terminal is not directly transmitted, so the bandwidth occupation is small; and through the distributed training of the terminal, the server computing resource consumption is small, the training period is short, and the training efficiency is high. At the same time, since the server selects the data with the same distribution as the terminal to form a training set for preliminary training, the relevance between the model and the terminal is strengthened, and the model generalization ability is strong; in addition, in the distributed training process, the terminal directly participates, and since the terminal does not need to upload its own data, even the edge terminal can participate, so that the data of the edge terminal can be used to improve the performance of the learning model, thereby ensuring that the training scheme can fully utilize the data of the edge terminal.
[0066] The scheme for distributed collaborative learning using data distribution characteristics provided by the embodiments of the present disclosure is suitable for training meta-models with strong generalization ability, for example, model training for tasks such as deep learning and image processing.
[0067] Optionally, the data distribution information of the plurality of terminals is received, including:
[0068] The data distribution information transmitted by each terminal in the plurality of terminals through Radio Resource Control (RRC) signaling is received.
[0069] In the embodiments of the present disclosure, when the terminal and the server transmit the data distribution information, the RRC connection can be established first, and the above-mentioned data distribution information can be transmitted through the RRC signaling in the RRC connection establishment process. In this way, the uploading process of the data distribution information can be simplified.
[0070] Optionally, the training data set conforming to the data distribution information of the plurality of terminals is selected, including:
[0071] The data distribution information of the plurality of terminals is combined to obtain total data distribution information.
[0072] The data conforming to the total data distribution information is selected from the local data of the server to obtain the training data set.
[0073] For example, the data distribution information of terminal 1 includes: {type A, sample quantity a1; type B, sample quantity b}; the data distribution information of terminal 2 includes: {type A, sample quantity a2; type C, sample quantity c}; and the total data distribution information includes: {type A, sample quantity a1+a2; type B, sample quantity b; type C, sample quantity c}. The server selects data types and sample quantities according to {type A, sample quantity a1+a2; type B, sample quantity b; type C, sample quantity c} to form a training data set.
[0074] Optionally, the model parameter includes an initial model parameter, and the model training based on the training data set includes:
[0075] The model training based on the training data set includes obtaining the initial model parameter.
[0076] Alternatively, the model parameter includes an intermediate model parameter, and the model training based on the training data set includes:
[0077] The model training based on the training data set includes obtaining the initial model parameter.
[0078] The iterative updating of the initial model parameter includes obtaining the intermediate model parameter.
[0079] In the embodiments of the present disclosure, on the one hand, the server performs model training based on the training data set to obtain an initial model parameter, and then distributes the initial model parameter to the terminal, so that the time for training of the terminal can be saved; on the other hand, the server updates the initial model parameter based on the training result of the terminal to obtain an intermediate model parameter, and then sends the intermediate model parameter to the terminal, so that the terminal can perform training based on the intermediate model parameter, and the whole model training process can be accelerated.
[0080] The intermediate model parameter is obtained by iterative updating of the server based on the training result uploaded by the terminal.
[0081] Optionally, the sending of the model parameter to at least part of the plurality of terminals includes:
[0082] Receiving user scheduling information of each terminal in the plurality of terminals.
[0083] Determining whether each terminal in the plurality of terminals meets a distributed training requirement based on the user scheduling information of each terminal in the plurality of terminals.
[0084] The model parameter is sent to the terminal in the plurality of terminals that meets the distributed training requirement.
[0085] Exemplarily, the user scheduling information comprises at least one of the following parameters:
[0086] a data amount of data in the terminal, a similarity between a data distribution of the data in the terminal and total data distribution information, a communication condition, a computing capability, and a learning model performance requirement, the total data distribution information being obtained by merging data distribution information of the plurality of terminals.
[0087] The data amount of the data in the terminal can be obtained based on the data distribution information uploaded by the terminal, that is, a sum of sample amounts of each type of data in the data distribution information. The similarity between the data distribution and the total data distribution information refers to a difference type between categories included in the terminal and categories in the total data distribution information, such as a ratio of a number of categories included in the terminal to a number of categories in the total data distribution information, and a ratio of a sample amount of each type of category in the terminal to a sample amount of a corresponding type of category in the total data distribution information, and the difference type is obtained by comprehensively considering the two ratios. The communication condition can include channel quality indication information (CQI). The computing capability can include a computing speed and a device surplus computing power, the computing speed referring to a number of computations per second (computations per second / S), and the device surplus computing power referring to a percentage of computing power that can be allocated to model training. The learning model performance requirement includes a preference for a task and a requirement for accuracy, wherein the preference for the task can be represented by a probability characteristic of a task that can be locally executed, and in the case of a classification task, the probability characteristic is represented by a probability of each type of category data appearing in the task: P={p(category 1), p(category 2), …}. Exemplarily, the requirement for accuracy can be as follows: model accuracy > 90%.
[0088] Exemplarily, for each parameter in the user scheduling information, the server sets a threshold range that meets the requirement of distributed training, and when each parameter of a terminal meets the set threshold range, the terminal meets the requirement of distributed training.
[0089] Optionally, sending the model parameters to the terminals that meet the requirement of distributed training in the plurality of terminals comprises:
[0090] determining data transmission parameters based on a data amount of the model parameters and a communication condition of the terminals that meet the requirement of distributed training;
[0091] sending the model parameters to the terminals that meet the requirement of distributed training according to the data transmission parameters.
[0092] Here, the data transmission parameters include modulation modes, code rates, and the like. For different data amounts of the model parameters and different communication conditions of the terminals, different modulation modes and code rates can be selected for transmission, so that the selected modulation modes and code rates match the current data amount to be transmitted and the communication condition of the terminal, thereby achieving a better transmission effect.
[0093] The data amount of the model parameters is related to the model size, and the larger the model is, the larger the data amount of the model parameters is. The data amount of the model parameters is also related to the precision of each model parameter, and the higher the model precision is, the larger the data amount of the model parameters is. The precision of the model parameters can refer to the number of digits after the decimal point. The higher the precision of the model parameters is, the more the number of digits after the decimal point is, and the larger the data amount of the model parameters is.
[0094] Optionally, the training result includes a gradient value, and the gradient value is a gradient value obtained by testing the model parameter after the terminal trains the model parameter.
[0095] Alternatively, the training result includes a model update parameter, and the model update parameter is a model parameter obtained by the terminal training the model parameter.
[0096] In the embodiments of the present disclosure, the training result of the terminal can have two cases, one is a gradient value obtained by testing after training, and the other is a model update parameter obtained by only model training without testing. The reason for the existence of these two cases is that the data amount of the data in the terminal is different. For example, when the data amount of the data in the terminal is large, the data in the terminal can form a support set and a query set. At this time, the terminal can first train the model using the support set, and then test the model using the query set. When the data amount of the data in the terminal is small, the data in the terminal can only form a support set. At this time, the terminal trains the model using the support set, and the model testing is completed by the server.
[0097] Here, the size of the data amount in the terminal can be obtained by comparing with a threshold value. For example, greater than the threshold value is large, and less than the threshold value is small. The threshold value can be determined based on the data amount of multiple terminals. For example, it can be a quantile of the data amount of multiple terminals, such as 80% of the users' data amount reaching 1000, and the threshold value is set to 1000. The threshold value can be determined by the server based on the data distribution information of each terminal, and then notified to each terminal.
[0098] Optionally, when the training result of each terminal in the at least part of the terminals includes a gradient value,
[0099] Based on the training result of the at least part of the terminals, the model parameters are updated to obtain global model parameters, including:
[0100] Based on the average value of the gradient values of the at least part of the terminals, the model parameters are iteratively updated by using the gradient descent method to obtain the global model parameters.
[0101] In this case, each of the at least part of the terminals has a large amount of data, and can simultaneously form a support set and a query set, so that each of the at least part of the terminals reports a gradient value to the server, thereby facilitating the server to complete iterative updating of the model parameters.
[0102] Optionally, when the training result of at least one terminal of the at least part of the terminals comprises a model update parameter,
[0103] Based on the training result of the at least part of the terminals, the model parameters are updated to obtain global model parameters, including:
[0104] Selecting a query set conforming to the data distribution information of the first terminal, the first terminal being a terminal whose training result comprises a model update parameter;
[0105] Based on the query set, the model update parameter of the first terminal is tested to obtain a gradient value;
[0106] Based on the average of the gradient values of the at least part of the terminals, the model parameters are iteratively updated by using a gradient descent method to obtain global model parameters.
[0107] In this case, the data amount of part of the terminals is small, and the support set and the query set cannot be simultaneously formed, so that these terminals only report model update parameters to the server, the server extracts a query set from the local for model testing, and then iteratively updates the model parameters by using the gradient value obtained by testing.
[0108] Optionally, based on the average of the gradient values of the at least part of the terminals, the model parameters are iteratively updated by using a gradient descent method to obtain global model parameters, including:
[0109] Based on the average of the first gradient values of the at least part of the terminals, the model parameters are iteratively updated by using a gradient descent method.
[0110] Determining whether the average of the first gradient values of the at least part of the terminals is within a threshold range;
[0111] In response to the average of the first gradient values of the at least part of the terminals not being within the threshold range, the intermediate model parameters after the iterative updating of the model parameters are sent to the at least part of the terminals;
[0112] The average of the second gradient values of the at least part of the terminals is used to iteratively update the intermediate model parameters; wherein the second gradient value is a gradient value obtained by testing the intermediate model parameters after training of the intermediate model parameters by the terminal.
[0113] Optionally, the method further comprises:
[0114] In response to the average value of the first gradient values of the at least part of the terminals being within a threshold range, the server sends the updated global model parameters to the at least part of the terminals, and the global model parameters are used by the terminals for adaptive updating.
[0115] In the embodiments of the present disclosure, the updating of the model parameters is generally a multi-round distributed training process, that is, the at least part of the terminals perform a model training and report the respective training results as a round of distributed training. After the round of distributed training, on the one hand, the server performs global updating based on the training results; on the other hand, the terminals can determine whether the requirement of the distributed training is met based on the average value of the gradient values corresponding to the training results of the terminals. If the requirement is met, the updated global model is used as a global updated model, and the global updated model does not need to be subjected to distributed training but can be used after adaptive training by the user. If the requirement is not met, the updated intermediate model parameters are sent to the terminals as the basis for the next round of training of the terminals, and the next round of training of the terminals is performed based on the intermediate model parameters.
[0116] In the implementation manner, the server monitors the effect of the distributed model training, and stops learning when the model accuracy meets the requirement, without requiring the training to be performed until the model converges. This training manner greatly improves the training efficiency, and meanwhile, the global model parameters are subsequently subjected to adaptive updating by the terminals, so that each terminal obtains a more personalized model, thereby ensuring that the model used by the terminal is more suitable for the task requirement of the terminal and ensuring the model performance.
[0117] The adaptive updating of the terminal can mean that the terminal updates the model parameters based on the global model parameters and the data in the terminal, so that the model parameters meet the requirement of the terminal.
[0118] It should be noted that the foregoing steps 101 to 102 and the optional steps described above can be combined in any manner.
[0119] Figure 3 is a flowchart of a model training method according to an example embodiment. Referring to Figure 3 The method includes the following steps:
[0120] In step 201, the terminal sends data distribution information of the terminal, and the data distribution information includes the categories of the data and the number of samples included in each category.
[0121] The terminal counts the number of samples of each data category locally, generates data distribution information, and sends the data distribution information to the server.
[0122] In step 202, the terminal receives the model parameters, which are obtained by the server based on the data distribution information.
[0123] The model parameters herein can be initial model parameters or intermediate model parameters.
[0124] In step 203, the terminal trains the model parameters to obtain a training result.
[0125] In step 204, the terminal sends the training result, which is used for globally updating the model parameters to obtain global model parameters.
[0126] In the embodiments of the present disclosure, the terminal sends its data distribution information to the server, the server aggregates the data distribution information of each terminal, selects data with the same distribution to form a training set for preliminary training, and then sends the model parameters to the terminal for distributed training, and then the terminal uploads the training result to the server for global update; in this process, the data distribution information, model parameters, etc. are transmitted between the terminal and the server, and the terminal data is not directly transmitted, so the bandwidth occupation is small; and through the distributed training of the terminal, the server computing resource consumption is small.
[0127] Optionally, the data distribution information of the terminal is sent, including:
[0128] The data distribution information is sent through RRC signaling.
[0129] Optionally, the model parameters include initial model parameters, and the received model parameters include:
[0130] The initial model parameters are obtained by the server by training a training data set selected based on the data distribution information;
[0131] Alternatively, the model parameters include intermediate model parameters, and the received model parameters include:
[0132] The intermediate model parameters are obtained by the server by iteratively updating the initial model parameters.
[0133] Optionally, the training result includes a gradient value, which is a gradient value obtained by testing the trained model parameters after the model parameters are trained.
[0134] Alternatively, the training result includes model update parameters, which are model parameters obtained after the model parameters are trained.
[0135] Optionally, when the training result includes model update parameters,
[0136] sending the training result, comprising:
[0137] determining a data transmission parameter based on an amount of data of the model update parameter and a communication condition of the terminal;
[0138] sending the model update parameter to a server according to the data transmission parameter.
[0139] Optionally, the method further comprises:
[0140] sending user scheduling information, the user scheduling information comprising at least one of the following parameters: an amount of data in the terminal, a similarity between data distribution and total data distribution information, a communication condition, a computing capability, a learning model performance requirement, the total data distribution information being obtained by merging data distribution information of the plurality of terminals.
[0141] Optionally, the method further comprises:
[0142] receiving a global model parameter;
[0143] adaptively updating the global model parameter.
[0144] It is worth noting that the foregoing steps 201-202 and the optional steps described above can be combined in any manner.
[0145] Figure 4 is a flowchart of a model training method according to an exemplary embodiment. Referring to Figure 4 , the method comprises the following steps:
[0146] In step 301, the server and the terminal establish an RRC connection.
[0147] Exemplarily, the process of the server and the terminal establishing an RRC connection can refer to Figure 5 , and the steps are as follows:
[0148] Step 3011, the terminal sends a request to establish an RRC connection signaling to the server, and the request to establish an RRC connection signaling applies to request the server to establish an RRC connection. Correspondingly, the server receives the request to establish an RRC connection signaling.
[0149] Step 3012, the server sends an RRC connection establishment signaling to the client, and the RRC connection establishment signaling is used to inform the terminal that the server agrees to establish an RRC connection. Correspondingly, the terminal receives the RRC connection establishment signaling.
[0150] In step 3013, the terminal sends an RRC connection establishment completion signaling to the server, where the RRC connection establishment completion signaling is used to inform the server that the RRC connection establishment is completed. Correspondingly, the server receives the RRC connection establishment completion signaling.
[0151] The signaling transceiving in the RRC connection establishment process described above is performed by a network communication module of the terminal and a network communication module of the server. The network communication modules of the terminal and the server can both be composed of a sending module and a receiving module.
[0152] In step 302, the terminal sends data distribution information to the server, and the server receives the data distribution information sent by the terminal.
[0153] The data distribution information includes the categories of data and the number of samples contained in each category.
[0154] In the embodiments of the present disclosure, steps 301 and 302 can have no sequence, for example, the data distribution information can be transmitted in the process of establishing the RRC connection between the server and the terminal, that is, the server receives the data distribution information transmitted by the terminal through the RRC signaling. For example, the server receives the data distribution information transmitted by the terminal through the RRC connection establishment completion signaling.
[0155] In step 303, the server combines the data distribution information of the plurality of terminals to obtain total data distribution information.
[0156] For example, the data distribution information of terminal 1 includes: {type A, sample number a1; type B, sample number b}; the data distribution information of terminal 2 includes: {type A, sample number a2; type C, sample number c}; and the total data distribution information includes: {type A, sample number a1+a2; type B, sample number b; type C, sample number c}.
[0157] In step 304, the server selects data from the local data of the server, where the distribution of the data conforms to the total data distribution information, to obtain the training data set.
[0158] For example, the server selects the data type and sample size according to {type A, sample number a1+a2; type B, sample number b; type C, sample number c} obtained by combining in step 303 to form the training data set.
[0159] In step 305, the server trains a model using the training data set to obtain the initialization model parameter.
[0160] For example, the process of training the server to obtain the initialization model parameter can refer to Figure 6 , and the steps are as follows:
[0161] Step 3051, the server randomly initializes a set of model parameters.
[0162] Step 3052, the server extracts a batch of tasks from the training data set, each task including a support set and a query set.
[0163] Exemplarily, the total data distribution information is denoted as P, and the server local data is denoted as D s , the data is extracted from the local data according to the total data distribution information P to generate a training data set, denoted as The server extracts data from the training data set to generate a plurality of tasks, each task containing a support set and a query set, denoted as and
[0164] Step 3053, the server uses the support set of each task for training and calculates the model loss and gradient to obtain the updated model parameters on each task.
[0165] Exemplarily, the server can use the gradient descent method to obtain the updated model parameters, which can be represented by the following formula (1):
[0166]
[0167] where θ' i i represents the updated model parameters on the i-th task, θ represents the initialized set of model parameters, α represents the learning rate of a single task, represents the derivative, L represents the loss function of the model on the support set, f represents the model, T i represents the i-th task, represents the support set of the i-th task.
[0168] Step 3054, the server uses the query set of each task to calculate the test loss and gradient of the updated model parameters.
[0169] Step 3055, the server aggregates the gradients on each task to update the randomly initialized model parameters to obtain the initialized model parameters.
[0170] Exemplarily, the server uses the query set of each task to calculate the test loss and gradient of the updated model parameters, sums and averages the gradients on each task. The global model parameters are updated using the gradient descent method with the average gradient value, which can be represented by the following formula (2):
[0171]
[0172] where β represents the global learning rate, N represents the number of tasks used in this round of training, and p(T) represents the set of tasks used in this round of training, a query set representing the i-th task.
[0173] In the above process, each step can be performed by the model training module of the server, and in step 3052, the training data set of the server can be stored in the data processing and storage module of the server, and the model training module can perform signaling interaction with the data processing and storage module, thereby extracting a batch of tasks.
[0174] In step 306, the terminal sends user scheduling information to the server; the server receives the user scheduling information sent by the terminal.
[0175] The user scheduling information includes at least one of the following parameters: data volume of data in the terminal, similarity between data distribution and total data distribution information, communication condition, computing capability, and learning model performance requirement, wherein the total data distribution information is obtained by merging data distribution information of the plurality of terminals.
[0176] In the embodiment of the present disclosure, step 306 and step 302 can be executed simultaneously, that is, the terminal sends the user scheduling information to the server together when transmitting the data distribution information, that is, the user scheduling information can also be transmitted through RRC signaling.
[0177] In an implementation manner of the embodiment of the present disclosure, the user scheduling information can only include the communication condition, the computing capability, and the learning model performance requirement, and the data volume of data in the terminal and the similarity between the data distribution and the total data distribution information can be determined by the server based on the data distribution information.
[0178] In the embodiment of the present disclosure, each parameter in the user scheduling information can be sent to the server together or sequentially.
[0179] Among these parameters, the communication condition usually includes CQI, and the CQI needs to be obtained by the terminal through measurement. Therefore, the method can further include: before step 306, the terminal performs CQI measurement.
[0180] In the embodiment of the present disclosure, the user scheduling information is obtained by the user management module in the terminal and sent to the network communication module of the server through the network communication module of the terminal, and then transmitted to the user management module of the server by the network communication module of the server. When the network communication module and the user management module in the above terminal or server perform user scheduling information transmission, a new signaling can be used to perform the transmission, and the function of the signaling is to transmit the user scheduling information.
[0181] In step 307, the server determines whether each terminal in the plurality of terminals meets the distributed training requirement based on the user scheduling information of each terminal in the plurality of terminals.
[0182] Exemplarily, for each parameter in the user scheduling information, the server sets a threshold range meeting the requirement of distributed training, and when each parameter of a terminal meets the set threshold range, the terminal meets the requirement of distributed training.
[0183] The other terminals in the plurality of terminals except the selected terminals meeting the requirement of distributed training do not participate in the training.
[0184] In step 308, the server sends the initial model parameters to the terminals meeting the requirement of distributed training in the plurality of terminals. The terminals receive the initial model parameters.
[0185] In this step, if the terminal in steps 301-307 belongs to the terminal meeting the requirement of distributed training, the terminal participates in steps 308-314; if the terminal in steps 301-307 does not belong to the terminal meeting the requirement of distributed training, the terminal does not participate in steps 308-314. This embodiment is described by taking the terminal in steps 301-307 as the terminal meeting the requirement of distributed training.
[0186] Exemplarily, when the server transmits the initial model parameters, it first determines the data transmission parameters based on the data volume of the initial model parameters and the communication condition of the terminal, and then sends the initial model parameters to the terminal according to the data transmission parameters. Here, the determination of the data transmission parameters can be performed by the transmission control module in the server, and after the transmission control module determines the data transmission parameters, it can control the network communication module to send the initial model parameters according to the data transmission parameters.
[0187] Here, the data transmission parameters include modulation mode, code rate and other parameters. For different data volumes of model parameters and different communication conditions of terminals, different modulation modes and code rates can be selected for transmission, so that the selected modulation mode and code rate match the current data volume to be transmitted and the communication condition of the terminal, thereby achieving better transmission effect.
[0188] For example, the server encapsulates and packages the initial model parameters according to the above data transmission scheme. The server sends the data packet of the packaged initial model parameters to the terminal. The terminal receives and decapsulates the data packet. The terminal confirms the correctness of the received data packet based on the decapsulated data. Then the terminal feeds back a message to the server, informing the server that the terminal has correctly received the initial model parameters.
[0189] In the above process, for the terminal, verifying the correctness of the data packet and generating the feedback message are performed by the transmission control module in the terminal, and the receiving and sending processes are performed by the network communication module.
[0190] The data amount of the model parameters is related to the model size, and the larger the model is, the larger the data amount of the model parameters is. The data amount of the model parameters is also related to the precision of each model parameter, and the higher the model precision is, the larger the data amount of the model parameters is. The precision of the model parameters can refer to the number of digits after the decimal point. The higher the precision of the model parameters is, the more the number of digits after the decimal point is, and the larger the data amount of the model parameters is.
[0191] In step 309, the terminal trains the initial model parameters to obtain a training result.
[0192] In the embodiments of the present disclosure, the training result of the terminal can have two cases. One is the gradient value obtained by testing after training, and the other is the model update parameter obtained by only performing model training without testing. The reason for the existence of these two cases is that the data amount of the data in the terminal is different. For example, when the data amount of the data in the terminal is large, the data in the terminal can form a support set and a query set. At this time, the terminal can first perform model training using the support set, and then perform model testing using the query set. When the data amount of the data in the terminal is small, the data in the terminal can only form a support set. At this time, the terminal performs model training using the support set, and the model testing is completed by the server.
[0193] Here, the size of the data amount in the terminal can be obtained by comparing with a threshold value. For example, greater than the threshold value is large, and less than the threshold value is small. The threshold value can be determined based on the data amount of a plurality of terminals. For example, it can be a quantile of the data amount of a plurality of terminals, such as 80% of the users. If the data amount of the terminal is 1000, the threshold value is set to 1000. The threshold value can be determined by the server based on the data distribution information of each terminal, and then notified to each terminal. The terminal can compare the threshold value with the data amount of the terminal to determine whether to generate a query set.
[0194] Exemplarily, the terminal updates the initial model parameters using the support set by gradient descent to obtain the model update parameter, which can be represented by the following formula (3):
[0195]
[0196] wherein θ ui represents the model update parameter of the i th terminal, represents the support set in the i th terminal.
[0197] If the query set exists in the terminal, the terminal tests the model update parameter using the query set, and calculates the test loss and the gradient value, which can be represented by the following formula (4):
[0198]
[0199] wherein gui This represents the test gradient of the model update parameters for the i-th terminal. This represents the query set in the training set of the i-th terminal.
[0200] In step 310, the terminal sends the training results to the server; the server receives the training results sent by the terminal.
[0201] When the terminal sends training results, if it sends model update parameters, it can do so in the same way as the server sends initial model parameters in step 308. That is, the data transmission parameters are determined first, and then the data is sent according to the data transmission parameters. More generally, in this embodiment of the disclosure, if the terminal and server need to transmit model parameters, the process is always performed by first determining the data transmission parameters and then transmitting them according to the data transmission parameters.
[0202] In step 311, the server updates the model parameters based on the training results of at least some of the terminals. If the updated model parameters meet the requirements, step 312 is executed; if the updated model parameters do not meet the requirements, step 313 is executed.
[0203] Here, "at least some terminals" refers to terminals that participate in training and meet the requirements of distributed training. The server can obtain the average gradient values of at least some terminals based on their training results. If the average gradient values of at least some terminals are within a threshold range (e.g., less than a set value), it indicates that the updated model parameters meet the requirements; otherwise, it indicates that the updated model parameters do not meet the requirements.
[0204] For example, when the training result of each of the at least some terminals includes gradient values, step 311 may include:
[0205] The server iteratively updates the model parameters using gradient descent based on the average gradient values of at least some of the terminals.
[0206] For example, when the training result of at least one of the at least some terminals includes model update parameters, step 311 may include:
[0207] The server selects a query set that matches the data distribution information of the first terminal, where the first terminal is the terminal whose training results include model update parameters.
[0208] The server tests the model update parameters of the first terminal based on the query set and obtains the gradient value;
[0209] The server iteratively updates the model parameters using gradient descent based on the average gradient values of at least some of the terminals.
[0210] In this step, the server determines whether to generate a query set for the terminal according to the data volume of each terminal.
[0211] In the embodiments of the present disclosure, the server performs gradient descent update on the model parameters using the average value of the gradient values of at least part of the terminals, which can be represented by the following formula (5):
[0212]
[0213] Wherein, M represents the number of terminals meeting the requirements of distributed training, that is, the number of terminals participating in distributed training.
[0214] The above determination that the updated model parameters meet the requirements can be determined according to the following formula (6):
[0215]
[0216] Wherein, g0 represents the aforementioned threshold value (set value).
[0217] Step 311 can be performed by a model update module in the server. During the execution of the above steps, the module needs to interact with the data processing and storage module in the server to obtain data for the terminal to generate a query set. In this interaction process, a newly added signaling can be used to instruct the data processing and storage module to provide the data for generating the query set.
[0218] In step 312, the server sends the intermediate model parameters updated by iteration to the at least part of the terminals; and the terminal receives the intermediate model parameters sent by the server.
[0219] After receiving the intermediate model parameters sent by the server, the terminal trains the intermediate model parameters to obtain a training result, and then repeats steps 310 and 311 for iterative update.
[0220] In step 313, the server sends the global model parameters updated by iteration to the at least part of the terminals; and the terminal receives the global model parameters sent by the server.
[0221] In the above steps, only data distribution information, user scheduling information, etc. can be transmitted through RRC signaling between the server and the terminal, and subsequent model parameters, training results, etc. are transmitted through service data due to large data volume.
[0222] In step 314, the terminal performs adaptive update on the global model parameters.
[0223] In the embodiments of the present disclosure, the terminal adopts a support set to test the global model parameters, calculates the test loss and gradient, and performs gradient descent update to obtain an adaptive model, which can be represented by the following formula (7):
[0224]
[0225] wherein, Φ ui (θ) is the adaptive update model of the i th terminal, is the query set in the test set of the i th terminal.
[0226] The foregoing steps 309 and 314 can be performed by a model update module in the terminal. In the process of performing the foregoing steps, the module needs to interact with a data processing and storage module in the terminal to obtain data to generate a support set, a query set, and the like.
[0227] Figure 7 FIG. 1 is a structural schematic diagram of a model training device according to an example embodiment. The device has the function of the server in the method embodiments described above. The function can be implemented by hardware, or by hardware executing corresponding software. As shown in FIG. 1, the device includes a receiving module 501, a selection module 502, a model training module 503, and a sending module 504. Figure 7
[0228] The receiving module 501 is configured to receive data distribution information of a plurality of terminals. The data distribution information includes the categories of data and the number of samples contained in each category.
[0229] The selection module 502 is configured to select a training data set that meets the data distribution information of the plurality of terminals.
[0230] The model training module 503 is configured to perform model training based on the training data set to obtain model parameters.
[0231] The sending module 504 is configured to send the model parameters to at least part of the plurality of terminals.
[0232] The receiving module 501 is further configured to receive a training result obtained by training the model parameters by the at least part of the terminals.
[0233] The model training module 503 is further configured to update the model parameters based on the training result of the at least part of the terminals to obtain global model parameters.
[0234] Optionally, the receiving module 501 is configured to receive the data distribution information transmitted by each terminal in the plurality of terminals through RRC signaling.
[0235] Optionally, the selecting module 502 is configured to combine the data distribution information of the plurality of terminals to obtain total data distribution information; and select data with distribution conforming to the total data distribution information from local data of a server to obtain the training data set.
[0236] Optionally, the model parameter comprises an initial model parameter, and the model training module 503 is configured to perform model training by using the training data set to obtain the initial model parameter.
[0237] Alternatively, the model parameter comprises an intermediate model parameter, and the model training module 503 is configured to perform model training by using the training data set to obtain an initial model parameter; and perform iterative updating on the initial model parameter to obtain the intermediate model parameter.
[0238] Optionally, the receiving module 501 is further configured to receive user scheduling information of each terminal in the plurality of terminals.
[0239] The apparatus further comprises a determining module 505 configured to determine whether each terminal in the plurality of terminals conforms to a distributed training requirement based on the user scheduling information of each terminal in the plurality of terminals.
[0240] The sending module 504 is configured to send the model parameter to the terminal conforming to the distributed training requirement in the plurality of terminals.
[0241] Optionally, the user scheduling information comprises at least one of the following parameters:
[0242] a data amount of data in the terminal, a similarity between data distribution and total data distribution information, a communication condition, a computing capability, and a learning model performance requirement, the total data distribution information being obtained by combining data distribution information of the plurality of terminals.
[0243] Optionally, the determining module 505 is further configured to determine a data transmission parameter based on a data amount of the model parameter and a communication condition of the terminal conforming to the distributed training requirement.
[0244] The sending module 504 is configured to send the model parameter to the terminal conforming to the distributed training requirement according to the data transmission parameter.
[0245] Optionally, the training result comprises a gradient value, the gradient value being a gradient value obtained by testing the model parameter after training by the terminal.
[0246] Alternatively, the training result comprises a model update parameter, the model update parameter being a model parameter obtained by the terminal after training the model parameter.
[0247] Optionally, when the training result of each terminal of the at least part of terminals comprises a gradient value,
[0248] The model training module 503 is configured to iteratively update the model parameter based on the average of the gradient values of the at least part of terminals by using the gradient descent method, to obtain a global model parameter.
[0249] Optionally, when the training result of at least one terminal of the at least part of terminals comprises a model update parameter,
[0250] The selection module 502 is configured to select a query set conforming to the data distribution information of the first terminal, the first terminal being a terminal whose training result comprises a model update parameter.
[0251] The model training module 503 is configured to test the model update parameter of the first terminal based on the query set, to obtain a gradient value; and iteratively update the model parameter based on the average of the gradient values of the at least part of terminals by using the gradient descent method, to obtain a global model parameter.
[0252] Optionally, the model training module 503 is configured to iteratively update the model parameter based on the average of the first gradient values of the at least part of terminals by using the gradient descent method; determine whether the average of the first gradient values of the at least part of terminals is within a threshold range; in response to the average of the first gradient values of the at least part of terminals not being within the threshold range, send an intermediate model parameter after the model parameter is iteratively updated to the at least part of terminals; iteratively update the intermediate model parameter by using the average of the second gradient values of the at least part of terminals; wherein the second gradient value is a gradient value obtained by testing the intermediate model parameter after the at least part of terminals train the intermediate model parameter.
[0253] Optionally, the sending module 504 is further configured to, in response to the average of the first gradient values of the at least part of terminals being within the threshold range, send a global model parameter after the model parameter is iteratively updated to the at least part of terminals, the global model parameter being used for adaptive update by the terminals.
[0254] Figure 8 is a structural schematic diagram of a model training device according to an exemplary embodiment. The device has the function of the terminal in the above-mentioned method embodiments, which can be realized by hardware, or realized by hardware executing corresponding software. As shown in Figure 8 the device comprises a sending module 601, a receiving module 602 and a model training module 603.
[0255] The sending module 601 is configured to send data distribution information of the terminal, the data distribution information including categories of data and sample numbers contained in each category.
[0256] The receiving module 602 is configured to receive model parameters, the model parameters being obtained by training a training data set selected by the server based on the data distribution information.
[0257] The model training module 603 is configured to train the model parameters to obtain a training result.
[0258] The sending module 601 is further configured to send the training result, the training result being used for globally updating the model parameters to obtain global model parameters.
[0259] Optionally, the sending module 601 is configured to send the data distribution information through RRC signaling.
[0260] Optionally, the model parameters include initialization model parameters, and the receiving module 602 is configured to receive the initialization model parameters, the initialization model parameters being obtained by training a training data set selected by the server based on the data distribution information.
[0261] Alternatively, the model parameters include intermediate model parameters, and the receiving module 602 is configured to receive the intermediate model parameters, the intermediate model parameters being obtained by iteratively updating the initialization model parameters.
[0262] Optionally, the training result includes a gradient value, the gradient value being a gradient value obtained by testing the model parameters after training.
[0263] Alternatively, the training result includes model update parameters, the model update parameters being model parameters obtained after training the model parameters.
[0264] Optionally, when the training result includes the model update parameters,
[0265] The apparatus further includes a determination module 604 configured to determine data transmission parameters based on a data amount of the model update parameters and a communication condition of the terminal.
[0266] The sending module 601 is configured to send the model update parameters to the server according to the data transmission parameters.
[0267] Optionally, the sending module 601 is further configured to send user scheduling information, the user scheduling information including at least one of the following parameters: data amount of data in a terminal, similarity of data distribution and total data distribution information, communication condition, computing capability, learning model performance requirement, the total data distribution information being obtained by merging data distribution information of the plurality of terminals.
[0268] Optionally, the receiving module 602 is further configured to receive global model parameters.
[0269] The model training module 603 is further configured to perform adaptive update on the global model parameters.
[0270] Figure 9 FIG. 7 is a block diagram of a terminal 700 according to an example embodiment, which can include a processor 701, a receiver 702, a transmitter 703, a memory 704, and a bus 705.
[0271] The processor 701 includes one or more processing cores, and performs various functional applications and information processing by running software programs and modules.
[0272] The receiver 702 and the transmitter 703 can be implemented as a communication component, which can be a communication chip.
[0273] The memory 704 is connected to the processor 701 through the bus 705.
[0274] The memory 704 can be used to store at least one instruction, and the processor 701 is configured to execute the at least one instruction to implement each step in the above method embodiments.
[0275] In addition, the memory 704 can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, including but not limited to: magnetic or optical disks, electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), read-only memory (ROM), magnetic storage, flash memory, programmable read-only memory (PROM).
[0276] In example embodiments, a computer readable storage medium is also provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the model training method provided by each of the above method embodiments.
[0277] Figure 10is a block diagram of a server 800 according to an exemplary embodiment, which can include a processor 801, a receiver 802, a transmitter 803 and a memory 804. The receiver 802, the transmitter 803 and the memory 804 are connected with the processor 801 through a bus respectively.
[0278] The processor 801 includes one or more processing cores, and the processor 801 executes the method performed by the server in the model training method provided by the embodiments of the present disclosure by running software programs and modules. The memory 804 can be used to store software programs and modules. Specifically, the memory 804 can store an operating system 8041 and at least one application module 8042 required by a function. The receiver 802 is configured to receive communication data sent by other devices, and the transmitter 803 is configured to send communication data to other devices.
[0279] In an exemplary embodiment, a computer readable storage medium is also provided, which stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the model training method provided by each method embodiment.
[0280] An exemplary embodiment of the present disclosure also provides a model training system, which includes a terminal and a server. The terminal is the terminal provided by the exemplary embodiment as shown in Figure 9 The server is the server provided by the exemplary embodiment as shown in Figure 10 .
[0281] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses or adaptive changes of the present disclosure along with their equivalents that incorporate the general principles of the present disclosure and include known expedients or ones that are obvious in light of the present disclosure. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0282] It should be understood that the present disclosure is not limited to the precise structures as herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the claims that follow.
Claims
1. A model training method, characterized in that, The method comprises: receiving data distribution information of a plurality of terminals, the data distribution information comprising categories of data and sample numbers of respective categories; selecting a training data set conforming to the data distribution information of the plurality of terminals; training a model based on the training data set to obtain model parameters; receiving user scheduling information of each terminal in the plurality of terminals; the user scheduling information comprising at least one of the following parameters: data volume of data in the terminal, similarity of data distribution to total data distribution information, communication condition, computing capability, and learning model performance requirement, the total data distribution information being obtained by combining the data distribution information of the plurality of terminals, the data volume of data in the terminal being a sum of sample volumes of respective categories of data in the data distribution information, and the similarity of data distribution to total data distribution information being a ratio of a number of categories included in the terminal to a number of categories in the total data distribution information, and a ratio of a sample number of each category in the terminal to a sample number of a corresponding category in the total data distribution information; determining whether each terminal in the plurality of terminals conforms to a distributed training requirement based on the user scheduling information of each terminal in the plurality of terminals; sending the model parameters to terminals in the plurality of terminals that conform to the distributed training requirement; receiving training results obtained by at least part of the terminals training the model parameters; updating the model parameters based on the training results of the at least part of the terminals to obtain global model parameters.
2. The method of claim 1, wherein, The method comprises: receiving data distribution information of a plurality of terminals, the data distribution information comprising categories of data and sample numbers of respective categories; 3. The method of claim 1, wherein, receiving the data distribution information transmitted by each terminal in the plurality of terminals through RRC signaling. The method comprises: combining the data distribution information of the plurality of terminals to obtain total data distribution information; 4. The method of claim 1, wherein, selecting data conforming to the total data distribution information from local data of a server to obtain the training data set. The model parameters comprise initialization model parameters, the method of training a model based on the training data set to obtain model parameters comprising: training a model using the training data set to obtain the initialization model parameters; Alternatively, the model parameters comprise intermediate model parameters, the method of training a model based on the training data set to obtain model parameters comprising: training a model using the training data set to obtain initialization model parameters; 5. The method of claim 1, wherein, iteratively updating the initialization model parameters to obtain the intermediate model parameters. The method comprises: determining data transmission parameters based on data volume of the model parameters and communication conditions of the terminals conforming to the distributed training requirement; 6. The method according to any one of claims 1 to 5, characterized in that, sending the model parameters to the terminals conforming to the distributed training requirement according to the data transmission parameters. The training results comprise gradient values, the gradient values being gradient values obtained by testing the model parameters trained by the terminals. Alternatively, the training result comprises model update parameters, which are model parameters obtained after the terminal trains the model parameters.
7. The method of claim 6, wherein, When the training result of each of the at least part of terminals comprises a gradient value, Based on the training result of the at least part of terminals, the model parameters are updated to obtain global model parameters, comprising: Based on the average of the gradient values of the at least part of terminals, the model parameters are iteratively updated by using gradient descent method to obtain global model parameters.
8. The method of claim 6, wherein, When the training result of at least one of the at least part of terminals comprises model update parameters, Based on the training result of the at least part of terminals, the model parameters are updated to obtain global model parameters, comprising: Selecting a query set conforming to the data distribution information of the first terminal, the first terminal being a terminal whose training result comprises model update parameters; Based on the query set, the model update parameters of the first terminal are tested to obtain a gradient value; Based on the average of the gradient values of the at least part of terminals, the model parameters are iteratively updated by using gradient descent method to obtain global model parameters.
9. The method according to claim 7 or 8, characterized in that, Based on the average of the gradient values of the at least part of terminals, the model parameters are iteratively updated by using gradient descent method to obtain global model parameters, comprising: Based on the average of the first gradient values of the at least part of terminals, the model parameters are iteratively updated by using gradient descent method; Determine whether the average of the first gradient values of the at least part of terminals is within a threshold range; In response to the average of the first gradient values of the at least part of terminals not being within the threshold range, send the intermediate model parameters obtained after the model parameters are iteratively updated to the at least part of terminals; The average of the second gradient values of the at least part of terminals is used to iteratively update the intermediate model parameters; wherein the second gradient value is a gradient value obtained by testing the intermediate model parameters after the terminal trains the intermediate model parameters.
10. The method of claim 9, wherein, The method further comprises: In response to the average of the first gradient values of the at least part of terminals being within the threshold range, send the global model parameters obtained after the model parameters are iteratively updated to the at least part of terminals, the global model parameters being used for adaptive update of the terminal.
11. A model training method, comprising: The method comprises: Sending data distribution information of the terminal, the data distribution information comprising categories of data and the number of samples contained in each category; sending user scheduling information, the user scheduling information including at least one of the following parameters: data amount of data in the terminal, similarity of data distribution and total data distribution information, communication condition, computing capability, learning model performance requirement, the total data distribution information being obtained by merging data distribution information of multiple terminals; the user scheduling information being used to determine whether the terminal meets distributed training requirements; the data amount of data in the terminal being a sum of sample amounts of various types of data in the data distribution information; the similarity of the data distribution and the total data distribution information being a ratio of a number of categories included in the terminal to a number of categories in the total data distribution information, and a ratio of a sample number of each category in the terminal to a sample number of a corresponding category in the total data distribution information; receiving model parameters, the model parameters being obtained by training a training data set selected by the server based on the data distribution information; training the model parameters to obtain a training result; sending the training result, the training result being used to globally update the model parameters to obtain global model parameters.
12. The method of claim 11, wherein, sending data distribution information of a terminal, including: sending the data distribution information through RRC signaling.
13. The method of claim 11, wherein, The model parameters include initialization model parameters, and receiving model parameters include: receiving the initialization model parameters, the initialization model parameters being obtained by training a training data set selected by the server based on the data distribution information; Or, the model parameters include intermediate model parameters, and receiving model parameters include: receiving the intermediate model parameters, the intermediate model parameters being obtained by iteratively updating the initialization model parameters.
14. The method of claim 13, wherein, The training result includes a gradient value, the gradient value being obtained by testing the model parameters after training. Or, the training result includes model update parameters, the model update parameters being obtained by training the model parameters.
15. The method of claim 14, wherein, When the training result includes the model update parameters, sending the training result, including: determining data transmission parameters based on a data amount of the model update parameters and a communication condition of the terminal; sending the model update parameters to the server according to the data transmission parameters.
16. The method according to any one of claims 11 to 15, characterized in that, The method further includes: receiving global model parameters; adaptively updating the global model parameters.
17. A model training apparatus, comprising: The apparatus includes: a receiving module configured to receive data distribution information of multiple terminals, the data distribution information including categories of data and sample numbers of various categories; a selecting module configured to select a training data set meeting the data distribution information of the multiple terminals; a model training module configured to train a model based on the training data set to obtain model parameters; The receiving module is further configured to receive user scheduling information of each terminal in the plurality of terminals; the user scheduling information comprises at least one of the following parameters: a data amount of data in the terminal, a similarity of data distribution and total data distribution information, a communication condition, a computing capability, and a learning model performance requirement, the total data distribution information being obtained by merging data distribution information of the plurality of terminals; the data amount of data in the terminal being a sum of sample amounts of various types of data in the data distribution information; and the similarity of data distribution and total data distribution information being a ratio of a number of categories included in the terminal to a number of categories in the total data distribution information, and a ratio of a sample number of each category in the terminal to a sample number of a corresponding category in the total data distribution information; The determining module is configured to determine, based on the user scheduling information of each terminal in the plurality of terminals, whether each terminal in the plurality of terminals meets a distributed training requirement; The sending module is configured to send the model parameter to the terminals in the plurality of terminals that meet the distributed training requirement; The receiving module is further configured to receive a training result obtained by training the model parameter by at least part of the terminals; The model training module is further configured to update the model parameter based on the training result of the at least part of the terminals, to obtain a global model parameter.
18. The apparatus of claim 17, wherein, The receiving module is configured to receive the data distribution information transmitted by each terminal in the plurality of terminals through RRC signaling.
19. The apparatus of claim 17, wherein, The selecting module is configured to merge the data distribution information of the plurality of terminals to obtain total data distribution information; and select data that meets the total data distribution information from local data of a server to obtain the training data set.
20. The apparatus of claim 17, wherein, The model parameter comprises an initial model parameter, and the model training module is configured to perform model training by using the training data set to obtain the initial model parameter. Alternatively, the model parameter comprises an intermediate model parameter, and the model training module is configured to perform model training by using the training data set to obtain an initial model parameter, and iteratively update the initial model parameter to obtain the intermediate model parameter.
21. The apparatus of claim 17, wherein, The determining module is further configured to determine a data transmission parameter based on a data amount of the model parameter and a communication condition of the terminals that meet the distributed training requirement. The sending module is configured to send the model parameter to the terminals that meet the distributed training requirement according to the data transmission parameter.
22. The apparatus of any one of claims 17 to 21, wherein, The training result comprises a gradient value, which is a gradient value obtained by testing the model parameter after training by the terminal; Alternatively, the training result comprises a model update parameter, which is a model parameter obtained by training the model parameter by the terminal.
23. The apparatus of claim 22, wherein, When the training result of each terminal in the at least part of the terminals comprises a gradient value, The model training module is configured to iteratively update the model parameter by using a gradient descent method based on an average value of the gradient values of the at least part of the terminals, to obtain a global model parameter.
24. The apparatus of claim 22, wherein, When the training result of at least one terminal of the at least part of terminals comprises model update parameters, The selecting module is configured to select a query set conforming to the data distribution information of the first terminal, the first terminal being a terminal whose training result comprises model update parameters; The model training module is configured to test the model update parameters of the first terminal based on the query set to obtain gradient values, and iteratively update the model parameters using a gradient descent method based on the average of the gradient values of the at least part of terminals to obtain global model parameters.
25. The apparatus of claim 23 or 24, wherein, The model training module is configured to iteratively update the model parameters using a gradient descent method based on the average of the first gradient values of the at least part of terminals, determine whether the average of the first gradient values of the at least part of terminals is within a threshold range, and in response to the average of the first gradient values of the at least part of terminals not being within the threshold range, send the intermediate model parameters after the iterative update of the model parameters to the at least part of terminals. The average of the second gradient values of the at least part of terminals is used to iteratively update the intermediate model parameters, wherein the second gradient values are gradient values obtained by testing the intermediate model parameters after the training of the intermediate model parameters by the terminals.
26. The apparatus of claim 25, wherein, The sending module is further configured to, in response to the average of the first gradient values of the at least part of terminals being within the threshold range, send the global model parameters after the iterative update of the model parameters to the at least part of terminals, the global model parameters being used for adaptive update by the terminals.
27. A model training apparatus, comprising: The apparatus comprises: The sending module is configured to send data distribution information of a terminal, the data distribution information comprising categories of data and sample numbers of each category; The sending module is further configured to send user scheduling information, the user scheduling information comprising at least one of the following parameters: data amount of data in a terminal, similarity of data distribution to total data distribution information, communication condition, computing capability, and learning model performance requirement, the total data distribution information being obtained by merging data distribution information of multiple terminals; the user scheduling information being used to determine whether the terminal meets distributed training requirements; the data amount of data in the terminal being a sum of sample amounts of each category of data in the data distribution information; the similarity of the data distribution to the total data distribution information being a ratio of a number of categories included in the terminal to a number of categories in the total data distribution information, and a ratio of a sample number of each category in the terminal to a sample number of a corresponding category in the total data distribution information; The receiving module is configured to receive model parameters, the model parameters being obtained by training a training data set selected by a server based on the data distribution information; The model training module is configured to train the model parameters to obtain a training result; The sending module is further configured to send the training result, the training result being used to globally update the model parameters to obtain global model parameters.
28. The apparatus of claim 27, wherein, The sending module is configured to send the data distribution information through RRC signaling.
29. The apparatus of claim 27, wherein, The model parameters include initial model parameters, and the receiving module is configured to receive the initial model parameters, which are obtained by training a training data set selected by the server using the data distribution information. Alternatively, the model parameters include intermediate model parameters, and the receiving module is configured to receive the intermediate model parameters, which are obtained by iteratively updating the initial model parameters by the server.
30. The apparatus of claim 29, wherein, The training result includes a gradient value, which is obtained by testing the trained model parameters. Alternatively, the training result includes model update parameters, which are obtained by training the model parameters.
31. The apparatus of claim 30, wherein, When the training result includes the model update parameters, The apparatus further includes a determining module configured to determine data transmission parameters based on a data amount of the model update parameters and a communication condition of the terminal. The sending module is configured to send the model update parameters to the server according to the data transmission parameters.
32. The apparatus of any one of claims 27-31, wherein, The receiving module is further configured to receive global model parameters. The model training module is further configured to adaptively update the global model parameters.
33. A server, comprising: The server includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to load and execute the executable instructions to implement the model training method of any one of claims 1 to 10.
34. A terminal, characterized by The terminal includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to load and execute the executable instructions to implement the model training method of any one of claims 11 to 16.
35. A computer readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor, the model training method of any one of claims 1 to 10 can be executed, or the model training method of any one of claims 11 to 16 can be executed.
Citation Information
Patent Citations
A gradient updating method in distributed training and related equipment
CN109102075A
Federated deep learning method capable of adaptively protecting privacy
CN110443063A
Image training method and system based on distributed learning, medium and intelligent equipment
CN110956202A
Federated learning information processing method and system, storage medium, program and terminal
CN111611610A