Language model training method and device, storage medium and product

By utilizing the communication connection between the first device and the second device in the field of biomedical natural language processing, local training of language models and model aggregation of meme algorithms is solved, how to improve the model under the conditions of protecting data privacy is solved. The problem of training efficiency achieves efficient language model training.

CN119494385APending Publication Date: 2025-02-21WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411285832.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

How to improve the efficiency of language model training in the field of biomedical natural language processing under the conditions of protecting the data privacy of data owners.

Method used

By deploying the language model to be trained on the first device and communicating with each second device, the second device receives the language model and trains with local private data to generate a proxy model. Then, the first device performs model aggregation based on the meme algorithm and the proxy model to obtain the aggregated model, and repeats this process until the preset training end condition is met.

Benefits of technology

While protecting data privacy, it improves the efficiency of language model training, and realizes efficient aggregation of proxy models through meme algorithms, reducing the computational cost during model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494385A_ABST
    Figure CN119494385A_ABST
Patent Text Reader

Abstract

The invention discloses a language model training method and device, a storage medium and a product, and relates to the technical field of natural language processing, and the method comprises the steps: sending a language model to each second device, so that each second device employs corresponding local private data to train the language model, obtaining an agent model corresponding to each second device; the proxy models sent by the second devices are received, model aggregation is carried out on the basis of a memetic algorithm and the proxy models, an aggregation model is obtained, and the aggregation model is determined as a new language model; iteration is carried out in this way until a preset training ending condition is met, and a trained language model is obtained. Therefore, the model training efficiency can be improved under the condition of protecting the data privacy of the data owner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a language model training method, device, storage medium and product. Background Art

[0002] With the development of language representation models in the field of natural language processing, more and more researchers are trying to apply these large models to BioNLP (Biomedical Natural Language Processing). However, with the growing demand for privacy protection and the introduction of the General Data Protection Regulation, it has become increasingly difficult to collect biomedical data. As a solution, federated learning has been emerging in recent years. In the federated learning framework, data owners do not need to share private data, which greatly reduces the risk of privacy exposure.

[0003] Currently, many researchers have tried to apply federated learning to the field of biomedical natural language processing. However, most of the existing related technologies only use simple models, such as SVM (Support Vector Machine), logistic regression or some simple neural network models, resulting in low model training efficiency.

[0004] Therefore, how to improve the efficiency of model training while protecting the data privacy of data owners is a problem that needs to be solved urgently.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The main purpose of this application is to provide a language model training method, device, storage medium and computer program product, aiming to solve the technical problem of how to improve the efficiency of model training while protecting the data privacy of the data owner.

[0007] To achieve the above object, the present application proposes a language model training method, wherein the first device is communicated with each second device respectively, and the first device deploys a language model to be trained, and the method includes:

[0008] Sending the language model to each of the second devices respectively, so that each of the second devices uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each of the second devices;

[0009] receiving the proxy models respectively sent by the second devices, performing model aggregation based on the meme algorithm and the proxy models to obtain an aggregated model, and determining the aggregated model as a new language model;

[0010] Return to the step of sending the language model to each second device respectively so that each second device uses the corresponding local private data to train the language model, and obtain the proxy model corresponding to each second device, until the preset training end condition is met to obtain the trained language model.

[0011] Optionally, the step of performing model aggregation based on the meme algorithm and each of the proxy models to obtain an aggregated model includes:

[0012] Based on the memetic algorithm and each of the proxy models, determining a plurality of parent models;

[0013] Based on the memetic algorithm, a genetic operation is performed on the plurality of parent models to obtain a plurality of child models;

[0014] Determining the plurality of offspring models as a plurality of new parent models;

[0015] Return to the step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models, until a preset genetic stop condition is met to obtain the aggregate model.

[0016] Optionally, the step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models comprises:

[0017] Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models;

[0018] The model parameters corresponding to the plurality of parent models are copied to obtain the child model parameters, so as to construct the plurality of child models based on the child model parameters.

[0019] Optionally, the step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models comprises:

[0020] Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models;

[0021] Based on the preset number of crossover model layers and the model parameters corresponding to the plurality of parent models, arithmetic crossover is performed to obtain offspring model parameters, so as to construct the plurality of offspring models based on the offspring model parameters.

[0022] Optionally, the step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models comprises:

[0023] Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models;

[0024] A linear transformation is performed based on the model parameters corresponding to each of the plurality of parent models to obtain child model parameters, so as to construct the plurality of child models based on the child model parameters.

[0025] In addition, to achieve the above-mentioned purpose, the present application proposes another language model training method, which is applied to any one of a plurality of second devices, each of which is respectively connected to a first device for communication, and the first device deploys a language model to be trained, and the method includes:

[0026] Receiving the language model sent by the first device, and training the language model using corresponding local private data to obtain a corresponding proxy model;

[0027] Sending the proxy model to the second device, so that the first device performs model aggregation based on the meme algorithm and each of the proxy models to obtain an aggregated model, and using the aggregated model as a new language model;

[0028] Return to the step of receiving the language model sent by the first device, training the language model with corresponding local private data, and obtaining a corresponding proxy model, until a preset training end condition is met, so that the first device can obtain the trained language model.

[0029] Optionally, the step of receiving the language model sent by the first device, and training the language model using corresponding local private data to obtain a corresponding proxy model includes:

[0030] Receiving the language model sent by the first device, and locally training the language model using corresponding local private data to obtain a plurality of local models;

[0031] Based on the model effects of each of the several local models, a local search is performed to obtain a target local model with the best model effect, and the target local model is determined as the proxy model.

[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a language model training device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the language model training method described above.

[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the language model training method described above are implemented.

[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the language model training method described above.

[0035] One or more technical solutions proposed in this application have at least the following technical effects:

[0036] By deploying a language model to be trained on the first device, the first device is respectively connected to each second device in communication, the second device receives the language model sent by the first device, and uses local private data to train the language model respectively, and sends the trained language model to the first device for model aggregation, thereby protecting the data privacy of the second device during the model training process; wherein, in each round of training, the language model is sent to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, and each second device needs to select a proxy model from multiple language models trained with local private data to reduce the computational cost during model training; then, the first device receives the proxy model sent by each second device respectively, and performs model aggregation based on the meme algorithm and each proxy model to obtain an aggregate model, and determines the aggregate model as a new language model; return to execute the step of sending the language model to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, until the preset training end condition is met, and the trained language model is obtained. In each round of iteration of federated learning, this embodiment realizes the aggregation of various proxy models through the memetic algorithm, which can improve the efficiency of model training while protecting the data privacy of the data owner. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0039] Figure 1 A flowchart of the first embodiment of the language model training method of the present application is provided;

[0040] Figure 2 A schematic diagram of the system framework of the language model training method provided in Example 1 of the present application;

[0041] Figure 3 A flow chart of the second embodiment of the language model training method of the present application;

[0042] Figure 4 This is a schematic diagram of the device structure of the hardware operating environment involved in the language model training method in the embodiment of the present application.

[0043] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0044] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0045] The first embodiment of the language model training method of the present application is proposed below. It should be noted that the execution subject of this embodiment can be a computing service device with language model training, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a language model training system, etc. The following takes the language model training system as an example to illustrate this embodiment and the following embodiments.

[0046] Currently, with the breakthrough of language representation models in the field of natural language processing, more and more researchers are trying to apply these large models to biomedical natural language processing. However, with the growing demand for privacy protection and the introduction of the General Data Protection Regulation, it has become increasingly difficult to collect biomedical data. Biomedical data are usually scattered among different medical institutions, which are reluctant to share data at the risk of exposing privacy.

[0047] In response to the above technical pain points, industry insiders proposed federated learning as a solution. In the federated learning framework, data owners do not need to share private data. Instead, each data owner trains a model locally and uploads the parameters of the local model to the central server for model aggregation. The aggregated model is then sent back to the data owner, who uses the local data again to further fine-tune the model. By repeating this process, the model will eventually converge after several rounds of training and aggregation.

[0048] In related technologies, many researchers have tried to apply federated learning to the field of biomedical natural language processing. However, most of these methods only use simple models, such as SVM, logistic regression, or some simple neural network models. A few works apply federated learning to train large models, but they are only based on existing technologies and the training efficiency is not high.

[0049] Based on this, the present application proposes a language model training method, by deploying the language model to be trained on the first device, the first device is communicated with each second device respectively, the second device receives the language model sent by the first device, and uses local private data to train the language model respectively, and sends the trained language model to the first device for model aggregation, thereby protecting the data privacy of the second device during the model training process; at the same time, in each round of iteration of federated learning, the aggregation of each proxy model is realized through the memetic algorithm, which can improve the model training efficiency while protecting the data privacy of the data owner.

[0050] Reference Figure 1 , Figure 1 This is a flow chart of the first embodiment of the language model training method of this application. Figure 1 As shown, in this embodiment, the language model training method is applied to a first device, the first device is communicated with each second device respectively, and the first device deploys a language model to be trained; the language model training method includes steps S10 to S30:

[0051] Step S10, sending the language model to each of the second devices respectively, so that each of the second devices uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each of the second devices;

[0052] The language model training method proposed in this embodiment is applied to the scenario of applying federated learning to the field of biomedical natural language processing. The amount of data in the biomedical field is huge and highly sensitive, including a large amount of patient information, clinical trial data, gene sequences, etc. These data are crucial to advancing medical research, drug development, and personalized treatment. However, due to data privacy and regulatory restrictions, traditional centralized data sharing and model training methods face many challenges. Federated learning provides a solution that can achieve cross-institutional or cross-regional model training while protecting data privacy.

[0053] The model to be trained refers to the model parameters in the model that need to be optimized through the training process, and its initial model parameters can be obtained after model pre-training (or the pre-trained model can be used as the model to be trained), or, its initial model parameters can also be initialized according to experience or randomly initialized. The process of using a pre-trained model as the model to be trained and training the model to be trained on a specific natural language processing task is also called "fine-tuning", and "training" is used to represent this process in the following embodiments. In a specific implementation, a pre-trained language model is used as the language model to be trained, and the language model to be trained is further trained, which can obtain better training results and enable the trained language model to have stronger natural language processing capabilities. In this embodiment, it is not limited to using a pre-trained language model as the language model to be trained, nor is it limited to specific pre-training means.

[0054] Reference Figure 2 , Figure 2 Schematic diagram of the system framework of the language model training method of this embodiment; Figure 2 As shown, in this embodiment, the language model training system is composed of a central server and data participants, private data is distributed among N data participants, and a central server is responsible for model exchange with all data participants. As with the typical federated learning method, these N data participants are responsible for training local models. The central server is responsible for collecting, aggregating and distributing models. Specifically, the first device in this step can be the device terminal where the central server is located, and the second device can be the device terminal where each data participant is located, that is, multiple computing nodes or devices on the user side participating in the distributed training process, each of which has unique local private data, and these data are data sets that are not disclosed or only available on the device. The language model is a pre-trained model for understanding, generating or processing natural language text. The purpose of this step is to distribute the initial or existing language model to each second device so that they can use their respective local private data for customized training to generate "proxy models" for their respective data characteristics.

[0055] One of the ways for the first device to send the language model to each second device may be broadcasting. In a distributed system or network communication, broadcasting is a communication method that sends information to all devices in the network. In this scenario, the first device sends data packets of the language model to the network and marks these data packets as broadcast packets. Each second device in the network receives these broadcast packets and checks the destination address or type of the data packets. If the data packet is a broadcast packet for all devices, each second device receives and processes the language model information in these data packets. Using broadcasting to send language models can simplify the communication protocol; within the broadcast domain, the data packet only needs to be sent once to be received by all devices, without the need to establish a connection or send a data packet for each second device separately, reducing the redundancy of data transmission and the cost of model training.

[0056] It should be noted that after the second device of each data participant receives the language model of the first device, it may use local private data to perform local training on different clients corresponding to the second device, thereby obtaining multiple local models. In this way, this embodiment evaluates the model effect in multiple local models corresponding to each second device, thereby selecting the local model with the best model effect as the proxy model of each second device, so as to better characterize the data characteristics of the corresponding data participants and improve the training efficiency of the federated learning model.

[0057] Step S20, receiving the proxy models respectively sent by each of the second devices, and performing model aggregation based on the meme algorithm and each of the proxy models to obtain an aggregated model, and determining the aggregated model as a new language model;

[0058] It should be noted that the meme algorithm is a hybrid heuristic algorithm that combines the local search algorithm and the global search algorithm. By combining the advantages of global search and local search, the meme algorithm can perform well in complex optimization problems, especially when dealing with large-scale, multimodal optimization problems. In this embodiment, the meme algorithm can extract useful information from multiple proxy models and integrate them into a better aggregate model. This step obtains an aggregate model through model aggregation, combines the advantages of each proxy model, and reduces the differences between them to obtain a more generalized and robust language model.

[0059] In addition, based on the aggregation idea of ​​federated learning, this embodiment can also fuse the information of multiple local models into the global model through weighted averaging, knowledge distillation or more complex model fusion technology, so as to utilize the training results of each device to improve the performance of the overall model without directly sharing the original data.

[0060] For example, in the model aggregation stage, the central server collects proxy models uploaded by various data owners, and uses the meme algorithm to perform weighted average processing on the model parameters to obtain a new language model. This model not only integrates the data characteristics of each center, but also reduces the differences between different proxy models, improving the response speed and accuracy of the system.

[0061] If the preset training end condition is met, step S30 is executed: obtaining a trained language model.

[0062] If the preset training end condition is not met, return to step S10 and send the language model to each of the second devices respectively, so that each of the second devices can use the corresponding local private data to train the language model to obtain the proxy model corresponding to each of the second devices.

[0063] After aggregating the proxy models sent by the data owner, the first device obtains an aggregate model, and uses the aggregate model as a new language model in the next iteration process, so that the new language model is sent to each data owner for retraining in the next iteration process. At the same time, steps S10 and S20 are repeated until the preset training end condition is met. This iterative training mechanism aims to gradually optimize the performance of the language model through multiple cycles of training until a satisfactory training effect is achieved.

[0064] It should be noted that the preset training end condition is a condition that needs to be met to end the training, which can be set as needed, and is not limited in this embodiment. For example, in a specific implementation, it can be set to the convergence of the loss function of the language model, or the number of training rounds reaches a set number of rounds, or the duration of training reaches a set duration, etc.

[0065] In this implementation mode, by deploying a language model to be trained on the first device, the first device is respectively connected to each second device in communication, the second device receives the language model sent by the first device, and uses local private data to train the language model respectively, and sends the trained language model to the first device for model aggregation, thereby protecting the data privacy of the second device during the model training process; wherein, in each round of training, the language model is sent to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, and each second device needs to select a proxy model from multiple language models trained with local private data to reduce the computational cost during model training; then, the first device receives the proxy model sent by each second device respectively, and performs model aggregation based on the meme algorithm and each proxy model to obtain an aggregate model, and determines the aggregate model as a new language model; return to execute the step of sending the language model to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, until the preset training end condition is met, and the trained language model is obtained. In each round of iteration of federated learning, this embodiment realizes the aggregation of various proxy models through the memetic algorithm, which can improve the efficiency of model training while protecting the data privacy of the data owner.

[0066] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 3 , Figure 3 This is a flow chart of the second embodiment of the language model training method of this application; Figure 3 As shown, the step of performing model aggregation based on the meme algorithm and each of the proxy models to obtain an aggregated model includes steps A1 to A3:

[0067] Step A1, determining a plurality of parent models based on the meme algorithm and each of the proxy models;

[0068] In this embodiment, the meme algorithm is a heuristic search and optimization algorithm that optimizes problem solutions through replication, mutation and selection. This step uses the characteristics of the meme algorithm to determine the parent model from each proxy model uploaded by the second device, providing a basis for subsequent genetic operations.

[0069] It should be noted that memetic algorithms can search for optimal solutions or approximate optimal solutions in the solution space by simulating evolutionary processes in nature (such as inheritance, mutation, and selection), thereby screening out parent models that can produce high-quality offspring models in subsequent genetic processes, thereby accelerating convergence to the global optimal solution or local optimal solution.

[0070] Specifically, first, several parent models are selected from all proxy models according to the initialization strategy in the memetic algorithm, such as random selection, screening based on specific criteria (such as model performance evaluation), etc. These parent models need to cover different areas of the solution space as much as possible to improve the diversity and comprehensiveness of the search.

[0071] Step A2, performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models;

[0072] It should be noted that genetic operations are the core link in the memetic algorithm, including operations such as crossover and mutation, which are intended to generate new solutions (i.e., offspring models) by simulating gene recombination and mutation in biological evolution. This embodiment is based on the memetic algorithm, uses the advantageous information of the parent model, and combines randomness to create an offspring model that may be superior to the parent model in performance.

[0073] For each parent model, a crossover genetic operation is performed according to its structure or parameters to combine the advantageous features of different parent models; at the same time, a mutation genetic operation is performed on some parent models to introduce new mutation features to increase the explorability of the solution space.

[0074] Specifically, the manner in which the genetic operation is performed on the plurality of parent models in this embodiment may include:

[0075] Single-point crossover: select a part of the parent model to exchange, which is simple and direct;

[0076] Multi-point crossover: exchange at multiple points to increase the diversity of offspring models;

[0077] Uniform mutation: Randomly change some parameter values ​​in the parent model to enhance the randomness of the search;

[0078] Non-uniform mutation: Mutate parameter values ​​according to a certain probability distribution (such as Gaussian distribution) to adjust the model more finely.

[0079] Step A3, determining the plurality of child models as a plurality of new parent models;

[0080] This embodiment iterates the genetic operation to continuously generate new offspring models and replace them with new parent models, gradually approaching the optimal solution.

[0081] If the preset genetic stopping condition is met, step A4 is executed to obtain the aggregation model.

[0082] If the preset genetic stopping condition is not met, return to step A2, perform genetic operations on the plurality of parent models based on the meme algorithm, and obtain a plurality of offspring models.

[0083] It should be noted that this embodiment improves the fitness and generalization ability of the model through multiple rounds of genetic evolution, and finally obtains an aggregate model that integrates the advantages of all parent and child models.

[0084] In addition, it should be noted that this embodiment needs to set appropriate genetic stopping conditions (such as reaching the maximum number of iterations, model performance improvement is no longer significant, etc.) to avoid overfitting and waste of computing resources. At the same time, in order to reduce the computing cost of model training, in each round of iteration, the performance of the offspring model is evaluated, and the best performing model is selected as the parent model of the new round to continue the genetic operation.

[0085] The preset genetic stop condition is a pre-set condition that needs to be met to end the training, which can be set as needed and is not limited in this embodiment. For example, the genetic stop condition can be set based on the following parameters:

[0086] Fixed number of iterations: The appropriate number of iterations needs to be adjusted according to the specific problem;

[0087] Performance improvement threshold: When the model performance improvement in multiple consecutive iterations is less than the preset threshold, the process stops. This is more flexible and efficient.

[0088] Combined conditions: Combining a fixed number of iterations with a performance improvement threshold ensures neither excessive iterations nor early termination.

[0089] For example, when setting the genetic stopping condition, the maximum number of iterations is set to 100 rounds, and the performance improvement threshold is set to 0.5% (ie, the method stops when the average performance improvement in 5 consecutive iterations is less than 0.5%).

[0090] In a feasible implementation manner, the performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models, step A2 may include:

[0091] Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models;

[0092] The model parameters corresponding to the respective parent models are copied to obtain child model parameters, so as to construct the plurality of child models based on the child model parameters.

[0093] It should be noted that in the memetic algorithm, the copy operation is the basic step to generate a new solution (i.e., the offspring model), that is, the offspring is initialized by copying the excellent characteristics (model parameters) of the parent individual, thus ensuring the heritability and stability of the algorithm.

[0094] For example, the parameters of each parent model are directly or slightly mutated and copied to the corresponding child model. Then, a new model instance is constructed based on these child model parameters, ready for subsequent evaluation and optimization.

[0095] In another feasible implementation, the performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models, step A2 may include:

[0096] Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models;

[0097] Based on the preset number of crossover model layers and the model parameters corresponding to the plurality of parent models, arithmetic crossover is performed to obtain offspring model parameters, so as to construct the plurality of offspring models based on the offspring model parameters.

[0098] It should be noted that arithmetic crossover is a method of combining the parameters of two parent models through arithmetic operations (such as weighted average) to generate the parameters of the child model. In this step, arithmetic crossover is performed on the selected parent model parameters according to the preset number of crossover model layers.

[0099] For example, if the first N layers are selected for crossover, then for the model parameters of the first N layers, the corresponding parameters of the two parent models can be weighted averaged in a certain proportion to obtain the first N layers of the child model parameters.

[0100] In another feasible implementation, the performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models, step A2 may include:

[0101] Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models;

[0102] A linear transformation is performed based on the model parameters corresponding to each of the plurality of parent models to obtain child model parameters, so as to construct the plurality of child models based on the child model parameters.

[0103] It should be noted that in the memetic algorithm, one way to generate a child model is to perform some form of transformation on the parameters of the parent model. The parameters of the selected parent model are linearly combined. For example, if there are two parent models A and B, their parameters are θ A and θ B , then the parameter θ of the offspring modelchild It can be obtained by linear interpolation, such as: θ child =αθ A +(1-α)θ B . Wherein, α is a random number between 0 and 1 or a weight selected according to a certain strategy, and the strategy can be set according to business requirements, which is not limited in this embodiment.

[0104] In this implementation mode, by deploying a language model to be trained on the first device, the first device is respectively connected to each second device in communication, the second device receives the language model sent by the first device, and uses local private data to train the language model respectively, and sends the trained language model to the first device for model aggregation, thereby protecting the data privacy of the second device during the model training process; wherein, in each round of training, the language model is sent to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, and each second device needs to select a proxy model from multiple language models trained with local private data to reduce the computational cost during model training; then, the first device receives the proxy model sent by each second device respectively, and performs model aggregation based on the meme algorithm and each proxy model to obtain an aggregate model, and determines the aggregate model as a new language model; return to execute the step of sending the language model to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, until the preset training end condition is met, and the trained language model is obtained. In each round of iteration of federated learning, this embodiment realizes the aggregation of various proxy models through the memetic algorithm, which can improve the efficiency of model training while protecting the data privacy of the data owner.

[0105] Based on the first and second embodiments of the present application, a third embodiment of the language model training method of the present application is proposed. In the third embodiment of the present application, the same or similar contents as those of the above-mentioned embodiments one and two can be referred to the above introduction, and will not be repeated later. On this basis, the language model training method in this embodiment is applied to any one of a plurality of second devices, that is, the execution subject is any second device, and each of the second devices is respectively connected to the first device in communication, and the method described includes steps M10 to M30:

[0106] Step M10, receiving the language model sent by the first device, and training the language model using corresponding local private data to obtain a corresponding proxy model;

[0107] Step M20, sending the proxy model to the second device, so that the first device performs model aggregation based on the meme algorithm and each of the proxy models to obtain an aggregated model, and uses the aggregated model as a new language model;

[0108] Step M30, returns to the step of receiving the language model sent by the first device, training the language model with the corresponding local private data, and obtaining the corresponding proxy model, until the preset training end condition is met, so that the first device can obtain the trained language model.

[0109] The specific implementation of the above steps M10 to M30 can refer to the specific implementation of the above steps S10 to S30 in the first embodiment, and the effects achieved can also refer to the above first embodiment, which will not be described in detail here.

[0110] In a feasible implementation manner, the step of receiving the language model sent by the first device, and training the language model using corresponding local private data to obtain a corresponding proxy model includes:

[0111] Step M101, receiving the language model sent by the first device, and locally training the language model using corresponding local private data to obtain a plurality of local models;

[0112] Step M102: Perform a local search based on the model effects of each of the plurality of local models to obtain a target local model with the best model effect, and determine the target local model as the proxy model.

[0113] Specifically, by receiving a pre-trained language model sent by a remote or cloud-based first device, the model already has certain language processing capabilities for specific tasks in related fields (such as multi-label classification tasks in the biomedical field). Subsequently, the received language model is locally trained using a local private, field-specific or scenario-specific data set, which is a fine-tuning process. This process aims to make the model better adapt to local data characteristics and improve its performance on specific tasks. Through local training, the model can learn more details about the distribution of local data, thereby generating a local model for specific needs.

[0114] It should be noted that local private data refers to data sets that are stored in local devices, are not public, and are unique, such as internal enterprise documents, user conversation records, etc. For example, for a medical enterprise, local private data can be data in the cancer Hall Mark (HoC) corpus.

[0115] In addition, it should be noted that when the second device performs local training on the received language model, it can use supervised learning or unsupervised learning algorithms, such as gradient descent, to iteratively train the model on local computing resources and adjust model parameters to minimize the loss function.

[0116] In this implementation mode, by deploying a language model to be trained on the first device, the first device is respectively connected to each second device in communication, the second device receives the language model sent by the first device, and uses local private data to train the language model respectively, and sends the trained language model to the first device for model aggregation, thereby protecting the data privacy of the second device during the model training process; wherein, in each round of training, the language model is sent to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, and each second device needs to select a proxy model from multiple language models trained with local private data to reduce the computational cost during model training; then, the first device receives the proxy model sent by each second device respectively, and performs model aggregation based on the meme algorithm and each proxy model to obtain an aggregate model, and determines the aggregate model as a new language model; return to execute the step of sending the language model to each second device respectively, so that each second device uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each second device, until the preset training end condition is met, and the trained language model is obtained. In each round of iteration of federated learning, this embodiment realizes the aggregation of various proxy models through the memetic algorithm, which can improve the efficiency of model training while protecting the data privacy of the data owner.

[0117] The present application provides a language model training device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the language model training method in the above-mentioned embodiment 1.

[0118] Reference below Figure 4, which shows a schematic diagram of the structure of a language model training device suitable for implementing the embodiment of the present application. The language model training device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The language model training device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0119] like Figure 4 As shown, the language model training device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the language model training device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the language model training device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a language model training device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.

[0120] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0121] The language model training device provided by the present application adopts the language model training method in the above embodiment, which can solve the technical problem of how to improve the efficiency of model training while protecting the data privacy of the data owner. Compared with the prior art, the beneficial effects of the language model training device provided by the present application are the same as the beneficial effects of the language model training method provided by the above embodiment, and the other technical features in the language model training device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0122] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0123] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0124] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the language model training method in the above-mentioned embodiment.

[0125] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0126] The computer-readable storage medium may be included in the language model training device; or may exist independently without being assembled into the language model training device.

[0127] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the language model training device, the language model training device executes the solutions in the above embodiments.

[0128] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0129] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0130] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0131] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned language model training method, and can solve the technical problem of how to improve the efficiency of model training while protecting the data privacy of the data owner. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the language model training method provided in the above-mentioned embodiment, and will not be repeated here.

[0132] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned language model training method when executed by a processor.

[0133] The computer program product provided by this application can solve the technical problem of how to improve the efficiency of model training while protecting the data privacy of the data owner. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the language model training method provided by the above embodiment, which will not be repeated here.

[0134] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A language model training method, characterized in that: Applied to a first device, the first device is communicatively connected with each second device respectively, the first device deploys a language model to be trained, and the method includes: Sending the language model to each of the second devices respectively, so that each of the second devices uses the corresponding local private data to train the language model, and obtains a proxy model corresponding to each of the second devices; receiving the proxy models respectively sent by the second devices, performing model aggregation based on the meme algorithm and the proxy models to obtain an aggregated model, and determining the aggregated model as a new language model; Return to the step of sending the language model to each second device respectively so that each second device uses the corresponding local private data to train the language model, and obtain the proxy model corresponding to each second device, until the preset training end condition is met to obtain the trained language model.

2. The method according to claim 1, characterized in that The step of performing model aggregation based on the meme algorithm and each of the proxy models to obtain an aggregated model comprises: Based on the memetic algorithm and each of the proxy models, determining a plurality of parent models; Based on the memetic algorithm, a genetic operation is performed on the plurality of parent models to obtain a plurality of child models; Determining the plurality of offspring models as a plurality of new parent models; Return to the step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models, until a preset genetic stop condition is met to obtain the aggregate model.

3. The method according to claim 2, characterized in that The step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models comprises: Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models; The model parameters corresponding to the plurality of parent models are copied to obtain the child model parameters, so as to construct the plurality of child models based on the child model parameters.

4. The method according to claim 2, characterized in that The step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models comprises: Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models; Based on the preset number of crossover model layers and the model parameters corresponding to the plurality of parent models, arithmetic crossover is performed to obtain offspring model parameters, so as to construct the plurality of offspring models based on the offspring model parameters.

5. The method according to claim 2, characterized in that The step of performing genetic operations on the plurality of parent models based on the meme algorithm to obtain a plurality of child models comprises: Based on the meme algorithm, obtaining model parameters corresponding to each of the plurality of parent models; A linear transformation is performed based on the model parameters corresponding to each of the plurality of parent models to obtain child model parameters, so as to construct the plurality of child models based on the child model parameters.

6. A language model training method, characterized in that: Applied to any one of a plurality of second devices, each of the second devices is respectively connected to a first device for communication, and the first device deploys a language model to be trained, the method comprising: Receiving the language model sent by the first device, and training the language model using corresponding local private data to obtain a corresponding proxy model; Sending the proxy model to the second device, so that the first device performs model aggregation based on the meme algorithm and each of the proxy models to obtain an aggregated model, and using the aggregated model as a new language model; Return to the step of receiving the language model sent by the first device, training the language model with corresponding local private data, and obtaining a corresponding proxy model, until a preset training end condition is met, so that the first device can obtain the trained language model.

7. The method according to claim 6, characterized in that The step of receiving the language model sent by the first device and training the language model using corresponding local private data to obtain a corresponding proxy model includes: Receiving the language model sent by the first device, and locally training the language model using corresponding local private data to obtain a plurality of local models; Based on the model effects of each of the several local models, a local search is performed to obtain a target local model with the best model effect, and the target local model is determined as the proxy model.

8. A language model training device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the language model training method according to any one of claims 1 to 7.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the language model training method according to any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the language model training method according to any one of claims 1 to 7 are implemented.