Model training method, device and blockchain based on blockchain and federated learning
Through methods based on blockchain and federated learning, the problem of balancing information security and personalized needs in speech recognition technology is solved, and personalized speech recognition models can be trained and deployed without leaking user privacy, improving the model's performance. Accuracy and user experience.
Patent Information
- Application Number
- CN202111507818.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-10
AI Technical Summary
It is difficult for existing speech recognition technology to take into account information security and personalization needs during the model training process. Capturing data directly from the user's local data set may violate privacy, and the model trained by federated learning cannot meet the personalized needs of each device.
A model training method based on blockchain and federated learning is used to generate a global initial model through aggregation nodes. Each training node trains based on local voice data and uploads model parameters. The aggregation node aggregates and performs secondary training after meeting the preset iteration conditions. and deployment to ensure data privacy and personalization needs.
It achieves the training and deployment of personalized global speech recognition models without leaking user privacy data, improves the accuracy of model training and user experience, and meets the personalized needs of each device.
Smart Images

Figure CN114372507B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and specifically to a model training method, device and blockchain based on blockchain and federated learning. Background Art
[0002] The key of speech recognition technology is to convert the vocabulary content in human speech into computer-readable input form. The long-term development of speech recognition technology cannot be separated from the support of speech data.
[0003] At present, there are many public speech data sets. However, as the times progress and people's thinking changes, new words will always be created, and some old words will also derive new meanings. Therefore, a large amount of fresh speech data is needed to continuously support the development of speech recognition technology.
[0004] When collecting and updating voice data, directly grabbing data from the user's local data set will involve privacy violations. Federated learning can circumvent this problem, but the model trained by federated learning cannot meet the personalized needs of each device. Therefore, in the voice recognition scenario, there is a lack of a model training method that takes into account both information security and user personalized needs. Summary of the invention
[0005] To solve the above problems, the embodiments of the present application provide a model training method, device and blockchain based on blockchain and federated learning, which aims to overcome or partially overcome the above technical problems.
[0006] The present application embodiment adopts the following technical solutions:
[0007] In a first aspect, a model training method based on blockchain and federated learning is provided, wherein the blockchain includes multiple idle edge nodes participating in the training, one of the multiple idle edge nodes is an aggregation node, and the remaining idle edge nodes are training nodes, and the method includes:
[0008] The aggregation node generates the initial global initial model based on a random function;
[0009] Each training node downloads the global initial model from the aggregation node, uses the global initial model as the local initial model, and obtains the local speech recognition model of each training node based on the local speech data of each training node;
[0010] Each training node transmits its own local speech recognition model to the aggregation node, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model;
[0011] When the global speech recognition model meets the preset iteration conditions, each training node downloads the global speech recognition model from the aggregation node;
[0012] Each idle edge node calculates the parameters required for secondary training based on the local voice data stored by each node and uploads them to the blockchain, and performs secondary training and deploys the global speech recognition model according to the local voice data stored by each node and the parameters.
[0013] Optionally, each training node downloads a global initial model from the aggregation node, uses the global initial model as the local initial model, and obtains a local speech recognition model of each training node based on the local speech data of each training node, including:
[0014] Each training node randomly obtains a specified number of training samples from its own local voice data according to a preset data volume, wherein the preset data volume includes a preset number of data items and a preset training round;
[0015] Each training node trains a local initial model based on a specified number of training samples according to a preset training round to obtain a local speech recognition model of each training node.
[0016] Optionally, each training node transmits its own local speech recognition model to the aggregation node, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model, including:
[0017] Each training node transmits its own local speech recognition model parameters to the aggregation node;
[0018] The aggregation node takes the average value of each dimension of the parameter, and uses the new parameter composed of the average value as the parameter of the global speech recognition model to obtain the global speech recognition model;
[0019] The obtained global speech recognition model is used as the global initial model.
[0020] Optionally, when the global speech recognition model meets a preset iteration condition, each training node downloads the global speech recognition model from the aggregation node, including:
[0021] When the accuracy of the global speech recognition model is higher than a preset accuracy threshold, each training node downloads the global speech recognition model from the aggregation node.
[0022] Optionally, each idle edge node calculates the parameters required for secondary training based on the local voice data stored by each node and uploads the parameters to the blockchain, and secondary trains and deploys the global voice recognition model according to the local voice data stored by each node and the parameters, including:
[0023] Collect all voice data stored in each edge idle node;
[0024] Determine the average repetition score of each voice data;
[0025] Upload the average repetition score to the blockchain;
[0026] The second training round is determined according to the average repetition score, and the global speech recognition model is trained according to the second training round.
[0027] Optionally, determine the average repetition score of each voice data, including:
[0028] Using the word2vec algorithm for each piece of voice data, calculate the repetition of the voice data and other voice data except the voice data, and obtain a repetition score set for each piece of voice data;
[0029] Calculate the average value of the data in each repetition score set to obtain the average repetition score of each voice data.
[0030] Optionally, a secondary training round is determined according to the average repetition score, and the global speech recognition model is trained according to the secondary training round, including:
[0031] The average repetition score is multiplied by the preset training rounds and the integer part is taken to obtain the secondary training round of each voice data;
[0032] Combining the voice data of the same second training round to form a voice data group;
[0033] Based on the speech data set, the global speech recognition model is trained according to the corresponding secondary training rounds.
[0034] In a second aspect, a model training device based on blockchain and federated learning is provided, wherein the blockchain includes multiple idle edge nodes participating in the training, one of the multiple idle edge nodes is an aggregation node, and the remaining idle edge nodes are training nodes, and the device includes:
[0035] A global initial model generating unit, used for generating an initial global initial model based on a random function;
[0036] A local speech recognition model training unit is used to download a global initial model from an aggregation node, use the global initial model as a local initial model, and train each training node based on local speech data of each training node to obtain a local speech recognition model of each training node;
[0037] The local speech recognition model aggregation unit is used to transmit the respective local speech recognition models to the aggregation node respectively, so that the aggregation node obtains the global speech recognition model according to the aggregation algorithm, and uses the obtained global speech recognition model as the global initial model;
[0038] A global speech recognition model downloading unit, used to download the global speech recognition model from the aggregation node when the global speech recognition model meets a preset iteration condition;
[0039] The global speech recognition model training unit is used to calculate the parameters required for secondary training based on the local speech data stored in each idle edge node and upload them to the blockchain, and to perform secondary training and deploy the global speech recognition model according to the local speech data and the parameters stored in each node.
[0040] In a third aspect, a blockchain is provided, the blockchain comprising a plurality of idle edge nodes participating in training, one of the plurality of idle edge nodes being an aggregation node, and the remaining idle edge nodes being training nodes;
[0041] Aggregation node, used to generate the initial global initial model based on random function;
[0042] A training node is used to download a global initial model from an aggregation node, use the global initial model as a local initial model, train a local speech recognition model based on stored local speech data, and transmit the local speech recognition model to the aggregation node;
[0043] The aggregation node is used to aggregate the local speech recognition models transmitted by the training nodes according to the aggregation algorithm to obtain a global speech recognition model, and use the obtained global speech recognition model as the global initial model. When the global speech recognition model meets the preset iteration conditions, the global speech recognition model is sent to the training node;
[0044] A plurality of idle edge nodes are used to calculate the parameters required for the secondary training based on the local voice data stored in each node and upload the parameters to the blockchain, and to perform secondary training and deploy the global voice recognition model according to the local voice data stored in each node and the parameters.
[0045] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform any of the above methods.
[0046] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs, and when the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes any of the above methods.
[0047] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0048] This application is based on the idea of blockchain technology and federated learning algorithm. The global initial model is sent to each training node participating in the training, so that each training node is trained based on its own stored local voice data; the local voice recognition model trained by each training node is used to obtain the global voice recognition model at the aggregation node according to the aggregation algorithm; the global voice recognition model is sent to each training node participating in the training, so that each idle edge node calculates the secondary training parameters based on its own stored local voice data; the parameters required for the secondary training are uploaded to the blockchain, and the global voice recognition model is retrained and deployed according to the local voice data and parameters stored by each idle edge node, so as to finally obtain a model that meets the personalized needs of each device. In this application, the local voice data of each training node completes the model training without leaving the local area, which not only ensures the user's data privacy, but also meets the data and efficiency requirements of the model training task; the relevant data of each training node is uploaded to the chain, which realizes the traceability and tamper-proof of information; the global speech recognition model is iteratively trained and sent to each training node when it meets the preset iteration conditions, which improves the accuracy of model training; the model obtained by federated learning training is personalized, and each device can obtain a personalized model through secondary training, which improves the use accuracy of the locally deployed model and enhances the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0050] Figure 1 A schematic diagram showing the structure of a blockchain according to an embodiment of the present application is shown;
[0051] Figure 2 A flowchart of a model training method based on blockchain and federated learning according to an embodiment of the present application is shown;
[0052] Figure 3 A schematic diagram showing the structure of a model training device based on blockchain and federated learning according to an embodiment of the present application is shown;
[0053] Figure 4 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0055] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0056] The idea of this application is to address the technical barriers in existing speech recognition scenarios that cannot balance user information security and personalized needs. Based on blockchain technology and the idea of federated learning, a model training method based on blockchain and federated learning is provided, which enables multiple participants to train and deploy personalized global speech recognition models based on blockchain without leaking user privacy data.
[0057] Federated Learning is a new basic artificial intelligence technology first proposed by Google in 2016. It was originally used to solve the problem of local model update for Android mobile phone users. Its design goal is to carry out efficient machine learning among multiple participants or multiple computing nodes while ensuring information security during big data exchange, protecting terminal data and personal data privacy, and ensuring legality and compliance.
[0058] Figure 1 The schematic diagram of the structure of the blockchain according to an embodiment of the present application is shown, but the implementation of the present application is not limited to Figure 1 The blockchain shown can be any blockchain system that can implement the training method of the global speech recognition model provided in this application.
[0059] from Figure 1 As can be seen, Figure 1 The blockchain 100 shown includes a plurality of idle edge nodes participating in training, one of the plurality of idle edge nodes is an aggregation node 101, and the remaining idle edge nodes are training nodes 102. The aggregation node 101 is in communication connection with each training node 102.
[0060] It should be noted here that each idle edge node participating in the training can be used as an aggregation node 101 or a training node 102. This application does not limit this. However, when performing model training, the tasks that the aggregation node 101 and the training node 102 are responsible for are different. As for which idle edge node is the aggregation node 101, it is randomly determined during the execution of this application.
[0061] Figure 2The training method of the model based on blockchain and federated learning in one embodiment of the present application is shown. Figure 2 It can be seen that the present application at least includes steps S210 to S250:
[0062] Step S210: Aggregating nodes generate an initial global initial model based on a random function.
[0063] The publisher of speech recognition training tasks collects multiple idle edge nodes from the edge network to participate in the training. Each idle edge node stores its own local speech data. One of the multiple idle edge nodes is randomly selected as the aggregation node, and the remaining idle edge nodes are training nodes. The aggregation node and the training nodes are only different in the work they are responsible for during the model training process.
[0064] When one of the idle edge nodes is determined as an aggregation node, the aggregation node generates an initial global initial model based on a random function as the original model for subsequent iterative training.
[0065] Step S220: Each training node downloads the global initial model from the aggregation node, takes the global initial model as the local initial model, and obtains the local speech recognition model of each training node based on the local speech data of each training node.
[0066] The aggregation node generates and stores the initial global initial model. Each training node downloads the initial global initial model from the aggregation node and stores it locally, and uses the initial global initial model as the local initial model of each training node. The initial global initial model is trained based on the local speech data stored in each training node to obtain the local speech recognition model of each training node.
[0067] When each training node trains the local initial model, the local voice data stored in each training node does not need to be uploaded to the chain or transmitted, thus ensuring the privacy of the local voice data. For the distributed training process of the local voice recognition model, reference can be made to the existing technology, such as pre-setting the necessary training data, and then iterating several times on each training node based on the local voice data until the requirements are met, ending the training, and obtaining the model parameters.
[0068] In some embodiments of the present application, the amount of data used by each training node to train the local initial model may be, but is not limited to, preset and determined by the publisher of the speech recognition training task. The amount of data may include, but is not limited to, the number of data items and the number of training rounds. The number of data items and the number of training rounds used by each training node to train the local initial model may be the same or different. That is, each training node may have the same number of data items and the same training rounds for training the local initial model, or each training node may have the same number of data items but different training rounds for training the local initial model, or each training node may have different numbers of data items but the same training rounds for training the local initial model. Each training node determines the training sample based on the number of data items, completes the specified round of local training, and obtains a local speech recognition model.
[0069] Step S230: Each training node transmits its own local speech recognition model to the aggregation node, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model.
[0070] Each training node transmits the local speech recognition model obtained by local training to the aggregation node. The aggregation node performs aggregation calculation based on all the local speech recognition models it receives to obtain a global speech recognition model. The obtained global speech recognition model is stored in the aggregation node as the model basis for the next iterative training.
[0071] In the actual training process, it is usually not possible to achieve a relatively ideal effect with just one round of training for a model. Usually, multiple rounds of training are required, and the model parameters obtained in the previous round are used as the basis for the training of the next round. The present application uses the initial global initial model generated by the aggregation node as the original model, aggregates the local speech recognition models obtained based on the distributed local training of each training node to obtain a global speech recognition model, and stores the obtained global speech recognition model as a new global initial model in the aggregation node. Each training node downloads a new global initial model from the aggregation node again, performs distributed local training to obtain a local speech recognition model and transmits it to the aggregation node. The global speech recognition model obtained after the aggregation node aggregates the local speech recognition models is stored in the aggregation node as the latest global initial model. The training is iterated back and forth until the global speech recognition model meets the preset iteration conditions.
[0072] In some embodiments of the present application, it is assumed that the preset iteration condition is met after three rounds of iterative training, and in the first round, steps S210 to S230 are performed; in the second round, steps S220 to S230 are performed; in the third round, steps S220 to S230 are performed. The specific number of iterations is determined by whether the final global speech recognition model meets the preset iteration condition.
[0073] When the aggregation node aggregates the local speech recognition models transmitted by each training node, it can comprehensively consider the training results of each training node to obtain the final aggregation model parameters, so that the number of training samples is very large, and the training sample range covers the local speech data of each training node. The data is comprehensive and accurate.
[0074] Step S240: When the global speech recognition model meets the preset iteration condition, each training node downloads the global speech recognition model from the aggregation node.
[0075] The preset iteration condition may be, but is not limited to, the accuracy of the global speech recognition model reaching a standard, or the number of times the aggregation node aggregates the local speech recognition model reaching a standard. When the global speech recognition model meets the preset iteration condition, it means that the global speech recognition model training is completed, and each training node downloads the global speech recognition model from the aggregation node and stores it locally.
[0076] In some embodiments of the present application, each time a global speech recognition model is obtained through aggregation, its accuracy is evaluated. If the accuracy meets the requirement, the iterative training of the global speech recognition model is stopped, and the latest global speech recognition model is sent to each training node; if the accuracy does not meet the requirement, it means that the global speech recognition model cannot meet the deployment requirements due to insufficient training times, and it needs to be repeatedly iterated.
[0077] Step S250: Each idle edge node calculates the parameters required for secondary training based on the local voice data stored by each node and uploads them to the blockchain, and performs secondary training and deploys the global speech recognition model according to the local voice data stored by each node and the parameters.
[0078] After each training node downloads the global speech recognition model from the aggregation node, each training node and aggregation node stores the global speech recognition model. That is, each idle edge node stores the global speech recognition model and its own local voice data. At this time, each idle edge node calculates the parameters required for secondary training based on its own stored local voice data, and uploads the parameters to the blockchain, so that the parameters are traceable and tamper-proof. The global speech recognition model is trained again based on the local voice data and the calculated parameters to obtain a personalized global speech recognition model suitable for each idle edge node, and then deployed. In this way, the models deployed on each idle edge node have local personalized characteristics. In terms of the final deployment effect, there is no difference between the aggregation node and the training node.
[0079] Depend on Figure 2It can be seen from the method shown that the present application is based on the idea of blockchain technology and federated learning algorithm, and sends the global initial model to each training node participating in the training, so that each training node is trained based on its own stored local voice data; the local voice recognition model trained by each training node is used to obtain the global voice recognition model at the aggregation node according to the aggregation algorithm; the global voice recognition model is sent to each training node participating in the training, so that each idle edge node calculates the secondary training parameters based on its own stored local voice data; the parameters required for the secondary training are uploaded to the blockchain, and the global voice recognition model is trained and deployed for the secondary time according to the local voice data and parameters stored in each idle edge node, so as to finally obtain a model that meets the personalized needs of each device. In this application, the local voice data of each training node completes the model training without leaving the local area, which not only ensures the user's data privacy, but also meets the data and efficiency requirements of the model training task; the relevant data of each training node is uploaded to the chain, which realizes the traceability and tamper-proof of information; the global speech recognition model is iteratively trained and sent to each training node when it meets the preset iteration conditions, which improves the accuracy of model training; the model obtained by federated learning training is personalized, and each device can obtain a personalized model through secondary training, which improves the use accuracy of the locally deployed model and enhances the user experience.
[0080] In some embodiments of the present application, each training node downloads a global initial model from an aggregation node, takes the global initial model as the local initial model, and obtains a local speech recognition model of each training node based on the local speech data of each training node, including: each training node randomly obtains a specified number of training samples from its own local speech data according to a preset data volume, wherein the preset data volume includes a preset number of data items and a preset training round; each training node trains the local initial model according to the preset training rounds based on the specified number of training samples to obtain a local speech recognition model of each training node.
[0081] The publisher of the speech recognition training task presets and determines the amount of data for each training node to train, which includes the preset number of data items and the preset number of training rounds. The preset number of data items determines the number of samples required for each training node to train the local initial model, and the preset number of training rounds determines the accuracy of the local speech recognition model trained by each training node. Each training node randomly obtains a specified number of training samples from the local speech data stored by each training node according to the preset number of data items. The specified number of training samples are randomly selected from the local speech data, which makes the training samples more arbitrary and is conducive to obtaining a better local speech recognition model.
[0082] In the process of training the local initial model, the number of samples sent to training in each round can be the same or different. The same number of samples sent to training in each round can be that a specified number of training samples are randomly and evenly grouped according to the preset training rounds; a group is randomly selected from each training sample group and sent in each round of training. The different number of samples sent to training in each round can be that a specified number of training samples are randomly gradient grouped according to the preset training rounds, for example, the number of data in each training sample group is arithmetic difference distribution; when training the local initial model, the data in the training sample group is sent in rounds in the order from the largest to the smallest number.
[0083] In some embodiments of the present application, each training node transmits its own local speech recognition model to the aggregation node respectively, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model, including: each training node transmits its own local speech recognition model parameters to the aggregation node respectively; the aggregation node takes the average value of each dimension of the parameter, and uses the new parameters composed of the average value as the parameters of the global speech recognition model to obtain the global speech recognition model; and uses the obtained global speech recognition model as the global initial model.
[0084] There are many types of aggregation functions, and different aggregation functions correspond to different application scenarios and solve different practical problems. In the case of training a global speech recognition model in this application, a classic aggregation algorithm is adopted. That is, each training node transmits its own local speech recognition model parameters to the aggregation node; after the aggregation node receives each model parameter, it takes the average value for each dimension included in each model parameter to obtain a new model parameter; the new model parameter is used as the parameter of the global speech recognition model to obtain the global speech recognition model after aggregation. The obtained global speech recognition model is stored in the aggregation node as the basis of the global initial model for the next iterative training.
[0085] In this application, each training node downloads the global initial model from the aggregation node, performs distributed training based on their own local voice data, and the aggregation node aggregates the distributed training results into a global voice recognition model as a new round of global initial model. The above process is an iterative process, which is repeated until the global voice recognition model meets the iteration conditions.
[0086] In some embodiments of the present application, when the global speech recognition model meets the preset iteration conditions, each training node downloads the global speech recognition model from the aggregation node, including: when the accuracy of the global speech recognition model is higher than the preset accuracy threshold, each training node downloads the global speech recognition model from the aggregation node.
[0087] The publisher of speech recognition training tasks can specify a preset accuracy threshold according to needs. For tasks with higher accuracy requirements, such as military-related speech recognition, a higher model accuracy threshold is required. Therefore, a higher preset accuracy threshold is set so that the global speech recognition model needs to undergo multiple iterations of training to meet the preset iteration conditions. For tasks with lower accuracy, a higher model accuracy threshold is not required, but the model needs to be obtained faster. Therefore, a lower preset accuracy threshold is set so that the global speech recognition model does not need to undergo too many iterations and can quickly meet the preset iteration requirements.
[0088] In some embodiments of the present application, each idle edge node calculates the parameters required for secondary training based on the local voice data stored by each node and uploads them to the blockchain, and secondary trains and deploys the global speech recognition model according to the local voice data stored by each node and the parameters, including: collecting all voice data stored in each idle edge node; determining the average repetition score of each voice data; uploading the average repetition score to the blockchain; determining the secondary training round according to the average repetition score, and training the global speech recognition model according to the secondary training round.
[0089] After each training node downloads the global speech recognition model from the aggregation node, each idle edge node stores the global speech recognition model and its own local speech data. At this time, each idle edge node performs secondary training on the global speech recognition model locally.
[0090] For any idle edge node, first collect all the voice data stored in it. For one of the voice data, determine the average repetition score of this voice data and other voice data except this one. In the same way as above, determine the average repetition score of each voice data, and upload the average repetition score to the blockchain. Recording the repetition score of each voice data and other voice data on the blockchain ensures the traceability and tamper-proof of the information, and further improves the accuracy of the secondary training of the model. Then, based on the average repetition score, determine the secondary training rounds of each idle edge node, train the global speech recognition model according to the determined secondary training rounds, and deploy it, so that the models deployed on each edge node have local personalized characteristics.
[0091] In some embodiments of the present application, determining the average repetition score of each voice data includes: using the word2vec algorithm to calculate the repetition of each voice data with other voice data except the voice data, to obtain a repetition score set for each voice data; calculating the average value of the data in each of the repetition score sets to obtain the average repetition score for each voice data.
[0092] For example, assuming that all the speech data includes 4 pieces, for one of them, the word2vec algorithm is used to calculate its repetition with other speech data, and the repetition score set of the speech data is obtained {a1, a2, a3}; for the other three pieces, the word2vec algorithm is used to calculate the repetition score sets {b1, b2, b3}, {c1, c2, c3}, {d1, d2, d3} respectively. The average value of each repetition score set is calculated, and the average repetition score of the four speech data is obtained as a, b, c, d.
[0093] In some embodiments of the present application, a secondary training round is determined based on an average repetition score, and a global speech recognition model is trained according to the secondary training round, including: multiplying the average repetition score by a preset training round and taking the integer part to obtain a secondary training round for each voice data; combining voice data with the same secondary training round to form a voice data group; and based on the voice data group, training the global speech recognition model according to the corresponding secondary training round.
[0094] Multiply each repetition score by the preset training rounds of the previous local distributed training, and then truncate the decimal places to get the training rounds of the voice data during the secondary training. Continuing with the above example, assume that among the 4 voice data, the secondary training rounds calculated for the 1st and 2nd are X, and the secondary training rounds calculated for the 3rd and 4th are Y. Combine the voice data with the same secondary training rounds to form a voice data group. That is, voice data group A includes the 1st and 2nd voice data, and the secondary training round is X; voice data group B includes the 3rd and 4th voice data, and the secondary training round is Y. Of course, the above examples are only descriptive. In actual training, the number of local voice data samples stored by each idle edge node is very large, which can fully reflect the ontological personalized characteristics of each idle edge node. Finally, each idle edge node trains the global speech recognition model based on the voice data group according to the corresponding secondary training rounds, and deploys a model with local personalized characteristics.
[0095] The applicant particularly emphasized that the technical solution of the present application carried out two local model trainings at each training node. The methods and functions of the two local model trainings are different. In the first local model training, the training sample data and training rounds are determined by the preset data volume. As part of the distributed model training, each training node transmits the trained local speech recognition model to the aggregation node to aggregate to obtain a global speech recognition model. In this way, the local voice data does not need to be uploaded to the chain or transmitted, which can ensure the privacy of user data; the global speech recognition model is based on the local voice data stored in each training node as a training sample, with a larger data scale and higher training efficiency. In the second local model training, the training sample data and training rounds are calculated based on the local voice data, and the relevant parameters are uploaded to the chain. Each training node will deploy the personalized model obtained by the secondary training of the global speech recognition model. In this way, each node can obtain a model with personalized characteristics of the user, which improves the accuracy of the use of the locally deployed model and enhances the user experience.
[0096] Figure 3 A model training device based on blockchain and federated learning according to an embodiment of the present application is shown. The blockchain includes multiple idle edge nodes participating in the training, one of the multiple idle edge nodes is an aggregation node, and the remaining idle edge nodes are training nodes. The training device is deployed on each node of the blockchain ( Figure 1 101 and 102), from Figure 3 It can be seen that the device 300 comprises:
[0097] A global initial model generating unit 310, used to generate an initial global initial model based on a random function;
[0098] The local speech recognition model training unit 320 is used to download the global initial model from the aggregation node, use the global initial model as the local initial model, and train the local speech recognition model of each training node based on the local speech data of each training node;
[0099] The local speech recognition model aggregation unit 330 is used to transmit the respective local speech recognition models to the aggregation node, so that the aggregation node aggregates the local speech recognition model according to the aggregation algorithm to obtain the global speech recognition model, and uses the obtained global speech recognition model as the global initial model;
[0100] A global speech recognition model downloading unit 340, configured to download the global speech recognition model from the aggregation node when the global speech recognition model meets a preset iteration condition;
[0101] The global speech recognition model training unit 350 is used to calculate the parameters required for secondary training based on the local speech data stored in each idle edge node and upload them to the blockchain, and to perform secondary training and deploy the global speech recognition model according to the local speech data and the parameters stored in each node.
[0102] In some embodiments of the present application, in the above-mentioned device, the local speech recognition model training unit 320 is used to randomly obtain a specified number of training samples from the respective local speech data according to a preset data volume, wherein the preset data volume includes a preset number of data items and a preset training round; based on the specified number of training samples, the local initial model is trained according to the preset training rounds to obtain a local speech recognition model.
[0103] In some embodiments of the present application, in the above-mentioned device, the local speech recognition model aggregation unit 330 is used to transmit the respective local speech recognition model parameters to the aggregation node respectively, so that the aggregation node takes the average value of each dimension of the parameter, and uses the new parameters composed of the average value as the parameters of the global speech recognition model to obtain the global speech recognition model, and use the obtained global speech recognition model as the global initial model.
[0104] In some embodiments of the present application, in the above-mentioned device, the global speech recognition model downloading unit 340 is used to download the global speech recognition model from the aggregation node when the accuracy of the global speech recognition model is higher than a preset accuracy threshold.
[0105] In some embodiments of the present application, in the above-mentioned device, the global speech recognition model training unit 350 includes: a speech data collection module, used to collect all speech data; an average repetition determination module, used to determine the average repetition score of each speech data; a transmission module, used to upload the average repetition score to the data link; a secondary training module, used to determine the secondary training round according to the average repetition score, and train the global speech recognition model according to the secondary training round.
[0106] In some embodiments of the present application, in the above-mentioned device, the average repetition determination module is used to calculate the repetition of each voice data with the other voice data except the voice data using the word2vec algorithm to obtain a repetition score set for each voice data; calculate the average value of the data in each repetition score set to obtain the average repetition score for each voice data.
[0107] In some embodiments of the present application, in the above-mentioned device, the secondary training module is used to multiply the average repetition score by the preset training round and take the integer part to obtain the secondary training round of each voice data; combine the voice data with the same secondary training round to form a voice data group; based on the voice data group, train the global speech recognition model according to the corresponding secondary training round.
[0108] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 4 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0109] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0110] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0111] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a model training device based on blockchain and federated learning at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0112] The aggregation node generates the initial global initial model based on a random function;
[0113] Each of the training nodes downloads a global initial model from the aggregation node, uses the global initial model as a local initial model, and obtains a local speech recognition model of each of the training nodes based on the local speech data of each of the training nodes;
[0114] Each of the training nodes transmits its own local speech recognition model to the aggregation node, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model;
[0115] When the global speech recognition model meets a preset iteration condition, each of the training nodes downloads the global speech recognition model from the aggregation node;
[0116] Each of the idle edge nodes calculates the parameters required for secondary training based on the local voice data stored by each node and uploads the parameters to the blockchain, and secondary trains and deploys the global speech recognition model according to the local voice data stored by each node and the parameters.
[0117] The above application Figure 3The method performed by the model training device based on blockchain and federated learning disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in software form. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0118] The electronic device may also perform Figure 3 A method for executing a model training device based on blockchain and federated learning in a Figure 3 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0119] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 3 The method executed by the model training device based on blockchain and federated learning in the illustrated embodiment is specifically used to execute:
[0120] The aggregation node generates the initial global initial model based on a random function;
[0121] Each of the training nodes downloads a global initial model from the aggregation node, uses the global initial model as a local initial model, and obtains a local speech recognition model of each of the training nodes based on the local speech data of each of the training nodes;
[0122] Each of the training nodes transmits its own local speech recognition model to the aggregation node, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model;
[0123] When the global speech recognition model meets a preset iteration condition, each of the training nodes downloads the global speech recognition model from the aggregation node;
[0124] Each of the idle edge nodes calculates the parameters required for secondary training based on the local voice data stored by each node and uploads the parameters to the blockchain, and secondary trains and deploys the global speech recognition model according to the local voice data stored by each node and the parameters.
[0125] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0126] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0129] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0130] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0131] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0132] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0133] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0134] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A model training method based on blockchain and federated learning, It is characterized in that The blockchain includes a plurality of idle edge nodes participating in training, one of the plurality of idle edge nodes is an aggregation node, and the remaining idle edge nodes are training nodes, and the method includes: The aggregation node generates the initial global initial model based on a random function; Each of the training nodes downloads a global initial model from the aggregation node, uses the global initial model as a local initial model, and obtains a local speech recognition model of each of the training nodes based on the local speech data of each of the training nodes; Each of the training nodes transmits its own local speech recognition model to the aggregation node, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model; When the global speech recognition model meets a preset iteration condition, each of the training nodes downloads the global speech recognition model from the aggregation node; Each of the idle edge nodes calculates the parameters required for secondary training based on the local voice data stored by each node and uploads the parameters to the blockchain, and secondary trains and deploys the global speech recognition model according to the local voice data stored by each node and the parameters.
2. The method according to claim 1, It is characterized in that Each of the training nodes downloads the global initial model from the aggregation node, uses the global initial model as the local initial model, and obtains a local speech recognition model of each of the training nodes based on the local speech data of each of the training nodes, including: Each of the training nodes randomly obtains a specified number of training samples from the respective local voice data according to a preset data volume, wherein the preset data volume includes a preset number of data items and a preset training round; Each of the training nodes trains a local initial model based on the specified number of training samples according to a preset training round to obtain a local speech recognition model of each of the training nodes.
3. The method according to claim 1, It is characterized in that Each of the training nodes transmits the respective local speech recognition models to the aggregation node, so that the aggregation node aggregates the global speech recognition model according to the aggregation algorithm, and uses the obtained global speech recognition model as the global initial model, including: Each of the training nodes transmits the local speech recognition model parameters thereof to the aggregation node respectively; The aggregation node takes an average value for each dimension of the parameter, and uses a new parameter composed of the average value as a parameter of the global speech recognition model to obtain the global speech recognition model; The obtained global speech recognition model is used as the global initial model.
4. The method according to claim 1, It is characterized in that When the global speech recognition model meets the preset iteration condition, each of the training nodes downloads the global speech recognition model from the aggregation node, including: When the accuracy of the global speech recognition model is higher than a preset accuracy threshold, each of the training nodes downloads the global speech recognition model from the aggregation node.
5. The method according to claim 2, It is characterized in that Each of the idle edge nodes calculates the parameters required for secondary training based on the local voice data stored by each node and uploads the parameters to the blockchain, and secondary trains and deploys the global voice recognition model according to the local voice data and the parameters stored by each node, including: Collecting all voice data stored in each of the edge idle nodes; Determining an average repetition score for each piece of the voice data; Uploading the average repetition score to the blockchain; A secondary training round is determined according to the average repetition score, and the global speech recognition model is trained according to the secondary training round.
6. The method according to claim 5, It is characterized in that Determining the average repetition score of each piece of voice data includes: Using the word2vec algorithm to calculate the repetition of each piece of voice data with other voice data except the piece of voice data, to obtain a repetition score set for each piece of voice data; The average value of the data in each repetition score set is calculated to obtain the average repetition score of each voice data.
7. The method according to claim 6, It is characterized in that The step of determining a secondary training round according to the average repetition score, and training the global speech recognition model according to the secondary training round, comprises: Multiplying the average repetition score by the preset training rounds and taking the integer part to obtain the secondary training round of each voice data; Combining the voice data of the same second training round to form a voice data group; Based on the speech data set, the global speech recognition model is trained according to a corresponding secondary training round.
8. A model training device based on blockchain and federated learning, It is characterized in that The blockchain includes a plurality of idle edge nodes participating in training, one of the plurality of idle edge nodes is an aggregation node, and the remaining idle edge nodes are training nodes, and the device includes: A global initial model generating unit, used for generating an initial global initial model based on a random function; A local speech recognition model training unit, configured to download a global initial model from the aggregation node, use the global initial model as the local initial model, and train the local speech recognition model of each training node based on the local speech data of each training node; A local speech recognition model aggregation unit, used to transmit the respective local speech recognition models to the aggregation node, so that the aggregation node aggregates according to the aggregation algorithm to obtain a global speech recognition model, and uses the obtained global speech recognition model as the global initial model; A global speech recognition model downloading unit, configured to download the global speech recognition model from the aggregation node when the global speech recognition model meets a preset iteration condition; The global speech recognition model training unit is used to calculate the parameters required for secondary training based on the local speech data stored in each of the idle edge nodes and upload them to the blockchain, and to perform secondary training and deploy the global speech recognition model according to the local speech data and the parameters stored in each node.
9. A blockchain, It is characterized in that The blockchain includes a plurality of idle edge nodes participating in training, one of the plurality of idle edge nodes is an aggregation node, and the remaining idle edge nodes are training nodes: The aggregation node is used to generate an initial global initial model based on a random function; The training node is used to download the global initial model from the aggregation node, use the global initial model as the local initial model, train a local speech recognition model based on the stored local speech data, and transmit the local speech recognition model to the aggregation node; The aggregation node is used to obtain a global speech recognition model according to the aggregation algorithm based on the respective local speech recognition models transmitted by the training nodes, and use the obtained global speech recognition model as the global initial model, and when the global speech recognition model meets the preset iteration condition, send the global speech recognition model to the training node; The plurality of idle edge nodes are used to calculate the parameters required for secondary training based on the local voice data stored in each node and upload the parameters to the blockchain, and to perform secondary training and deploy the global speech recognition model according to the local voice data and the parameters stored in each node.
Citation Information
Cited By
Fair incentive mechanism design method of block chain federated learning system
CN120031161A
