Blockchain-based device selection method, device, apparatus, and readable storage medium

By calculating the distance score between the global parameters of the target device and the historical device parameters in the blockchain network, selecting better and more stable devices for model training, solving the problem of low training efficiency and accuracy caused by device performance differences in edge computing, and improving the efficiency and accuracy of model training.

CN114153814BActive Publication Date: 2025-07-25HAINAN HUOCHAIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111263501.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-07-25
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

In the edge computing scenario, the differences in equipment performance of different target devices lead to low model training efficiency and accuracy, especially the weak generalization ability of equipment with poor performance.

Method used

By obtaining the parameter backup set in the blockchain network, performing data cleaning, computing the distance score between the global parameters of the target device and the historical device parameters, and selecting devices with a distance score higher than the threshold for the next round of model training.

Benefits of technology

Improve the efficiency and accuracy of model training, avoid the participation of useless devices, and select better and more stable devices for training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153814B_ABST
    Figure CN114153814B_ABST
Patent Text Reader

Abstract

The present application discloses a device selection method, device, equipment and readable storage medium based on blockchain, which relates to the field of Internet technology. By calculating the distance score between the latest aggregation parameters of the target device and the historical device parameters, a device with better performance and stability is selected to continue model training, avoiding useless devices from participating in model training, and improving the efficiency and accuracy of model training. The method includes: obtaining a parameter backup set in the blockchain network, performing data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices; obtaining the device parameters uploaded by the currently selected target device, performing an aggregation operation on the device parameters to obtain global parameters; calculating the distance score of the target device based on the global parameters and the historical device parameters; comparing the distance score with a preset score, and if the distance score of the target device is higher than the score threshold, selecting the target device for the next round of model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technologies, and particularly to a device selection method, apparatus, device, and readable storage medium based on blockchain. Background Art

[0002] With the continuous progress of Internet technologies and the continuous development of blockchain technologies, the computing requirements of blockchain networks have increased rapidly. More and more blockchain networks adopt edge computing to complete some computing tasks on edge devices of the network, improving the computing power and speed of blockchain networks.

[0003] In related technologies, a blockchain network selects a certain number of target devices from all devices connected to the network for edge computing to perform model training tasks. After the tasks are completed, the target devices upload the model parameters obtained from training to the blockchain network for storage.

[0004] In the process of implementing this application, the applicant found that related technologies have at least the following problems:

[0005] In an edge computing scenario, there are also obvious differences in the device performance of different target devices. Some target devices are prone to weak generalization ability during model training due to poor performance, resulting in low efficiency and accuracy of model training. Summary of the Invention

[0006] In view of this, this application provides a device selection method and apparatus based on blockchain, mainly aiming to solve the problem that some current target devices are prone to weak generalization ability during model training due to poor performance, resulting in low efficiency and accuracy of model training.

[0007] According to a first aspect of this application, there is provided a device selection method based on blockchain, the method including:

[0008] Obtain a parameter backup set in a blockchain network, and perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain historical device parameters of all devices;

[0009] Obtain device parameters uploaded by currently selected target devices, perform aggregation operations on the device parameters to obtain global parameters, where the device parameters are training parameters obtained by the target devices through local model training;

[0010] Based on the global parameters and the historical device parameters, calculate a distance score of the target devices;

[0011] Compare the distance score with a preset score. If the distance score of the target device is higher than a score threshold, select the target device for the next round of model training.

[0012] Optionally, obtaining a parameter backup set in the blockchain network, and performing data cleaning on the parameter backup set according to a data cleaning algorithm to obtain historical device parameters of all devices, including:

[0013] Obtaining the parameter backup set in the blockchain network, and identifying the parameter backup set according to the data cleaning algorithm to obtain multiple historical parameter backups, where the multiple historical parameter backups include a first hash value of multiple historical parameter summaries and a second hash value of multiple historical parameter addresses;

[0014] Identifying the multiple historical parameter backups, and dividing the historical parameter backups with the same first hash value into the same device group to obtain multiple device groups;

[0015] For each device group in the multiple device groups, extracting one of the historical parameter backups as a backup parameter to obtain multiple backup parameters of the multiple device groups;

[0016] Performing a hash mapping on the second hash values of the multiple backup parameters to determine the historical parameter addresses of the multiple backup parameters, and obtaining corresponding historical device parameters from the historical parameter addresses to obtain the historical device parameters of all devices.

[0017] Optionally, obtaining device parameters uploaded by a currently selected target device, and performing an aggregation operation on the device parameters to obtain a global parameter, including:

[0018] Obtaining the device parameters uploaded by the target device, determining a dimension value corresponding to the device parameters, and performing a vector exponential operation on the device parameters to obtain a vector matrix, where the exponential parameter in the exponential operation is calculated according to the changing dimension value;

[0019] Performing an aggregation operation on the vector matrix according to a data clustering algorithm to obtain an aggregation operation result of the vector matrix, and using the aggregation operation result as the global parameter of the target device.

[0020] Optionally, after obtaining device parameters uploaded by a currently selected target device, performing an aggregation operation on the device parameters to obtain a global parameter, the method further includes:

[0021] Obtaining device parameters uploaded by the currently selected target device, and determining a parameter summary and a parameter address of the device parameters, where the parameter summary is used to indicate the device identity of the target device corresponding to the device parameters;

[0022] Based on a hash algorithm, performing a hash operation on the parameter summary and the parameter address to obtain a first hash value of the parameter summary and a second hash value of the parameter address;

[0023] Associate the first hash value and the second hash value to generate a parameter backup, and upload the parameter backup to the blockchain network so that the blockchain network updates the parameter backup set;

[0024] Continuously count the time interval for obtaining the parameter backup set. When the time interval reaches the preset time interval, re-obtain the parameter backup set in the blockchain network, calculate the distance score of the target device, and select the target device with a distance score higher than the preset score for the next round of model training.

[0025] Optionally, calculating the distance score of the target device based on the global parameters and the historical device parameters includes:

[0026] Calculate the cosine value between the global parameters and the historical device parameters to obtain the cosine similarity distance;

[0027] Obtain the dimension value corresponding to the global parameters, calculate the exponential difference between the global parameters and each backup parameter in the parameter backup set to obtain a plurality of exponential differences, and the exponential parameter in the exponential differences is calculated according to the changed dimension value;

[0028] Perform a summation operation on the plurality of exponential differences to obtain a distance sum value, and calculate the first product of the cosine similarity distance and the preset parameter and the second product of the distance sum value and the preset parameter;

[0029] Calculate the sum value of the first product and the second product, and use the sum value as the distance score.

[0030] Optionally, comparing the distance score with a preset score. If the distance score of the target device is higher than the score threshold, specifying the target device for the next round of model training includes:

[0031] Compare the distance score with the score threshold to generate a comparison result;

[0032] If the comparison result indicates that the distance score is less than the score threshold, determine the target device corresponding to the distance score and prohibit the target device from entering the next update;

[0033] If the comparison result indicates that the distance score is greater than or equal to the score threshold, specify the target device corresponding to the distance score for the next round of model training.

[0034] According to the second aspect of the present application, a device selection device based on a blockchain is provided. The device includes:

[0035] A cleaning module, configured to obtain a parameter backup set in a blockchain network, perform data cleaning on the parameter backup set according to a data cleaning algorithm, and obtain historical device parameters corresponding to all devices;

[0036] An acquisition module, configured to acquire device parameters uploaded by a currently selected target device, perform an aggregation operation on the device parameters to obtain global parameters, where the device parameters are training parameters obtained by the target device through local model training;

[0037] A calculation module, configured to calculate a distance score of the target device based on the global parameters and the historical device parameters;

[0038] A comparison module, configured to compare the distance score with a preset score. If the distance score of the target device is higher than a score threshold, select the target device for the next round of model training.

[0039] Optionally, the cleaning module is configured to obtain the parameter backup set in the blockchain network, identify the parameter backup set according to the data cleaning algorithm to obtain a plurality of historical parameter backups, where the plurality of historical parameter backups include a first hash value of a plurality of historical parameter summaries and a second hash value of a plurality of historical parameter addresses; identify the plurality of historical parameter backups, divide the historical parameter backups with the same first hash value into the same device group to obtain a plurality of device groups; for each device group in the plurality of device groups, extract one of the historical parameter backups as a backup parameter to obtain a plurality of backup parameters of the plurality of device groups; perform a hash mapping on the second hash values of the plurality of backup parameters to determine the historical parameter addresses of the plurality of backup parameters, and obtain corresponding historical device parameters from the historical parameter addresses to obtain the historical device parameters of all devices.

[0040] Optionally, the acquisition module is configured to acquire the device parameters uploaded by the target device, determine a dimension value corresponding to the device parameters, perform a vector exponential operation on the device parameters to obtain a vector matrix, where an exponential parameter in the exponential operation is calculated according to the changing dimension value; perform an aggregation operation on the vector matrix according to a data clustering algorithm to obtain an aggregation operation result of the vector matrix, and use the aggregation operation result as the global parameter of the target device.

[0041] Optionally, the device further includes:

[0042] A determination module, configured to acquire device parameters uploaded by the currently selected target device, and determine a parameter summary and a parameter address of the device parameters, where the parameter summary is used to indicate the device identity of the target device corresponding to the device parameters;

[0043] An operation module, configured to perform a hashing operation on the parameter summary and the parameter address based on a hashing algorithm to obtain a first hash value of the parameter summary and a second hash value of the parameter address;

[0044] A generation module, configured to associate the first hash value and the second hash value to generate a parameter backup, and upload the parameter backup to the blockchain network so that the blockchain network updates the parameter backup set;

[0045] A statistics module, configured to continuously count the time interval for obtaining the parameter backup set. When the time interval reaches a preset time interval, re-obtain the parameter backup set in the blockchain network, calculate the distance score of the target device, and select the target device with a distance score higher than the preset score for the next round of model training.

[0046] Optionally, the calculation module is configured to calculate a cosine value between the global parameter and the historical device parameter to obtain a cosine similarity distance; obtain the dimension value corresponding to the global parameter, calculate an exponential difference between the global parameter and each backup parameter in the parameter backup set to obtain a plurality of exponential differences, where the exponential parameter in the exponential differences is calculated based on the changed dimension value; perform a summation operation on the plurality of exponential differences to obtain a distance sum value, calculate a first product of the cosine similarity distance and a preset parameter and a second product of the distance sum value and the preset parameter; calculate a sum value of the first product and the second product, and use the sum value as the distance score.

[0047] Optionally, the comparison module is configured to compare the distance score with the score threshold to generate a comparison result; if the comparison result indicates that the distance score is less than the score threshold, determine the target device corresponding to the distance score and prohibit the target device from entering the next update; if the comparison result indicates that the distance score is greater than or equal to the score threshold, specify the target device corresponding to the distance score for the next round of model training.

[0048] According to a third aspect of the present application, there is provided a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the method according to any one of the first aspects are implemented.

[0049] According to a fourth aspect of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method according to any one of the first aspects are implemented.

[0050] With the above technical solution, a device selection method, device, equipment and readable storage medium based on blockchain provided by this application need to first obtain a parameter backup set in the blockchain network, perform data cleaning on the parameter backup set according to the data cleaning algorithm to obtain the historical device parameters of all devices, then obtain the device parameters obtained by the target device through local model training, perform an aggregation operation on the device parameters to obtain global parameters. Next, based on the global parameters and the historical device parameters, calculate the distance score of the target device. Finally, compare the distance score with the preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training. By calculating the distance score between the latest aggregated parameters of the target device and the historical device parameters corresponding to the target device in the parameter backup set on the blockchain, devices with scores higher than the average value, that is, devices with better performance and stability, are selected for subsequent model training, avoiding useless devices from participating in model training and improving the efficiency and accuracy of model training.

[0051] The above description is only an overview of the technical solution of this application. In order to be able to understand the technical means of this application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of this application more obvious and understandable, the following specifically illustrates the specific implementation manners of this application. Brief Description of the Drawings

[0052] By reading the detailed description of the preferred embodiments below, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of this application. And throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:

[0053] Figure 1 shows a schematic flowchart of a device selection method based on blockchain provided by an embodiment of this application;

[0054] Figure 2 shows a schematic flowchart of a device selection method based on blockchain provided by an embodiment of this application;

[0055] Figure 3A shows a schematic structural diagram of a device selection device based on blockchain provided by an embodiment of this application;

[0056] Figure 3B shows a schematic structural diagram of a device selection device based on blockchain provided by an embodiment of this application;

[0057] Figure 4 shows a schematic structural diagram of a device of a computer device provided by an embodiment of this application. Detailed Description of the Preferred Embodiments

[0058] Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present application can be more thoroughly understood and the scope of the present application can be completely conveyed to those skilled in the art.

[0059] An embodiment of the present application provides a blockchain-based device selection method, as Figure 1 shown, the method includes:

[0060] 101. Obtain a parameter backup set in the blockchain network, and perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices.

[0061] 102. Obtain the device parameters uploaded by the currently selected target device, perform an aggregation operation on the device parameters to obtain global parameters, where the device parameters are the training parameters obtained by the target device through local model training.

[0062] 103. Calculate the distance score of the target device based on the global parameters and the historical device parameters.

[0063] 104. Compare the distance score with a preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training.

[0064] The method provided by the embodiment of the present application needs to first obtain a parameter backup set in the blockchain network, perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices, then obtain the device parameters obtained by the target device through local model training, and perform an aggregation operation on the device parameters to obtain global parameters. Next, calculate the distance score of the target device based on the global parameters and the historical device parameters. Finally, compare the distance score with a preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training. By calculating the distance score between the latest aggregated parameters of the target device and the historical device parameters corresponding to the target device in the parameter backup set on the blockchain, devices with scores higher than the average value, that is, devices with better and more stable performance, are selected for subsequent model training, avoiding useless devices from participating in model training, and improving the efficiency and accuracy of model training.

[0065] An embodiment of the present application provides a blockchain-based device selection method, as Figure 2 shown, the method includes:

[0066] 201. Obtain a parameter backup set in the blockchain network, and perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices.

[0067] With the continuous progress of Internet technology and the continuous development of blockchain technology, the computing requirements of blockchain networks have increased rapidly. More and more blockchain networks use edge computing to complete some computing tasks on edge devices of the network, improving the computing power and speed of blockchain networks. Currently, a blockchain network will select a certain number of target devices from all devices accessing the network for edge computing to perform model training tasks. After the tasks are completed, the target devices will upload the model parameters obtained from training to the blockchain network for storage. However, the applicant realizes that in the edge computing scenario, there are also obvious differences in the device performance of different target devices. Some target devices are prone to weak generalization ability during model training due to poor performance, resulting in low efficiency and accuracy of model training.

[0068] Therefore, a device selection method, device, equipment, and readable storage medium based on blockchain provided in this application need to first obtain a parameter backup set in the blockchain network, perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices, then obtain the device parameters obtained by the target device during local model training, perform an aggregation operation on the device parameters to obtain global parameters. Subsequently, based on the global parameters and historical device parameters, calculate the distance score of the target device. Finally, compare the distance score with a preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training. By calculating the distance score between the latest aggregation parameters of the target device and the historical device parameters corresponding to the target device in the parameter backup set on the blockchain, devices with scores higher than the average value are selected, that is, devices with better and more stable device performance are selected for subsequent model training, avoiding useless devices from participating in model training and improving the efficiency and accuracy of model training.

[0069] Among them, this application is applied to an aggregation server in the blockchain network. The blockchain network will select a blockchain node from multiple blockchain nodes as the aggregation server to calculate the latest aggregation parameters of the target device and calculate the vector similarity between the latest aggregation parameters and the corresponding original parameters in the parameter backup set on the blockchain to obtain the distance score of the target device. In fact, a blockchain network will select multiple target devices for model training. That is to say, each target device among the multiple target devices will upload device parameters to the aggregation server, and the aggregation server will perform the following steps for each target device to calculate the distance score and determine whether to select the current target device to continue the next round of model training.

[0070] In the embodiment of the present application, after the edge target device finishes executing the local training task, it uploads the device parameters to the aggregation server. The aggregation server uploads the parameter summary and storage location of the device parameters to the blockchain network to maintain a parameter backup set containing all the device parameter summaries. Therefore, the aggregation server can obtain the historical parameter backup of the target device based on the parameter backup set, and obtain the historical device parameters as the historical device parameters according to the historical parameter backup.

[0071] Specifically, when the aggregation server obtains the parameter backup set in the blockchain network, it should be noted that the parameter backup set contains the historical parameter backups of all the selected target devices. Each historical parameter backup of a target device stores the hash operation result of the historical parameter summary and the historical parameter address. That is to say, multiple historical parameter backups include the first hash values of multiple historical parameter summaries and the second hash values of multiple historical parameter addresses. Subsequently, the parameter backup set is identified according to the data cleaning algorithm to obtain multiple historical parameter backups. In the actual application process, the aggregation server divides the historical parameter backups with the same first hash value into the same device group by identifying multiple historical parameter backups, and obtains multiple device groups. For each device group in the multiple device groups, a historical parameter backup is extracted as the backup parameter to obtain multiple backup parameters of the multiple device groups. That is to say, only one historical parameter backup is retained for one target device. Finally, the aggregation server performs a hash mapping on the second hash values of the multiple backup parameters to determine the historical parameter addresses of the multiple backup parameters. It should be noted that since the historical parameter address is used to indicate the storage location of the historical device parameters, the aggregation server can obtain the corresponding historical device parameters from the historical parameter address to obtain the historical device parameters of all the devices.

[0072] The aggregation server preprocesses the parameter backup set containing all the device parameters to obtain the historical device parameters corresponding to the target device, and then calculates the vector similarity between the latest global parameters of the target device and the historical device parameters to determine whether the performance of the current device is stable and can meet the requirements of the blockchain network for the performance of the target device in the edge computing scenario.

[0073] 202. Obtain the device parameters uploaded by the currently selected target device, and perform an aggregation operation on the device parameters to obtain global parameters.

[0074] In the embodiment of the present application, the selected target device downloads the latest global model for local training. After the training is completed, the training result is uploaded to the aggregation server, and the aggregation server performs an aggregation operation on the device parameters uploaded by the currently selected target device to obtain global parameters. The specific process of obtaining the global parameters is as follows:

[0075] First, the aggregation server obtains the device parameters uploaded by the currently selected target device, determines the dimension values corresponding to the device parameters, performs vector exponential operations on the device parameters, and obtains a vector matrix. It should be noted that the aggregation server needs to determine the vector dimension of the device parameters and, based on the vector dimension, determine the vector matrix of the target device. For example, for n participating device nodes, each participating node i obtains local model parameters ω through local data training i , if there are d dimensions in the device parameters, the entire device parameter matrix is expressed as:

[0076]

[0077] Subsequently, according to the data clustering algorithm, aggregation operations are performed on the vector matrix to obtain the aggregation operation result of the vector matrix, and the aggregation operation result is used as the global parameter of the target device. For example, if the currently selected i1 - i k a total of k target devices, after aggregation, the rows of the parameter matrix corresponding to i1 - i k are updated to the latest global parameters:

[0078]

[0079] It should be noted that the aggregation server needs to store the device parameters uploaded by the currently selected target device in the blockchain network so that the blockchain network can store a set containing all device parameters, that is, the parameter backup set. Specifically, the aggregation server obtains the device parameters uploaded by the target device, determines the parameter summary and parameter address of the device parameters. Among them, the parameter summary is used to indicate the device identity of the target device corresponding to the device parameters. Subsequently, based on the hash algorithm, hash operations are performed on the parameter summary and the parameter address to obtain the first hash value of the parameter summary and the second hash value of the parameter address. The first hash value and the second hash value are associated to generate a parameter backup, and the parameter backup is uploaded to the blockchain network to enable the blockchain network to update the parameter backup set. Finally, continuously count the time interval for obtaining the parameter backup set. When the time interval reaches the preset time interval, re-obtain the parameter backup set in the blockchain network, calculate the distance score of the target device, and select the target device with a distance score higher than the preset score for the next round of model training.

[0080] The aggregation server uploads the device parameters of this round to the blockchain network for backup, making it the historical device parameters of the next round, which are used to calculate the distance score between the next round of the latest global parameters. Based on the distance score, it is judged whether the target device can continue to be selected for model training. By continuously calculating the vector similarity between the latest device parameters and the original device parameters, select better-performing and more stable target devices to continue model training, eliminate useless target devices, and thus improve the efficiency and accuracy of model training.

[0081] 203. Calculate the distance score of the target device based on the global parameters and historical device parameters.

[0082] In the embodiment of the present application, after the aggregation server calculates the global parameters, it calculates the distance score of the target device based on the global parameters and historical device parameters, that is, the vector similarity between the current global parameters of the target device and the historical device parameters. The specific process of calculating the distance score is as follows:

[0083] First, calculate the cosine value between the global parameters and the historical device parameters to obtain the cosine similarity distance. The specific process of calculating the cosine similarity distance can be implemented based on the following formula 1:

[0084] Formula 1:

[0085] where w global is the global parameter of the target device parameters, and w i is the vector matrix of the target device parameters. In the actual application process, the aggregation server calculates the product w global ·w i of the global parameter and the vector matrix as the first product, calculates the product ||w global ||·||w i || of the modulus value of the global parameter and the modulus value of the vector matrix as the second product, and obtains the cosine similarity distance by calculating the ratio between the first product and the second product.

[0086] Subsequently, obtain the dimension value corresponding to the global parameter, calculate the exponential difference between the global parameter and each backup parameter in the parameter backup set to obtain multiple exponential differences. It should be noted that the exponential parameter in the exponential difference is calculated according to the changing dimension value. Then perform a summation operation on the multiple exponential differences to obtain the distance sum value. The specific process of the summation operation can be implemented based on the following formula 2:

[0087] Formula 2:

[0088] where d is the dimension value of the device parameters; j is the exponential parameter; the value range of j will change according to the change of d; calculate multiple exponential differences through .

[0089] Finally, calculate the first product of the cosine similarity distance and the preset parameter and the second product of the distance sum value and the preset parameter, calculate the sum value of the first product and the second product, and use the sum value as the distance score. The specific process of calculating the distance score can be implemented based on the following formula 3:

[0090] Formula 3: score(w global ,w i )=0.5*dis(w global,w i ) + 0.5 * cosθ

[0091] Among them, 0.5 is a preset parameter, which can be the default weight value of the system or set by the staff according to actual needs. In fact, the sum of the two preset parameters in Formula 3 is 1, and their values can be different. This application does not specifically limit the numerical size of the preset parameters.

[0092] The aggregation server obtains the distance score of the target device parameters by calculating the cosine similarity distance and the distance sum value between the global parameters and the historical device parameters, so that the aggregation server determines whether the target device can continue the next round of model training based on the distance score.

[0093] 204. Compare the distance score with the preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training.

[0094] In the embodiment of this application, the aggregation server will compare the distance score with the preset score, and determine whether the currently selected target device can continue the next round of model training based on the comparison result.

[0095] Specifically, compare the distance score with the score threshold to generate a comparison result. Among them, the score threshold can adopt the default value of the aggregation server or the value set by the relevant staff according to actual needs. This application does not specifically limit the size of the score threshold. If the comparison result indicates that the distance score is less than the score threshold, determine the target device corresponding to the distance score and prohibit the target device from entering the next update. If the comparison result indicates that the distance score is greater than or equal to the score threshold, specify the target device corresponding to the distance score for the next round of model training.

[0096] By comparing the calculated distance score with the preset score, it can be obtained whether the vector similarity between the current device parameters and the historical device parameters of the target device meets the preset conditions. If the vector similarity meets the preset conditions, the current target device can be selected to continue the next round of local training. If the vector similarity does not meet the preset conditions, it means that the performance stability of the target device is low and the performance difference from other devices is large, and it is prohibited from participating in the next round of model training.

[0097] The method provided by the embodiments of the present application requires first obtaining a parameter backup set in a blockchain network, performing data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices, then obtaining the device parameters obtained by the target device through local model training, and performing an aggregation operation on the device parameters to obtain global parameters. Next, based on the global parameters and the historical device parameters, the distance score of the target device is calculated. Finally, the distance score is compared with a preset score. If the distance score of the target device is higher than the score threshold, the target device is selected for the next round of model training. By calculating the distance score between the latest aggregation parameters of the target device and the historical device parameters corresponding to the target device in the parameter backup set on the blockchain, devices with scores higher than the average value are selected, that is, devices with better and more stable performance are selected for subsequent model training, avoiding useless devices from participating in model training, and improving the efficiency and accuracy of model training.

[0098] Further, as Figure 1 a specific implementation of the method, the embodiments of the present application provide a device selection device based on a blockchain, as Figure 3A shown. The device includes: a cleaning module 301, an obtaining module 302, a calculating module 303, and a comparing module 304.

[0099] The cleaning module 301 is configured to obtain a parameter backup set in a blockchain network, and perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices;

[0100] The obtaining module 302 is configured to obtain the device parameters uploaded by the currently selected target device, perform an aggregation operation on the device parameters to obtain global parameters, and the device parameters are the training parameters obtained by the target device through local model training;

[0101] The calculating module 303 is configured to calculate the distance score of the target device based on the global parameters and the historical device parameters;

[0102] The comparing module 304 is configured to compare the distance score with a preset score. If the distance score of the target device is higher than the score threshold, the target device is selected for the next round of model training.

[0103] In a specific application scenario, the cleaning module 301 is configured to obtain the parameter backup set in the blockchain network, identify the parameter backup set according to the data cleaning algorithm, and obtain multiple historical parameter backups. The multiple historical parameter backups include the first hash value of multiple historical parameter digests and the second hash value of multiple historical parameter addresses; identify the multiple historical parameter backups, divide the historical parameter backups with the same first hash value into the same device group to obtain multiple device groups; for each device group in the multiple device groups, extract one of the historical parameter backups as a backup parameter to obtain multiple backup parameters of the multiple device groups; perform a hash mapping on the second hash values of the multiple backup parameters to determine the historical parameter addresses of the multiple backup parameters, and obtain the corresponding historical device parameters from the historical parameter addresses to obtain the historical device parameters of all devices.

[0104] In a specific application scenario, the obtaining module 302 is configured to obtain the device parameters uploaded by the target device, determine the dimension value corresponding to the device parameters, perform a vector exponential operation on the device parameters to obtain a vector matrix, and the exponential parameter in the exponential operation is calculated according to the changing dimension value; perform an aggregation operation on the vector matrix according to the data clustering algorithm to obtain the aggregation operation result of the vector matrix, and use the aggregation operation result as the global parameter of the target device.

[0105] In a specific application scenario, as Figure 3B shown, the device further includes: a determination module 305, an operation module 306, a generation module 307, and a statistics module 308.

[0106] The determination module 305 is configured to obtain the device parameters uploaded by the currently selected target device, and determine the parameter digest and parameter address of the device parameters. The parameter digest is used to indicate the device identity of the target device corresponding to the device parameters;

[0107] The operation module 306 is configured to perform a hash operation on the parameter digest and the parameter address based on the hash algorithm to obtain the first hash value of the parameter digest and the second hash value of the parameter address;

[0108] The generation module 307 is configured to associate the first hash value and the second hash value to generate a parameter backup, and upload the parameter backup to the blockchain network so that the blockchain network updates the parameter backup set;

[0109] The statistical module 308 is used to continuously count the time interval for obtaining the parameter backup set. When the time interval reaches a preset time interval, it re-obtains the parameter backup set in the blockchain network, calculates the distance score of the target device, and selects the target device with a distance score higher than the preset score for the next round of model training.

[0110] In a specific application scenario, the calculation module 303 is used to calculate the cosine value between the global parameter and the historical device parameter to obtain a cosine similarity distance; obtain the dimension value corresponding to the global parameter, calculate the exponential difference between the global parameter and each backup parameter in the parameter backup set to obtain a plurality of exponential differences, where the exponential parameter in the exponential difference is calculated based on the changed dimension value; perform a summation operation on the plurality of exponential differences to obtain a distance sum value, calculate the first product of the cosine similarity distance and a preset parameter and the second product of the distance sum value and the preset parameter; calculate the sum value of the first product and the second product, and use the sum value as the distance score.

[0111] In a specific application scenario, the comparison module 304 is used to compare the distance score with the score threshold to generate a comparison result; if the comparison result indicates that the distance score is less than the score threshold, determine the target device corresponding to the distance score and prohibit the target device from entering the next update; if the comparison result indicates that the distance score is greater than or equal to the score threshold, specify the target device corresponding to the distance score for the next round of model training.

[0112] The device provided in the embodiment of the present application needs to first obtain a parameter backup set in the blockchain network, perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices, then obtain the device parameters obtained by the target device through local model training, and perform an aggregation operation on the device parameters to obtain global parameters. Next, based on the global parameters and the historical device parameters, calculate the distance score of the target device. Finally, compare the distance score with a preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training. By calculating the distance score between the latest aggregated parameters of the target device and the historical device parameters corresponding to the target device in the parameter backup set on the blockchain, devices with scores higher than the average value are selected, that is, devices with better and more stable performance are selected for subsequent model training, avoiding useless devices from participating in model training, and improving the efficiency and accuracy of model training.

[0113] It should be noted that for other corresponding descriptions of each functional unit involved in the device for selecting a device based on a blockchain provided in the embodiment of the present application, reference can be made to Figure 1 and Figure 2The corresponding description in [it] will not be elaborated here.

[0114] In an exemplary embodiment, referring to Figure 4 , a device is further provided. The device includes a bus, a processor, a memory, and a communication interface, and may further include an input / output interface and a display device. Among them, each functional unit can complete mutual communication through the bus. The memory stores a computer program, and the processor is configured to execute the program stored on the memory to execute the method for selecting a device based on a blockchain in the above embodiment.

[0115] A computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, the steps of the method for selecting a device based on a blockchain are implemented.

[0116] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by hardware or by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various implementation scenarios of the present application.

[0117] Those skilled in the art can understand that the drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the drawings are not necessarily essential for implementing the present application.

[0118] Those skilled in the art can understand that the modules in the device in the implementation scenario can be distributed in the device in the implementation scenario according to the description of the implementation scenario, or can be correspondingly changed to be located in one or more devices different from the present implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple sub-modules.

[0119] The above serial numbers of the present application are only for description and do not represent the advantages or disadvantages of the implementation scenarios.

[0120] The above discloses only several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be thought of by those skilled in the art should fall within the protection scope of the present application.

Claims

1. A device selection method based on blockchain, characterized in that, Including: Obtain a parameter backup set in the blockchain network, and perform data cleaning on the parameter backup set according to a data cleaning algorithm to obtain historical device parameters of all devices; Obtain device parameters uploaded by a currently selected target device, and perform an aggregation operation on the device parameters to obtain global parameters, where the device parameters are training parameters obtained by the target device through local model training; Based on the global parameters and the historical device parameters, calculate the cosine value between the global parameters and the historical device parameters to obtain a cosine similarity distance, obtain the dimension value corresponding to the global parameters, calculate the exponential difference between the global parameters and each backup parameter in the parameter backup set to obtain multiple exponential differences, and perform a summation operation on the multiple exponential differences to obtain a distance sum value. Calculate the first product of the cosine similarity distance and a preset parameter and the second product of the distance sum value and the preset parameter, calculate the sum value of the first product and the second product, and use the sum value as the distance score of the target device, where the exponential parameter in the exponential difference is calculated according to the changing dimension value; Compare the distance score with a preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training.

2. The method according to claim 1, wherein The step of obtaining a parameter backup set in the blockchain network and performing data cleaning on the parameter backup set according to a data cleaning algorithm to obtain historical device parameters of all devices includes: Obtain the parameter backup set in the blockchain network, and identify the parameter backup set according to the data cleaning algorithm to obtain multiple historical parameter backups, where the multiple historical parameter backups include the first hash value of multiple historical parameter summaries and the second hash value of multiple historical parameter addresses; Identify the multiple historical parameter backups, and divide the historical parameter backups with the same first hash value into the same device group to obtain multiple device groups; For each device group in the multiple device groups, extract one historical parameter backup as a backup parameter to obtain multiple backup parameters of the multiple device groups; Perform a hash mapping on the second hash value of the multiple backup parameters to determine the historical parameter addresses of the multiple backup parameters, and obtain the corresponding historical device parameters from the historical parameter addresses to obtain the historical device parameters of all devices.

3. The method according to claim 1, characterized in that The step of obtaining device parameters uploaded by a currently selected target device and performing an aggregation operation on the device parameters to obtain global parameters includes: Obtain the device parameters uploaded by the target device, determine the dimension value corresponding to the device parameters, and perform a vector exponential operation on the device parameters to obtain a vector matrix, where the exponential parameter in the exponential operation is calculated according to the changing dimension value; Perform an aggregation operation on the vector matrix according to a data clustering algorithm to obtain the aggregation operation result of the vector matrix, and use the aggregation operation result as the global parameters of the target device.

4. The method according to claim 1, wherein After obtaining the device parameters uploaded by the currently selected target device and performing an aggregation operation on the device parameters to obtain global parameters, the method further includes: Obtain the device parameters uploaded by the currently selected target device, and determine the parameter summary and parameter address of the device parameters. The parameter summary is used to indicate the device identity of the target device corresponding to the device parameters; Based on the hash algorithm, perform a hash operation on the parameter summary and the parameter address to obtain the first hash value of the parameter summary and the second hash value of the parameter address; Associate the first hash value and the second hash value to generate a parameter backup, and upload the parameter backup to the blockchain network so that the blockchain network updates the parameter backup set; Continuously count the time interval for obtaining the parameter backup set. When the time interval reaches the preset time interval, re-obtain the parameter backup set in the blockchain network, calculate the distance score of the target device, and select the target device with a distance score higher than the preset score for the next round of model training.

5. The method according to claim 1, wherein The comparing the distance score with the preset score and, if the distance score of the target device is higher than the score threshold, designating the target device for the next round of model training includes: Compare the distance score with the score threshold to generate a comparison result; If the comparison result indicates that the distance score is less than the score threshold, determine the target device corresponding to the distance score and prohibit the target device from entering the next update; If the comparison result indicates that the distance score is greater than or equal to the score threshold, designate the target device corresponding to the distance score for the next round of model training.

6. A device selection device based on blockchain, characterized in that, including: A cleaning module for obtaining a parameter backup set in the blockchain network and performing data cleaning on the parameter backup set according to a data cleaning algorithm to obtain the historical device parameters of all devices; An obtaining module for obtaining the device parameters uploaded by the currently selected target device and performing an aggregation operation on the device parameters to obtain global parameters. The device parameters are the training parameters obtained by the target device through local model training; A calculation module for calculating the cosine value between the global parameters and the historical device parameters based on the global parameters and the historical device parameters to obtain a cosine similarity distance, obtaining the dimension value corresponding to the global parameters, calculating the exponential difference between the global parameters and each backup parameter in the parameter backup set to obtain a plurality of exponential differences, and performing a summation operation on the plurality of exponential differences to obtain a distance sum value, calculating the first product of the cosine similarity distance and a preset parameter and the second product of the distance sum value and the preset parameter, calculating the sum value of the first product and the second product, and using the sum value as the distance score of the target device, where the exponential parameter in the exponential difference is calculated based on the changing dimension value; A comparison module, configured to compare the distance score with a preset score. If the distance score of the target device is higher than the score threshold, select the target device for the next round of model training.

7. The device according to claim 6, characterized in that, The cleaning module is configured to obtain the parameter backup set in the blockchain network, identify the parameter backup set according to the data cleaning algorithm, and obtain a plurality of historical parameter backups. The plurality of historical parameter backups include the first hash value of a plurality of historical parameter summaries and the second hash value of a plurality of historical parameter addresses. Identify the plurality of historical parameter backups, and divide the historical parameter backups with the same first hash value into the same device group to obtain a plurality of device groups. For each device group in the plurality of device groups, extract one of the historical parameter backups as a backup parameter to obtain a plurality of backup parameters for the plurality of device groups. Perform hash mapping on the second hash values of the plurality of backup parameters to determine the historical parameter addresses of the plurality of backup parameters, and obtain the corresponding historical device parameters at the historical parameter addresses to obtain the historical device parameters of all devices.

8. The device according to claim 6, characterized in that, The obtaining module is configured to obtain the device parameters uploaded by the target device, determine the dimension value corresponding to the device parameters, perform vector exponential operation on the device parameters to obtain a vector matrix, and the exponential parameter in the exponential operation is calculated according to the changing dimension value; perform aggregation operation on the vector matrix according to the data clustering algorithm to obtain the aggregation operation result of the vector matrix, and use the aggregation operation result as the global parameter of the target device.

9. The device according to claim 6, wherein The device further includes: A determination module, configured to obtain the device parameters uploaded by the currently selected target device, and determine the parameter summary and parameter address of the device parameters. The parameter summary is used to indicate the device identity of the target device corresponding to the device parameters. An operation module, configured to perform hash operation on the parameter summary and the parameter address based on the hash algorithm to obtain the first hash value of the parameter summary and the second hash value of the parameter address. A generation module, configured to associate the first hash value and the second hash value to generate a parameter backup, and upload the parameter backup to the blockchain network so that the blockchain network updates the parameter backup set. A statistics module, configured to continuously count the time interval for obtaining the parameter backup set. When the time interval reaches a preset time interval, re-obtain the parameter backup set in the blockchain network, calculate the distance score of the target device, and select the target device with the distance score higher than the preset score for the next round of model training.

10. The device according to claim 6, characterized in that, The comparison module is configured to compare the distance score with the score threshold to generate a comparison result; if the comparison result indicates that the distance score is less than the score threshold, determine the target device corresponding to the distance score and prohibit the target device from entering the next update; if the comparison result indicates that the distance score is greater than or equal to the score threshold, specify the target device corresponding to the distance score for the next round of model training.

11. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Edge device scheduling method, system and device and computer storage medium

    CN109918205A

  • Method and device for estimating optimal value of equipment parameter

    CN112686389A