WO2024001806A1 - 一种基于联邦学习的数据价值评估方法及其相关设备 - Google Patents

一种基于联邦学习的数据价值评估方法及其相关设备 Download PDF

Info

Publication number
WO2024001806A1
WO2024001806A1 PCT/CN2023/100395 CN2023100395W WO2024001806A1 WO 2024001806 A1 WO2024001806 A1 WO 2024001806A1 CN 2023100395 W CN2023100395 W CN 2023100395W WO 2024001806 A1 WO2024001806 A1 WO 2024001806A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
clients
trained
current round
server
Prior art date
Application number
PCT/CN2023/100395
Other languages
English (en)
French (fr)
Inventor
吴超
唐作其
卢嘉勋
邵云峰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024001806A1 publication Critical patent/WO2024001806A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/20Ensemble learning

Definitions

  • the embodiments of this application relate to the technical field of artificial intelligence (AI), and in particular to a data value assessment method based on federated learning and related equipment.
  • AI artificial intelligence
  • a federated learning system usually includes a server and multiple clients.
  • the server can combine multiple clients to train a certain neural network model for multiple rounds.
  • the server first sends the model to be trained to each client.
  • Each client device can update the parameters of the model to be trained based on the locally stored training data, and determine the parameter update amount of the model to be trained by each client in the current round.
  • each client can upload its own parameter updates of the model to be trained in the current round to the server.
  • the server updates the parameters of the model to be trained based on the parameter updates of the model to be trained by each client in the current round (that is, the server implements aggregation) to obtain the updated model.
  • the server can also unite multiple clients to conduct the next round of training on the updated model.
  • the server can perform the data value evaluation (data valuation) of the current round on the client, that is, the server can perform data evaluation based on the client’s performance in the current round.
  • the parameter update amount of the model to be trained is used to calculate the data value of the client in the current round and is used to describe the contribution of the client in the training of the current round.
  • the server since the number of clients is often large, the server requires a large amount of calculations when evaluating data value, resulting in high calculation costs.
  • the embodiments of this application provide a data value assessment method and related equipment based on federated learning, which can effectively reduce the amount of calculations performed by the server when conducting data value assessment, thereby saving calculation costs.
  • the first aspect of the embodiment of this application provides a data value assessment method based on federated learning, which method includes:
  • the server can first deliver the model to be trained to P clients (P is a positive integer greater than 1). For any one of the P clients, after receiving the model to be trained from the server, the client can use local data to train the model to be trained, thereby updating the parameters of the model to be trained to obtain the updated model. . Then, the client can calculate the difference between the parameters of the model to be trained and the parameters of the updated model, and the difference is the parameter update amount of the model to be trained by the client in the current round. In the same way, other clients among the P clients, except this client, can also perform the same operations as that performed on this client, so the parameter update amount of the model to be trained by the P clients in the current round can be obtained. After that, the server can randomly select M clients among the P clients (M is a positive integer less than P), so that the M clients update the parameters of the training model that the M clients are treating in the current round. , upload to the server.
  • P is a positive integer greater than 1
  • the server can use the clustering algorithm to process the parameter update amount of the model to be trained by the M clients in the current round, thereby dividing these
  • the parameter update amount is divided into N categories (N is a positive integer less than or equal to M).
  • N is a positive integer less than or equal to M.
  • any category contains at least one of the M clients that treated the training model in the previous round.
  • the amount of parameter updates is equivalent to the server successfully dividing M clients into N categories.
  • any category contains at least one client among the M clients.
  • the server can also perform the same operation as for the i-th category, so the server can get the data value of the N categories in the current round, that is, M The data value of each client in the current round, therefore, the contribution of M clients in the current round of model training can be determined.
  • the server can update M based on the parameter updates of the M clients to be trained in the current round.
  • Clients are divided into N categories.
  • the server can process the parameter update amount of the target client in the current round of the model to be trained in the category, obtain the data value of the target client in the current round, and The data value of the target client in the current round is used as the data value of all clients in the category in the current round.
  • the server can also perform the same operations as for this category, so the data value of M clients in the current round can be obtained.
  • obtaining the data value of the target client in the current round includes: based on M clients
  • the parameter updates of the model to be trained by the S clients in the current round are updated to obtain the first model.
  • the S clients do not include the target client; based on the number of T clients among the M clients.
  • the parameter update amount of the model to be trained in the current round is updated to obtain the second model.
  • the T clients include the target client and S clients; based on the accuracy of the first model and the accuracy of the second model, Calculate the target client's data value in the current round.
  • the server can select S clients among the M clients except the target client, and select S clients in the current In each round, a weighted sum is performed on the updated parameters of the model to be trained, and then the parameters of the model to be trained are updated based on the result of the weighted sum, thereby obtaining the first model.
  • the server can regard the S clients and the target client as a whole, that is, T clients, and perform a weighted calculation of the parameter updates of the model to be trained by the T clients in the current round. and, then update the parameters of the model to be trained based on the result of the weighted sum, thereby obtaining the second model.
  • the server can use a batch of test data to test the accuracy of the first model and the accuracy of the second model. Then, the server can be based on The accuracy of the first model and the accuracy of the second model are used to calculate the data value of the target client of the i-th category in the current round. In this way, the data value of all clients in the i-th category in the current round can be obtained.
  • the target client of the i-th category can be selected in the following way: (1) The server can randomly select a client as the i-th category from all clients of the i-th category. Category of target clients. (2) The server can select the client located at the cluster center of the i-th category as the target client of the i-th category from all the clients of the i-th category.
  • the method after obtaining the data value of the target client in the current round based on the parameter update amount of the target client in the i-th category of the training model in the current round, the method also includes: Based on the data value of the M clients in the current round and the parameter updates of the model to be trained by the M clients in the current round, the model to be trained is updated to obtain an updated model.
  • the server can calculate the data value of the M clients in the current round and the values of the training model treated by the M clients in the current round. Calculate the parameter update amount, and use the calculation results to update the model to be trained to obtain an updated model.
  • the model to be trained is updated to obtain the updated
  • the model includes: taking the data values of the M clients in the current round as the weights of the M clients, and performing a weighted calculation of the weights of the M clients and the parameter updates of the model to be trained by the M clients in the current round. and, the weighted summation result is obtained; based on the weighted summation result, the model to be trained is updated to obtain the updated model.
  • the server can use the data value of the M clients in the current round as the weights of the M clients, and use these weights to evaluate the M clients.
  • the client performs a weighted sum on the parameter updates of the model to be trained in the current round, thereby obtaining the corresponding weighted sum result.
  • the server can use the weighted summation result to update the parameters of the model to be trained, thereby obtaining an updated model. It can be seen that when the server performs a weighted summation of the parameter updates of the model to be trained by the M clients in the current round, the weight used is the data value of the M clients in the current round.
  • the method after obtaining the data value of the target client in the current round based on the parameter update amount of the target client in the i-th category of the training model in the current round, also includes: Based on the data values of the M clients in the previous round and the parameter updates of the model to be trained by the M clients in the current round, the model to be trained is updated to obtain an updated model.
  • the server after obtaining the data value of the M clients in the current round, the server can retain the data value of the M clients in the current round for use in the next round. Then, the server can calculate the data value of the M clients in the previous round and the parameter update amount of the M clients in the current round of the model to be trained, and use the calculation results to update the model to be trained. Get the updated model.
  • the model to be trained is updated based on the data value of the M clients in the previous round and the parameter update amount of the model to be trained by the M clients in the current round.
  • the model to be trained is updated to obtain an updated model.
  • the server can retain the data value of the M clients in the current round for use in the next round.
  • the server can use the data values of the M clients in the previous round as the weights of the M clients to use these weights to calculate the weighted parameter updates of the model to be trained by the M clients in the current round. and, thereby obtaining the corresponding weighted summation result. Then, the server can use the weighted summation result to update the parameters of the model to be trained, thereby obtaining an updated model. It can be seen that when the server performs a weighted summation of the parameter updates of the model to be trained by M clients in the current round, the weight used is the data value of the M clients in the previous round. Since These data values can indicate the contributions made by M clients in the previous round.
  • the N categories can be obtained through at least one of the following: K-means clustering algorithm or hierarchical agglomerative clustering algorithm.
  • the second aspect of the embodiment of the present application provides a data value assessment device based on federated learning.
  • the device includes: a first acquisition module, used to acquire the parameter update amount of the model to be trained by M clients in the current round;
  • the division module is used to divide the M clients into N categories based on the parameter updates of the model to be trained by the M clients in the current round, M ⁇ N>1;
  • the second acquisition module is used to divide the M clients into N categories based on the i-th
  • the parameter update amount of the target client in the current round of the training model in each category is obtained, and the data value of the target client in the current round is obtained as all data values in the i-th category.
  • the server can update M parameters based on the parameter update amount of the model to be trained by the M clients in the current round.
  • Clients are divided into N categories.
  • the server can process the parameter update amount of the target client in the current round of the model to be trained in the category, obtain the data value of the target client in the current round, and The data value of the target client in the current round is used as the data value of all clients in the category in the current round.
  • the server can also perform the same operations as for this category, so the data value of M clients in the current round can be obtained.
  • the second acquisition module is used to: update the model to be trained based on the parameter update amount of the model to be trained by S clients among the M clients in the current round, and obtain the first model , S clients do not include the target client; based on the parameter update amount of the model to be trained by T clients among the M clients in the current round, the model to be trained is updated to obtain the second model, and the T clients include The target client and S clients; based on the accuracy of the first model and the accuracy of the second model, calculate the data value of the target client in the current round.
  • the target client is any client in the i-th category, or a client in the cluster center in the i-th category.
  • the device further includes: an update module, configured to update the data of the M clients in the current round based on The data value in and the parameter update amount of the model to be trained by the M clients in the current round are updated to obtain the updated model.
  • the update module is used to: use the data values of the M clients in the current round as the weights of the M clients, and calculate the weights of the M clients and the values of the M clients in the current round.
  • a weighted sum is performed on the parameter updates of the model to be trained to obtain a weighted summation result; based on the weighted summation result, the model to be trained is updated to obtain an updated model.
  • the device further includes: an update module, configured to update the parameters of the model to be trained by the M clients in the current round based on the data value of the M clients in the previous round, Update the model to be trained to obtain the updated model.
  • the update module is used to: use the data values of the M clients in the previous round as the weights of the M clients, and calculate the weights of the M clients and the current values of the M clients.
  • the parameter updates of the model to be trained are weighted and summed to obtain the weighted summation result; based on the weighted summation result, the model to be trained is updated to obtain the updated model.
  • the N categories can be obtained through at least one of the following: K-means clustering algorithm or hierarchical agglomerative clustering algorithm.
  • a third aspect of the embodiment of the present application provides a server, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code.
  • the server executes the first aspect Or the method described in any possible implementation manner in the first aspect.
  • the fourth aspect of the embodiments of this application provides a federated learning system, which includes multiple clients and the server as described in the third aspect.
  • a fifth aspect of the embodiments of the present application provides a computer storage medium.
  • the computer storage medium stores a computer program.
  • the program When the program is executed by a computer, the computer implements the rights as may be achieved in the first aspect or any one of the first aspects. method as described.
  • a sixth aspect of the embodiments of the present application provides a computer program product.
  • the computer program product stores instructions. When the instructions are executed by a computer, the computer implements the first aspect or any one of the first aspects that may be implemented. method as described.
  • the server can update the parameters of the model to be trained by the M clients in the current round.
  • Clients are divided into N categories.
  • the server can process the parameter update amount of the target client in the current round of the model to be trained in the category, obtain the data value of the target client in the current round, and The data value of the target client in the current round is used as the data value of all clients in the category in the current round.
  • the server can also perform the same operations as for this category, so the data value of M clients in the current round can be obtained.
  • Figure 1 is a structural schematic diagram of the main framework of artificial intelligence
  • Figure 2 is a schematic structural diagram of the federated learning system provided by the embodiment of this application.
  • Figure 3 is a schematic diagram of the architecture of the system 100 provided by the embodiment of the present application.
  • Figure 4 is a schematic diagram of an application example of the federated learning system provided by the embodiment of this application.
  • Figure 5 is a schematic diagram of another application example of the federated learning system provided by the embodiment of this application.
  • Figure 6 is a schematic diagram of another application example of the federated learning system provided by the embodiment of this application.
  • Figure 7 is a schematic flow chart of the data value assessment method based on federated learning provided by the embodiment of this application.
  • Figure 8 is a schematic diagram of an application example of the data value assessment method based on federated learning provided by the embodiment of the present application.
  • Figure 9 is a schematic flow chart of the model training method provided by the embodiment of the present application.
  • Figure 10 is another schematic flow chart of the model training method provided by the embodiment of the present application.
  • Figure 11 is a schematic structural diagram of a data value assessment device based on federated learning provided by an embodiment of the present application.
  • Figure 12 is a schematic structural diagram of an execution device provided by an embodiment of the present application.
  • Figure 13 is a schematic structural diagram of the training equipment provided by the embodiment of the present application.
  • Figure 14 is a schematic structural diagram of a chip provided by an embodiment of the present application.
  • the embodiments of this application provide a data value assessment method and related equipment based on federated learning, which can effectively reduce the amount of calculations performed by the server when conducting data value assessment, thereby saving calculation costs.
  • a federated learning system usually includes a server and multiple clients.
  • the server can combine multiple clients to train a certain neural network model for multiple rounds.
  • the server first sends the model to be trained to each client.
  • each client device can input the locally stored training data into the model to be trained, obtain the processing results of the training data, and update the parameters of the model to be trained based on the results.
  • each client can update the model before and after based on the results. parameters to determine the parameter update amount of each client to be trained on the model in the current round.
  • each client can upload its own parameter updates of the model to be trained in the current round to the server.
  • the server updates the parameters of the model to be trained based on the parameter updates of the model to be trained by each client in the current round (that is, the server implements aggregation) to obtain the updated model.
  • the server can also join multiple clients to conduct the next round of training on the updated model. Until multiple rounds of training are completed, certain data processing functions (such as image classification, semantic segmentation, etc.) can be obtained. , speech recognition, etc.) target model.
  • the server can perform the data value evaluation (data valuation) of the current round on the client, that is, the server can perform data evaluation based on the client’s performance in the current round.
  • the parameter update amount of the model to be trained is used to calculate the data value of the client in the current round and is used to describe the contribution of the client in the training of the current round.
  • the server can obtain the data value of multiple clients in the current round, thereby confirming the contributions made by these multiple clients in the training of the current round (when the server delivers the final data to the model user)
  • the model user can pay corresponding fees to each client through the server based on the comprehensive data value of each client in multiple rounds of model training).
  • the number of clients is often large, when the server evaluates the data value of multiple clients, the number of data value calculations required is equal to the number of multiple clients, and the amount of calculation required is very large, resulting in The computational cost required is high.
  • the server when the server performs aggregation, it often first performs a weighted sum of the parameter updates of the model to be trained by multiple clients in the current round, and then uses the weighted sum. The results are used to update the parameters of the model to be trained.
  • the server when the server performs weighted summation, the weights used are often artificially preset, and the client is not differentiated. Few factors are considered.
  • the results obtained by performing weighted summation in this way are It is often impossible to weaken the role of some unimportant clients and strengthen the role of some important clients. The performance of the model obtained based on this result is usually not strong enough.
  • embodiments of the present application provide a data value assessment method based on federated learning.
  • This method can be implemented in conjunction with artificial intelligence (artificial intelligence, AI) technology.
  • AI technology is a technical discipline that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence. AI technology obtains the best results by perceiving the environment, acquiring knowledge and using knowledge.
  • artificial intelligence technology is a branch of computer science that attempts to understand the nature of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence.
  • Using artificial intelligence for data processing is a common application method of artificial intelligence.
  • Figure 1 is a structural schematic diagram of the main framework of artificial intelligence.
  • the following is from the “intelligent information chain” (horizontal axis) and “IT value chain” (vertical axis)
  • the above artificial intelligence theme framework is elaborated on in two dimensions.
  • the "intelligent information chain” reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has gone through the condensation process of "data-information-knowledge-wisdom".
  • the "IT value chain” reflects the value that artificial intelligence brings to the information technology industry, from the underlying infrastructure of human intelligence and information (providing and processing technology implementation) to the systematic industrial ecological process.
  • Infrastructure provides computing power support for artificial intelligence systems, enables communication with the external world, and supports it through basic platforms.
  • computing power is provided by smart chips (hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA, etc.);
  • the basic platform includes distributed computing framework and network and other related platform guarantees and support, which can include cloud storage and Computing, interconnection networks, etc.
  • sensors communicate with the outside world to obtain data, which are provided to smart chips in the distributed computing system provided by the basic platform for calculation.
  • Data from the upper layer of the infrastructure is used to represent data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, and text, as well as IoT data of traditional devices, including business data of existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
  • machine learning and deep learning can perform symbolic and formal intelligent information modeling, extraction, preprocessing, training, etc. on data.
  • Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formal information to perform machine thinking and problem solving based on reasoning control strategies. Typical functions are search and matching.
  • Decision-making refers to the process of decision-making after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
  • some general capabilities can be formed based on the results of further data processing, such as algorithms or a general system, such as translation, text analysis, computer vision processing, speech recognition, and image processing. identification, etc.
  • Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of overall artificial intelligence solutions, productizing intelligent information decision-making and realizing practical applications. Its application fields mainly include: intelligent terminals, intelligent transportation, Smart healthcare, autonomous driving, smart cities, etc.
  • FIG. 2 is a schematic structural diagram of a federated learning system provided by an embodiment of the present application.
  • the federated learning system includes a server and multiple clients, both of which can be connected through a communication network.
  • the client includes smart terminals such as mobile phones, personal computers, or information processing centers.
  • the server can be a device or server with data processing functions such as a cloud server, network server, application server, and management server.
  • the client and server can collaborate to achieve Training of neural network models.
  • each client can receive the model to be trained from the server through the interactive interface, and then perform machine learning and deep learning on the model to be trained through the memory that stores local data and the processor that processes the data. , model training in search, reasoning, decision-making, etc.
  • model training in search, reasoning, decision-making, etc.
  • each client After each client completes model training (that is, the parameters of the model to be trained are updated), it can upload the updated model obtained in the first round to the server, so that the server can update the parameters of each client in the first round.
  • the updated models obtained in each round are aggregated, and the local model to be trained on the server is trained based on the aggregation results.
  • the server can use the updated model obtained by itself in the first round as a new model to be trained, and send it to each client again to perform the second round of model training (that is, repeat the aforementioned process).
  • the server determines that the updated model it obtained in the last round meets the model training conditions, it can use the updated model it obtained in the last round.
  • the model is used as the trained model (it can also be called the target model, that is, the model that has completed training).
  • the server not only indirectly uses the local data of each client to complete model training, but also ensures the data security of each client, thereby protecting the user's personal privacy.
  • each client can update the parameters of the training model in that round (representing the parameters obtained by each client in that round). the updated model) and upload it to the server. Then, the server can perform a weighted sum of the parameter updates of the model to be trained by each client in this round, and then update the local parameters of the model to be trained on the server based on the weighted sum of the parameter updates, as follows: Updated model. At this point, the server and each client have jointly completed this round of model training.
  • the server can also treat training in that round based on each client.
  • the parameter update amount of the model is used to evaluate the data value of each client in this round, that is, the value of the local data used by each client in the model training of this round, which can be used to describe the value of each client in this round. contribution to model training.
  • the server performs a weighted summation of the parameter updates of the model to be trained by each client in this round, the weight used can be determined based on the data value of each client in this round (it can also be based on Each client's data value in the previous round is determined, etc.). It should be noted that the process of obtaining data value and the subsequent application process of data value will not be discussed here.
  • the server can execute the data value evaluation method according to the embodiment of the present application, and the server and the client can jointly implement the model training method according to the embodiment of the present application.
  • the server obtains the trained model and has data processing functions, so the model can be deployed on each client. Therefore, each client can provide data processing services for users.
  • a client obtains the data to be processed from the user input, it can call the trained model to process the data to be processed input by the user accordingly, and provide the user with the data to be processed. Return the corresponding processing results.
  • the client can use the trained model finally obtained by the server in the embodiment of the present application to implement the data processing function.
  • Figure 3 is a schematic diagram of the architecture of the system 100 provided by the embodiment of the present application.
  • the execution device 110 is configured with an input/output (I/O) interface 112 for data interaction with external devices.
  • the user Data can be input to the I/O interface 112 through the client device 140.
  • the input data may include: various to-be-scheduled tasks, callable resources, and other parameters.
  • the execution device 110 When the execution device 110 preprocesses the input data, or when the calculation model 111 of the execution device 110 performs calculation and other related processing (such as implementing the function of the neural network in this application), the execution device 110 can call the data storage system 150
  • the data, codes, etc. in the system can be used for corresponding processing, and the data, instructions, etc. obtained by corresponding processing can also be stored in the data storage system 150 .
  • the I/O interface 112 returns the processing results to the client device 140, thereby providing them to the user.
  • the training device 120 can generate corresponding target models/rules based on different training data for different goals or different tasks, and the corresponding target models/rules can be used to achieve the above goals or complete the above tasks. , thereby providing users with the desired results.
  • the training data may be stored in the database 130 and come from training samples collected by the data collection device 160 .
  • the user can manually enter the input data, and the manual setting can be operated through the interface provided by the I/O interface 112 .
  • the client device 140 can automatically send input data to the I/O interface 112. If requiring the client device 140 to automatically send input data requires the user's authorization, the user can set corresponding permissions in the client device 140.
  • the user can view the results output by the execution device 110 on the client device 140, and the specific presentation form may be display, sound, action, etc.
  • the client device 140 can also be used as a data collection end to collect the input data of the input I/O interface 112 and the output results of the output I/O interface 112 as new sample data, and store them in the database 130 .
  • the I/O interface 112 directly uses the input data input to the I/O interface 112 and the output result of the output I/O interface 112 as a new sample as shown in the figure.
  • the data is stored in database 130.
  • Figure 3 is only a schematic diagram of a system architecture provided by an embodiment of the present application.
  • the positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • the data The storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 can also be placed in the execution device 110.
  • the neural network can be trained according to the training device 120.
  • the training device 120 usually refers to the aforementioned server, and the execution device 110 generally refers to the aforementioned client.
  • the training device 120 can cooperate with the execution device 110 to implement model training, that is, Both can implement model training in a federated learning manner.
  • An embodiment of the present application also provides a chip, which includes a neural network processor NPU.
  • the chip can be disposed in the execution device 110 as shown in FIG. 3 to complete the calculation work of the calculation model 111.
  • the chip can also be installed in the training device 120 as shown in Figure 3 to complete the training work of the training device 120 and output the target model/rules.
  • Neural network processor NPU is mounted on the main central processing unit (CPU) (host CPU) as a co-processor, and the main CPU allocates tasks.
  • the core part of the NPU is the arithmetic circuit.
  • the controller controls the arithmetic circuit to extract the data in the memory (weight memory or input memory) and perform operations.
  • the computing circuit includes multiple processing units (PE).
  • the arithmetic circuit is a two-dimensional systolic array.
  • the arithmetic circuit may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition.
  • the arithmetic circuit is a general-purpose matrix processor.
  • the arithmetic circuit fetches the corresponding data of matrix B from the weight memory and caches it on each PE in the arithmetic circuit.
  • the operation circuit takes matrix A data and matrix B from the input memory to perform matrix operations, and the partial result or final result of the obtained matrix is stored in the accumulator (accumulator).
  • the vector calculation unit can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc.
  • the vector computing unit can be used for network calculations in non-convolutional/non-FC layers in neural networks, such as pooling, batch normalization, local response normalization, etc.
  • the vector computation unit can store the processed output vector into a unified buffer.
  • the vector calculation unit may apply a nonlinear function to the output of the arithmetic circuit, such as a vector of accumulated values, to generate activation values.
  • the vector computation unit generates normalized values, merged values, or both.
  • the processed output vector can be used as an activation input to an arithmetic circuit, such as for use in a subsequent layer in a neural network.
  • Unified memory is used to store input data and output data.
  • the weight data directly transfers the input data in the external memory to the input memory and/or the unified memory through the storage unit access controller (direct memory access controller, DMAC), stores the weight data in the external memory into the weight memory, and transfers the weight data to the unified memory.
  • DMAC direct memory access controller
  • the bus interface unit (BIU) is used to realize the interaction between the main CPU, DMAC and instruction memory through the bus.
  • the instruction fetch buffer connected to the controller is used to store instructions used by the controller
  • the controller is used to call instructions cached in the memory to control the working process of the computing accelerator.
  • the unified memory, input memory, weight memory and instruction memory are all on-chip memories, and the external memory is the memory outside the NPU.
  • the external memory can be double data rate synchronous dynamic random access memory (double data). rate synchronous dynamic random access memory (DDR SDRAM), high bandwidth memory (high bandwidth memory (HBM)) or other readable and writable memory.
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • HBM high bandwidth memory
  • FIG. 4 is a schematic diagram of an application example of the federated learning system provided by the embodiment of this application.
  • the federated learning system can Applied to the field of smart home, at this time, multiple clients in the system are smart home devices located in multiple homes, and these multiple homes are located in different geographical locations. These multiple smart home devices can communicate with the server in the cloud (i.e., the server) to achieve federated learning.
  • the server in the cloud can implement multiple rounds of model training with multiple smart home devices.
  • each smart home device can receive the model to be trained from the server, update the parameters of the model to be trained through local voice data, and upload the updated model to the server.
  • the server aggregates the updated models uploaded by each smart home device, so as to train the server's local to-be-trained model based on the aggregation results.
  • the server can use the updated model obtained by its own training as a new model to be trained, and send it to each smart home device again to perform the second round of model training (that is, repeat the aforementioned process).
  • the server determines that the updated model obtained by its last round of training meets the model training conditions, it can use the updated model obtained by its last round of training as a capable
  • the neural network model that implements the speech recognition function is deployed on various smart home devices to provide smart home services for each family.
  • FIG. 5 is a schematic diagram of another application example of the federated learning system provided by the embodiment of this application.
  • the federated learning system can be applied in the teaching field.
  • multiple clients in the system are located in multiple schools.
  • teaching equipment for example, personal computers, tablets, etc.
  • these multiple schools are located in different geographical locations.
  • These multiple teaching devices can communicate with the solver developer's server (i.e., the server) to achieve federated learning.
  • the solver developer's server can implement multiple rounds of model training with multiple teaching devices.
  • each teaching device can receive the model to be trained from the server, update the parameters of the model to be trained using local mathematical data, and upload the updated model to the server.
  • This allows the server to aggregate the updated models uploaded by each teaching device, so as to train a local model to be trained on the server based on the aggregation results.
  • the server can use the updated model obtained by its own training as a new model to be trained, and deliver it to each teaching device again to perform the second round of model training (ie, repeat the aforementioned process).
  • the server determines that the updated model obtained by its last round of training meets the model training conditions, it can use the updated model obtained by its last round of training as the solution
  • the server is deployed on various teaching equipment to provide teaching services to students and teachers in various schools.
  • FIG. 6 is a schematic diagram of another application example of the federated learning system provided by the embodiment of the present application.
  • the federated learning system can be applied in the field of software services.
  • multiple clients in the system are located in multiple Intelligent terminal equipment used by users or enterprises.
  • These multiple intelligent terminal devices can communicate with the remote software developer's server (i.e., the server) to achieve federated learning.
  • each smart terminal device can implement multiple rounds of model training with multiple smart terminal devices.
  • each smart terminal device can receive the model to be trained from the server, update the parameters of the model to be trained using local image data, and upload the updated model to the server.
  • the server aggregates the updated models uploaded by each intelligent terminal device, so as to train the server's local to-be-trained model based on the aggregation results.
  • the server can use the updated model obtained by its own training as a new model to be trained, and again deliver it to each smart terminal device to perform the second round of model training (ie, repeat the aforementioned process).
  • the server After the server has determined that the updated model obtained in the last round of training meets the model training conditions, it can use the updated model obtained in the last round of training as image processing software and deploy it to each smart terminal.
  • image processing services are provided for businesses and individuals.
  • the federated learning system can be applied to the smart home field, teaching field and software service field.
  • the federated learning system provided by the embodiments of the present application can also be applied to more fields. I won’t introduce them one by one here.
  • the neural network can be composed of neural units.
  • the neural unit can refer to an arithmetic unit that takes xs and intercept 1 as input.
  • the output of the arithmetic unit can be:
  • s 1, 2,...n, n is a natural number greater than 1
  • Ws is the weight of xs
  • b is the bias of the neural unit.
  • f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of this activation function can be used as the input of the next convolutional layer.
  • the activation function can be a sigmoid function.
  • a neural network is a network formed by connecting many of the above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit.
  • the input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field.
  • the local receptive field can be an area composed of several neural units.
  • W is a weight vector, and each value in the vector represents the weight value of a neuron in the neural network of this layer.
  • This vector W determines the spatial transformation from the input space to the output space described above, that is, the weight W of each layer controls how to transform the space.
  • the purpose of training a neural network is to finally obtain the weight matrix of all layers of the trained neural network (a weight matrix formed by the vector W of many layers). Therefore, the training process of neural network is essentially to learn how to control spatial transformation, and more specifically, to learn the weight matrix.
  • loss function loss function
  • objective function object function
  • the neural network can use the error back propagation (BP) algorithm to modify the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, forward propagation of the input signal until the output will produce an error loss, and the parameters in the initial neural network model are updated by backpropagating the error loss information, so that the error loss converges.
  • the backpropagation algorithm is a backpropagation movement dominated by error loss, aiming to obtain the optimal parameters of the neural network model, such as the weight matrix.
  • Federated learning is a machine learning technology used to protect user privacy.
  • the structure of federated learning generally includes a server (central server) and some clients as participants.
  • the technical process mainly includes model distribution and model aggregation processes.
  • the client downloads the model from the server and trains it on local data. After training to a certain extent, the client uploads the model to the server.
  • the server collects the models uploaded by each client and performs model fusion. These two processes will be iterated repeatedly until the model converges, thereby obtaining a trained model.
  • Federated aggregation is a sub-process of federated learning.
  • the main task of the server in federated learning is to aggregate the models uploaded by the client, that is, the process of the server merging multiple models into one model in federated learning.
  • Parameter point-to-point aggregation is the simplest federated aggregation method. This method requires that the models uploaded by multiple clients have the same structure, and the server can average the parameters of neurons at the same position in multiple models.
  • the data value assessment method based on federated learning provided by this application will be described below.
  • This method can be implemented through the federated learning system shown in Figure 2. Since the system will perform multiple rounds of model training, in any round During model training, the server can randomly select M clients (M is a positive integer less than P) from P clients (P is a positive integer greater than 1), and then based on the M clients in this round The parameter update amount of the training model is used to evaluate the data value of M clients in this round. Subsequently, the model training of this round can be completed based on the data value of M clients in this round (of course, also This round of model training can be completed through the data value of M clients in the previous round).
  • FIG. 7 is a schematic flow chart of the data value assessment method based on federated learning provided by the embodiment of the present application. As shown in Figure 7, the method includes:
  • the server obtains the parameter updates of the model to be trained by the M clients in the current round.
  • the server may first deliver the model to be trained to P clients in the client resource pool.
  • the client can use local data to train the model to be trained, thereby updating the parameters of the model to be trained to obtain the updated model.
  • the client can input local data into the model to be trained to process the local data through the model to be trained, thereby obtaining the processing results of the local data. Therefore, the client can update the data to be processed based on the processing results of the local data. parameters of the trained model to obtain the updated model).
  • the client can calculate the difference between the parameters of the model to be trained and the parameters of the updated model, and the difference is the parameter update amount of the model to be trained by the client in the current round.
  • the parameter update amount of the model being trained by P clients in the current round can be obtained.
  • the server can randomly select M clients among the P clients, so that the M clients upload the parameter updates of the model to be trained by the M clients in the current round to the server.
  • the server divides the M clients into N categories based on the parameter updates of the model to be trained by the M clients in the current round, M ⁇ N>1.
  • the server can use a clustering algorithm (for example, K-means clustering algorithm, hierarchical agglomerative clustering algorithm, etc.) to update the parameters of the M clients in the current round.
  • a clustering algorithm for example, K-means clustering algorithm, hierarchical agglomerative clustering algorithm, etc.
  • the parameter updates of the model to be trained are processed, thereby dividing these parameter updates into N categories (N is a positive integer less than or equal to M). Among these N categories, any category contains M The amount of parameter updates for the model being trained by at least one of the clients in the previous round.
  • the server can calculate the cosine similarity between the parameter updates of the model being trained by any two clients in the current round, This determines whether the parameter update amounts of the two clients to be trained in the current round can be classified into the same category.
  • the cosine similarity between the parameter updates of any two clients to be trained in the current round can be calculated by the following formula:
  • t is the current round
  • a is the a-th client
  • b is the b-th client
  • the server can calculate the cosine between the parameter updates of any two clients on the training model in the current round. Similarity. If the cosine similarity is greater than or equal to the preset similarity threshold, the server will classify the parameter updates of the two clients to be trained in the current round into the same category. If the cosine similarity is less than the preset similarity threshold, the server divides the parameter updates of the two clients to be trained in the current round into different categories.
  • the server can successfully divide the parameter updates of the M clients to be trained in the current round into N categories, which is equivalent to the server successfully dividing the M clients into N categories.
  • N any category contains at least one client among the M clients.
  • the server can select one client from all clients included in the i-th category as the representative of the i-th category, that is, the target client of the i-th category.
  • the target client of the i-th category can be selected in the following manner: (1) The server can randomly select a client from all clients of the i-th category as the target client of the i-th category. (2) The server can select the client located at the cluster center of the i-th category as the target client of the i-th category from all the clients of the i-th category.
  • the server can calculate the parameter update amount of the target client of the i-th category for the model to be trained in the current round, and obtain the target client of the i-th category in the current round.
  • Secondary data value Since the target client of the i-th category is the representative of the i-th category, the data value of the target client of the i-th category in the current round can be used as the data value of (all clients of) the i-th category in the current round.
  • Secondary data value Specifically, the data value of the i-th category target client in the current round can be obtained in the following way:
  • the server can select S clients among the M clients except the target client. It can be seen that the server selected S clients do not include the target client. Then, the server can perform a weighted sum of the parameter updates of the model to be trained by the S clients in the current round, and then update the parameters of the model to be trained based on the result of the weighted sum, thereby obtaining the first model.
  • the server can regard the S clients and the target client as a whole, that is, T clients. It can be seen that the T clients obtained by the server include the target client and S clients. Then, the server can perform a weighted sum of the parameter updates of the model to be trained by the T clients in the current round, and then update the parameters of the model to be trained based on the result of the weighted sum, thereby obtaining the second model.
  • the server can use a batch of test data to test the accuracy of the first model and the accuracy of the second model. Then, the server can calculate the data value of the target client in the current round based on the accuracy of the first model and the accuracy of the second model.
  • the data value of the target client in the current round can be calculated by the following formula:
  • i is the target client in the i-th category
  • C t is M clients
  • is the number of M clients
  • S is S clients
  • is S The number of clients
  • S ⁇ i ⁇ is T clients
  • v(S) is the accuracy of the first model
  • v(S ⁇ i ⁇ ) is the accuracy of the second model.
  • the server can obtain the data value of the target client in the i-th category in the current round, that is, the data value of all clients in the i-th category in the current round is obtained.
  • the server can also perform the same operation as for the i-th category, so the server can get the data value of the N categories in the current round, that is, M
  • M The data value of each client in the current round, therefore, the contribution of M clients in the current round of model training can be determined.
  • the server can record the data value of P clients in each round. Then, after getting M After determining the data value of the client in the current round, the server can use the data value of the remaining PM clients in the previous round as the data value of the PM clients in the current round. In this way, the server can successfully obtain and record the data value of P clients in the current round.
  • Figure 8 is a schematic diagram of an application example of the data value assessment method based on federated learning provided by the embodiment of this application. As shown in Figure 8, the application example includes:
  • the server delivers the model to be trained to the client resource pool, and all clients in the client resource pool can use local data to train the model to be trained.
  • the server can select multiple clients at once from all clients in the client resource pool.
  • the server can cluster these multiple clients, thereby clustering several similar clients into one category, thereby obtaining multiple categories.
  • the server can select a representative client. Then, by calculating the data value of the client, the server can obtain the data value of all clients in the category.
  • the server can update the parameters of the model to be trained by the M clients in the current round.
  • Clients are divided into N categories.
  • the server can process the parameter update amount of the target client in the current round of the model to be trained in the category, obtain the data value of the target client in the current round, and The data value of the target client in the current round is used as the data value of all clients in the category in the current round.
  • the server can also perform the same operations as for this category, so the data value of M clients in the current round can be obtained.
  • Figure 9 is a schematic flow chart of the model training method provided by the embodiment of the present application. As shown in Figure 9, the method includes:
  • the server obtains the parameter update amount of the model to be trained by the M clients in the current round.
  • the server divides the M clients into N categories based on the parameter updates of the model to be trained by the M clients in the current round, M ⁇ N>1.
  • steps 901 to 903 For an introduction to steps 901 to 903, reference may be made to the relevant descriptions of steps 701 to 703 in the embodiment shown in FIG. 7 , which will not be described again here.
  • the server can use the data value of the M clients in the current round as the weights of the M clients, and use these weights to evaluate the data value of the M clients in the current round. How to treat the training model
  • the parameter update amounts are weighted and summed to obtain the corresponding weighted summation result.
  • the server can use the weighted summation result to update the parameters of the model to be trained, thereby obtaining an updated model.
  • the server can first standardize the data values of the M clients in the current round, thereby obtaining the standardized data values of the M clients in the current round.
  • the standardization process is as shown in the following formula. :
  • the server can calculate the standardized data value of the M clients in the current round and the parameter updates of the model to be trained by the M clients in the current round, and obtain a weighted summation result, which can be obtained by Obtained by the following formula:
  • the server can use the weighted summation result to update the parameters of the model to be trained, thereby obtaining an updated model.
  • the server and M clients have jointly completed the current round of model training.
  • the server can use the updated model as a new model to be trained and deliver it to the client resource pool, so as to download the model.
  • One round of model training is performed until multiple rounds of model training are completed and the target model is obtained.
  • the weight used is M clients
  • the data value of the client in the current round Since these data values can indicate the contribution of M clients in the current round, the client with a larger contribution (more important) has a larger weight and a larger contribution. Small (less important) clients have smaller weights.
  • the result of weighted summation in this way can weaken the role of some unimportant clients and strengthen the role of some important clients.
  • the model trained based on this result can have better performance.
  • Figure 10 is another schematic flowchart of a model training method provided by an embodiment of the present application. As shown in Figure 10, the method includes:
  • the server obtains the parameter updates of the model to be trained by the M clients in the current round.
  • the server divides the M clients into N categories based on the parameter updates of the model to be trained by the M clients in the current round, M ⁇ N>1.
  • step 1001 to step 1003 please refer to the corresponding steps from step 701 to step 703 in the embodiment shown in Figure 7. Regarding the explanation part, I won’t go into details here.
  • the server can retain the data value of M clients in the current round for use in the next round. Then, the server can obtain the data value of the M clients in the previous round, and use the data value of the M clients in the previous round as the weights of the M clients to use these weights to evaluate the M clients. The end performs a weighted sum of the parameter updates of the model to be trained in the current round, thereby obtaining the corresponding weighted summation result. Then, the server can use the weighted summation result to update the parameters of the model to be trained, thereby obtaining an updated model. Specifically, the server can first standardize the data values of the M clients in the previous round, thereby obtaining the standardized data values of the M clients in the previous round. The standardization process is as follows: Shown:
  • the server can calculate the standardized data value of the M clients in the previous round and the parameter update amount of the M clients to be trained in the current round to obtain a weighted summation result, which can be Obtained through the following formula:
  • the server can use the weighted summation result to update the parameters of the model to be trained, thereby obtaining an updated model.
  • the server and M clients have jointly completed the current round of model training.
  • the server can use the updated model as a new model to be trained and deliver it to the client resource pool, so as to download the model.
  • One round of model training is performed until multiple rounds of model training are completed and the target model is obtained.
  • the weight used is M clients
  • the data value of the client in the previous round Since these data values can indicate the contributions made by M clients in the previous round, clients with larger contributions (more important) have a larger weight. Clients with smaller contributions (less important) have smaller weights.
  • the result of weighted summation in this way can weaken the role of some unimportant clients and strengthen some important clients.
  • the model trained based on this result can have better performance.
  • Figure 11 is a schematic structural diagram of a data value assessment device based on federated learning provided by an embodiment of the present application. As shown in Figure 11, the device is deployed in the server. Devices include:
  • the first acquisition module 1101 is used to acquire the parameter update amount of the model to be trained by M clients in the current round;
  • the dividing module 1102 is used to divide the M clients into N categories based on the parameter updates of the model to be trained by the M clients in the current round, M ⁇ N>1;
  • the second acquisition module 1103 is used to obtain the data value of the target client in the current round based on the parameter update amount of the model to be trained by the target client in the current round in the i-th category.
  • the target client is in the current round.
  • the server can update the parameters of the model to be trained by the M clients in the current round.
  • Clients are divided into N categories.
  • the server can process the parameter update amount of the target client in the current round of the model to be trained in the category, obtain the data value of the target client in the current round, and The data value of the target client in the current round is used as the data value of all clients in the category in the current round.
  • the server can also perform the same operations as for this category, so the data value of M clients in the current round can be obtained.
  • the second acquisition module is used to: update the model to be trained based on the parameter update amount of the model to be trained by S clients among the M clients in the current round, and obtain the first model , S clients do not include the target client; based on the parameter update amount of the model to be trained by T clients among the M clients in the current round, the model to be trained is updated to obtain the second model, and the T clients include The target client and S clients; based on the accuracy of the first model and the accuracy of the second model, calculate the data value of the target client in the current round.
  • the target client is any client in the i-th category, or a client in the cluster center in the i-th category.
  • the device further includes: an update module, configured to update the parameters of the model to be trained based on the data values of the M clients in the current round and the M clients in the current round, Update the model to be trained to obtain the updated model.
  • an update module configured to update the parameters of the model to be trained based on the data values of the M clients in the current round and the M clients in the current round, Update the model to be trained to obtain the updated model.
  • the update module is used to: use the data values of the M clients in the current round as the weights of the M clients, and calculate the weights of the M clients and the values of the M clients in the current round.
  • a weighted sum is performed on the parameter updates of the model to be trained to obtain a weighted summation result; based on the weighted summation result, the model to be trained is updated to obtain an updated model.
  • the device further includes: an update module, configured to update the parameters of the training model based on the data values of the M clients in the previous round and the M clients in the current round, Update the model to be trained to obtain the updated model.
  • an update module configured to update the parameters of the training model based on the data values of the M clients in the previous round and the M clients in the current round, Update the model to be trained to obtain the updated model.
  • the update module is used to: use the data values of the M clients in the previous round as the weights of the M clients, and calculate the weights of the M clients and the current values of the M clients.
  • the parameter updates of the model to be trained are weighted and summed to obtain the weighted summation result; based on the weighted summation result, the model to be trained is updated. Get the updated model.
  • the N categories can be obtained through at least one of the following: K-means clustering algorithm or hierarchical agglomerative clustering algorithm.
  • FIG. 12 is a schematic structural diagram of the execution device provided by the embodiment of the present application.
  • the execution device 1200 can be embodied as a mobile phone, a tablet, a laptop, a smart wearable device, a server, etc., and is not limited here.
  • the client shown in Figure 2 can be deployed on the execution device 1200 to jointly implement the model training function in the corresponding embodiment of Figure 9 or Figure 10 in conjunction with subsequent training equipment.
  • the execution device 1200 includes: a receiver 1201, a transmitter 1202, a processor 1203 and a memory 1204 (the number of processors 1203 in the execution device 1200 may be one or more, one processor is taken as an example in Figure 12) , wherein the processor 1203 may include an application processor 12031 and a communication processor 12032.
  • the receiver 1201, the transmitter 1202, the processor 1203, and the memory 1204 may be connected through a bus or other means.
  • Memory 1204 may include read-only memory and random access memory and provides instructions and data to processor 1203 .
  • a portion of memory 1204 may also include non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 1204 stores processor and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, where the operating instructions may include various operating instructions for implementing various operations.
  • the processor 1203 controls the execution of operations of the device.
  • various components of the execution device are coupled together through a bus system.
  • the bus system may also include a power bus, a control bus, a status signal bus, etc.
  • various buses are called bus systems in the figure.
  • the methods disclosed in the above embodiments of the present application can be applied to the processor 1203 or implemented by the processor 1203.
  • the processor 1203 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 1203 .
  • the above-mentioned processor 1203 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (ASIC), a field programmable Gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field-programmable gate array
  • the processor 1203 can implement or execute the various methods, steps and logical block diagrams disclosed in the embodiments of this application.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the memory 1204.
  • the processor 1203 reads the information in the memory 1204 and completes the steps of the above method in combination with its hardware.
  • the receiver 1201 may be configured to receive input numeric or character information and generate signal inputs related to performing relevant settings and functional controls of the device.
  • the transmitter 1202 can be used to output numeric or character information through the first interface; the transmitter 1202 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1202 can also include a display device such as a display screen .
  • the processor 1203 can be used to implement the model training method in the corresponding embodiment of Figure 9 or Figure 10, and can also be used to obtain the target model obtained through the corresponding embodiment of Figure 9 or Figure 10 , to implement corresponding data processing functions.
  • FIG. 13 is a schematic structural diagram of the training device provided by the embodiment of the present application.
  • the training device 1300 may include the server shown in Figure 2.
  • the training device 1300 may be implemented by one or more servers.
  • the training device 1300 may vary greatly due to different configurations or performance, and may include one or more servers.
  • One or more central processing units (CPU) 1314 e.g., one or more processors
  • memory 1332 e.g., one or more mass storage devices
  • storage media 1330 e.g., one or more mass storage devices
  • the memory 1332 and the storage medium 1330 may be short-term storage or persistent storage.
  • the program stored in the storage medium 1330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processor 1314 may be configured to communicate with the storage medium 1330 and execute a series of instruction operations in the storage medium 1330 on the training device 1300 .
  • the training device 1300 may also include one or more power supplies 1326, one or more wired or wireless network interfaces 1350, one or more input and output interfaces 1358; or, one or more operating systems 1341, such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • operating systems 1341 such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • the training device can execute the data value evaluation method in the embodiment corresponding to Figure 7, and the training device can combine with the aforementioned execution device to jointly execute the model training method in the embodiment corresponding to Figure 9 or Figure 10.
  • Embodiments of the present application also relate to a computer storage medium.
  • the computer-readable storage medium stores a program for performing signal processing.
  • the program When the program is run on a computer, it causes the computer to perform the steps performed by the aforementioned execution device, or, The computer is caused to perform the steps performed by the aforementioned training device.
  • Embodiments of the present application also relate to a computer program product that stores instructions that, when executed by a computer, cause the computer to perform the steps performed by the foregoing execution device, or cause the computer to perform the steps performed by the foregoing training device. A step of.
  • the execution device, training device or terminal device provided by the embodiment of the present application may specifically be a chip.
  • the chip includes: a processing unit and a communication unit.
  • the processing unit may be, for example, a processor.
  • the communication unit may be, for example, an input/output interface. Pins or circuits, etc.
  • the processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment.
  • the storage unit is a storage unit within the chip, such as a register, cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device, such as Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), etc.
  • ROM Read-only memory
  • RAM random access memory
  • Figure 14 is a schematic structural diagram of a chip provided by an embodiment of the present application.
  • the chip can be represented as a neural network processor NPU 1400.
  • the NPU 1400 serves as a co-processor and is mounted to the host CPU (Host CPU). ), tasks are allocated by the Host CPU.
  • the core part of the NPU is the arithmetic circuit 1403.
  • the arithmetic circuit 1403 is controlled by the controller 1404 to extract the matrix data in the memory and perform multiplication operations.
  • the computing circuit 1403 internally includes multiple processing units (Process Engine, PE).
  • arithmetic circuit 1403 is a two-dimensional systolic array.
  • the arithmetic circuit 1403 may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition.
  • arithmetic circuit 1403 is general matrix processor.
  • the arithmetic circuit obtains the corresponding data of matrix B from the weight memory 1402 and caches it on each PE in the arithmetic circuit.
  • the operation circuit takes matrix A data and matrix B from the input memory 1401 to perform matrix operations, and the partial result or final result of the matrix is stored in an accumulator (accumulator) 1408 .
  • the unified memory 1406 is used to store input data and output data.
  • the weight data directly passes through the storage unit access controller (Direct Memory Access Controller, DMAC) 1405, and the DMAC is transferred to the weight memory 1402.
  • Input data is also transferred to unified memory 1406 via DMAC.
  • DMAC Direct Memory Access Controller
  • BIU is the Bus Interface Unit, that is, the bus interface unit 1613, which is used for the interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1409.
  • IFB Instruction Fetch Buffer
  • the bus interface unit 1613 (Bus Interface Unit, BIU for short) is used to fetch the memory 1409 to obtain instructions from the external memory, and is also used for the storage unit access controller 1405 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • BIU Bus Interface Unit
  • DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 1406 or the weight data to the weight memory 1402 or the input data to the input memory 1401 .
  • the vector calculation unit 1407 includes multiple arithmetic processing units, and if necessary, further processes the output of the arithmetic circuit 1403, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of predicted label planes, etc.
  • vector calculation unit 1407 can store the processed output vectors to unified memory 1406 .
  • the vector calculation unit 1407 can apply a linear function; or a nonlinear function to the output of the operation circuit 1403, such as linear interpolation on the prediction label plane extracted by the convolution layer, or a vector of accumulated values, to generate an activation value.
  • vector calculation unit 1407 generates normalized values, pixel-wise summed values, or both.
  • the processed output vector can be used as an activation input to the arithmetic circuit 1403, such as for use in a subsequent layer in a neural network.
  • the instruction fetch buffer 1409 connected to the controller 1404 is used to store instructions used by the controller 1404;
  • the unified memory 1406, input memory 1401, weight memory 1402 and instruction fetch memory 1409 are all On-Chip memories. External memory is private to the NPU hardware architecture.
  • the processor mentioned in any of the above places can be a general central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of the above programs.
  • the device embodiments described above are only illustrative.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physically separate.
  • the physical unit can be located in one place, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • the connection relationship between modules indicates that there are communication connections between them, which can be specifically implemented as one or more communication buses or signal lines.
  • the computer software product is stored in a readable storage medium, such as a computer floppy disk. , U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including several instructions to cause a computer device (which can be a personal computer, training device, or network device, etc.) to execute the steps described in various embodiments of this application. method.
  • a computer device which can be a personal computer, training device, or network device, etc.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, the computer instructions may be transferred from a website, computer, training device, or data
  • the center transmits to another website site, computer, training equipment or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means.
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that a computer can store, or a data storage device such as a training device or a data center integrated with one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state disk (Solid State Disk, SSD)), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

本申请实施例公开了一种基于联邦学习的数据价值评估方法及其相关设备,可有效减少服务端进行数据价值评估时所付出的计算量。本申请的方法包括:在获取M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别。对于N个类别中的任意一个类别,服务端可对该类别中目标客户端在当前轮次中对待训练模型的参数更新量进行处理,得到目标客户端在当前轮次中的数据价值,并将目标客户端在当前轮次中的数据价值作为该类别中所有客户端在当前轮次中的数据价值。对于其余类别,服务端也可执行如同对该类别所执行的操作,故可得到M个客户端在当前轮次中的数据价值。

Description

一种基于联邦学习的数据价值评估方法及其相关设备
本申请要求于2022年6月28日提交中国专利局、申请号为202210743272.5、发明名称为“一种基于联邦学习的数据价值评估方法及其相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及人工智能(artificial intelligence,AI)技术领域,尤其涉及一种基于联邦学习的数据价值评估方法及其相关设备。
背景技术
随着用户不断增强的数据安全意识,以及用户的个人隐私数据被频繁泄漏等数据安全问题的出现,使得用户不断提高对涉及个人隐私的数据的保护力度,进而给AI技术的模型训练提出了新的挑战。因此,联邦学习(federated learning)这一模型训练方式应运而生。
联邦学习系统通常包含服务端和多个客户端,服务端可联合多个客户端,来对某个神经网络模型进行多轮次的训练。在进行当前轮次的训练时,服务端先下发待训练模型给各个客户端。各个客户端设备可基于存储在本地的训练数据来更新待训练模型的参数,并确定各个客户端在当前轮次中对待训练模型的参数更新量。然后,各个客户端可将自身在当前轮次中对待训练模型的参数更新量上传至服务端。最后,服务端基于各个客户端在当前轮次中对待训练模型的参数更新量来更新待训练模型的参数(即服务端实现聚合),以得到更新后的模型。此后,服务端还可联合多个客户端,来对更新后的模型进行下一轮次的训练。
在当前轮次的训练中,对于多个客户端中的任意一个客户端,服务端可对该客户端进行当前轮次的数据价值评估(data valuation),即服务端基于该客户端在当前轮次中对待训练模型的参数更新量,来计算客户端在当前轮次中的数据价值,用于描述该客户端在当前轮次中的训练中所作出的贡献。然而,由于客户端的数量往往较多,服务端在进行数据价值评估时,所需的计算量很大,导致所需付出的计算成本很高。
发明内容
本申请实施例提供了一种基于联邦学习的数据价值评估方法及其相关设备,可有效减少服务端进行数据价值评估时所付出的计算量,从而节约计算成本。
本申请实施例的第一方面提供了一种基于联邦学习的数据价值评估方法,该方法包括:
在当前轮次的模型训练中,服务端可先向P个客户端下发待训练模型(P为大于1的正整数)。对于P个客户端中的任意一个客户端而言,该客户端在接收到来自服务端的待训练模型后,可使用本地数据对待训练模型进行训练,从而更新待训练模型的参数得到更新后的模型。那么,该客户端可计算待训练模型的参数以及更新后的模型的参数之间的差值,该差值即为该客户端在当前轮次中对待训练模型的参数更新量。同理,P个客户端中除该客户端的其余客户端,也可执行如同对该客户端所执行的操作,故可得到P个客户端在当前轮次中对待训练模型的参数更新量。此后,服务端可在P个客户端中随机选择M个客户端(M为小于P的正整数),以使得M个客户端将M个客户端在当前轮次中对待训练模型的参数更新量,上传 到服务端。
得到M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可使用聚类算法,将M个客户端在当前轮次中对待训练模型的参数更新量进行处理,从而将这些参数更新量划分为N个类别(N为小于或等于M的正整数),在这N个类别中,任意一个类别包含M个客户端中的至少一个客户端在前轮次中对待训练模型的参数更新量,相当于服务端成功将M个客户端划分为N个类别,在这N个类别中,任意一个类别包含M个客户端中的至少一个客户端。
将M个客户端划分为N个类别后,对于这N个类别中的任意一个类别,即N个类别中的第i个类别(i=1,...,N),服务端可从第i个类别的所有客户端中,选定一个客户端作为第i个类别的目标客户端。随后,服务端可对第i个类别的目标客户端在当前轮次中对待训练模型的参数更新量进行计算,得到第i个类别的目标客户端在当前轮次中的数据价值,该数据价值可作为第i个类别中所有客户端在当前轮次中的数据价值。对于N个类别除第i个类别之外的其余类别,服务端也可执行如同对第i个类别所执行的操作,故服务端可得到N个类别在当前轮次中的数据价值,即M个客户端在当前轮次中的数据价值,故可确定M个客户端在当前轮次的模型训练中所付出的贡献。
从上述方法可以看出:在获取M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别。对于N个类别中的任意一个类别,服务端可对该类别中目标客户端在当前轮次中对待训练模型的参数更新量进行处理,得到目标客户端在当前轮次中的数据价值,并将目标客户端在当前轮次中的数据价值作为该类别中所有客户端在当前轮次中的数据价值。对于其余类别,服务端也可执行如同对该类别所执行的操作,故可得到M个客户端在当前轮次中的数据价值。可见,在当前轮次的模型训练中,服务端将M个客户端分成N个类别后,对于N个类别中的任意一个类别,服务端仅需进行一次数据价值计算就可以得到该类别中所有客户端在当前轮次中的数据价值,故对于N个类别,服务端总共仅需进行N次数据价值计算就可以得到M个客户端在当前轮次中的数据价值,由于N通常小于M,故可有效减少服务端进行数据价值评估时所付出的计算量,从而节约计算成本。
在一种可能实现的方式中,基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值包括:基于M个客户端中S个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到第一模型,S个客户端不包含目标客户端;基于M个客户端中T个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到第二模型,T个客户端包含目标客户端以及S个客户端;基于第一模型的精度以及第二模型的精度,计算目标客户端在当前轮次中的数据价值。前述实现方式中,确定第i个类别的目标客户端后,服务端可在M个客户端中除目标客户端之外的其余客户端中选择S个客户端,并对S个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,再基于加权求和的结果来对待训练模型的参数进行更新,从而得到第一模型。得到第一模型后,服务端可将S个客户端以及目标客户端视为一个整体,即T个客户端,并对T个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,再基于加权求和的结果来对待训练模型的参数进行更新,从而得到第二模型。得到第一模型和第二模型后,服务端可利用一批测试数据,来测试第一模型的精度以及第二模型的精度。那么,服务端可基于 第一模型的精度以及第二模型的精度,计算第i个类别的目标客户端在当前轮次中的数据价值。如此一来,则可以得到第i个类别中所有客户端在当前轮次中的数据价值。
在一种可能实现的方式中,第i个类别的目标客户端可通过以下方式进行选取:(1)服务端可从第i个类别的所有客户端中,随机选择一个客户端作为第i个类别的目标客户端。(2)服务端可从第i个类别的所有客户端中,将位于第i个类别的聚类中心的客户端作为第i个类别的目标客户端。
在一种可能实现的方式中,基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值之后,该方法还包括:基于M个客户端在当前轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。前述实现方式中,得到M个客户端在当前轮次中的数据价值后,服务端可对M个客户端在当前轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量进行计算,并利用计算结果来对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,基于M个客户端在当前轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型包括:以M个客户端在当前轮次中的数据价值作为M个客户端的权重,并对M个客户端的权重以及M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;基于加权求和结果,对待训练模型进行更新,得到更新后的模型。前述实现方式中,得到M个客户端在当前轮次中的数据价值后,服务端可将M个客户端在当前轮次中的数据价值作为M个客户端的权重,并利用这些权重对M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,从而得到相应的加权求和结果。然后,服务端可利用该加权求和结果来更新待训练模型的参数,从而得到更新后的模型。由此可见,服务端在对M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和时,所使用的权重是M个客户端在当前轮次中的数据价值,由于这些数据价值可表明M个客户端在当前轮次中所付出的贡献,故贡献较大的客户端所占的权重较大,贡献较小的客户端所占的权重较小,以这种方式进行加权求和所得到的结果,可以弱化一些不重要的客户端所发挥的作用,强化一些重要的客户端所发挥的作用,基于此结果训练得到的模型,可以具备较好的性能。
在一种可能实现的方式中,基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值之后,该方法还包括:基于M个客户端在前一轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。前述实现方式中,得到M个客户端在当前轮次中的数据价值后,服务端可保留M个客户端在当前轮次中的数据价值,以在下一轮次中使用。接着,服务端可对M个客户端在前一轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量进行计算,并利用计算结果来对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,基于M个客户端在前一轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型包括:以M个客户端在前一轮次中的数据价值作为M个客户端的权重,并对M个客户端的权重以及M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;基 于加权求和结果,对待训练模型进行更新,得到更新后的模型。前述实现方式中,得到M个客户端在当前轮次中的数据价值后,服务端可保留M个客户端在当前轮次中的数据价值,以在下一轮次中使用。接着,服务端可将M个客户端在前一轮次中的数据价值作为M个客户端的权重,以利用这些权重对M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,从而得到相应的加权求和结果。然后,服务端可利用该加权求和结果来更新待训练模型的参数,从而得到更新后的模型。由此可见,服务端在对M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和时,所使用的权重是M个客户端在前一轮次中的数据价值,由于这些数据价值可表明M个客户端在前一轮次中所付出的贡献,故贡献较大的客户端所占的权重较大,贡献较小的客户端所占的权重较小,以这种方式进行加权求和所得到的结果,可以弱化一些不重要的客户端所发挥的作用,强化一些重要的客户端所发挥的作用,基于此结果训练得到的模型,可以具备较好的性能。
在一种可能实现的方式中,N个类别可通过以下至少一项获取:K均值聚类算法或层次凝聚聚类算法。
本申请实施例的第二方面提供了一种基于联邦学习的数据价值评估装置,该装置包括:第一获取模块,用于获取M个客户端在当前轮次中对待训练模型的参数更新量;划分模块,用于基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别,M≥N>1;第二获取模块,用于基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值,目标客户端在当前轮次中的数据价值作为第i个类别中所有客户端在当前轮次中的数据价值,i=1,...,N。
从上述装置可以看出:在获取M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别。对于N个类别中的任意一个类别,服务端可对该类别中目标客户端在当前轮次中对待训练模型的参数更新量进行处理,得到目标客户端在当前轮次中的数据价值,并将目标客户端在当前轮次中的数据价值作为该类别中所有客户端在当前轮次中的数据价值。对于其余类别,服务端也可执行如同对该类别所执行的操作,故可得到M个客户端在当前轮次中的数据价值。可见,在当前轮次的模型训练中,服务端将M个客户端分成N个类别后,对于N个类别中的任意一个类别,服务端仅需进行一次数据价值计算就可以得到该类别中所有客户端在当前轮次中的数据价值,故对于N个类别,服务端总共仅需进行N次数据价值计算就可以得到M个客户端在当前轮次中的数据价值,由于N通常小于M,故可有效减少服务端进行数据价值评估时所付出的计算量,从而节约计算成本。
在一种可能实现的方式中,第二获取模块,用于:基于M个客户端中S个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到第一模型,S个客户端不包含目标客户端;基于M个客户端中T个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到第二模型,T个客户端包含目标客户端以及S个客户端;基于第一模型的精度以及第二模型的精度,计算目标客户端在当前轮次中的数据价值。
在一种可能实现的方式中,目标客户端为第i个类别中任意一个客户端,或,第i个类别中位于聚类中心的客户端。
在一种可能实现的方式中,该装置还包括:更新模块,用于基于M个客户端在当前轮次 中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,更新模块,用于:以M个客户端在当前轮次中的数据价值作为M个客户端的权重,并对M个客户端的权重以及M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;基于加权求和结果,对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,该装置还包括:更新模块,用于基于M个客户端在前一轮次的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,更新模块,用于:以M个客户端在前一轮次中的数据价值作为M个客户端的权重,并对M个客户端的权重以及M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;基于加权求和结果,对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,N个类别可通过以下至少一项获取:K均值聚类算法或层次凝聚聚类算法。
本申请实施例的第三方面提供了一种服务端,该服务端包括存储器和处理器;存储器存储有代码,处理器被配置为执行代码,当代码被执行时,服务端执行如第一方面或第一方面中任意一种可能实现的方式所述的方法。
本申请实施例的第四方面提供了一种联邦学习系统,该系统包含多个客户端以及如第三方面所述的服务端。
本申请实施例的第五方面提供了一种计算机存储介质,计算机存储介质存储有计算机程序,该程序由计算机执行时,使得计算机实施权利如第一方面或第一方面中任意一种可能实现的方式所述的方法。
本申请实施例的第六方面提供了一种计算机程序产品,计算机程序产品存储有指令,所述指令在由计算机执行时,使得计算机实施如第一方面或第一方面中任意一种可能实现的方式所述的方法。
本申请实施例中,在获取M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别。对于N个类别中的任意一个类别,服务端可对该类别中目标客户端在当前轮次中对待训练模型的参数更新量进行处理,得到目标客户端在当前轮次中的数据价值,并将目标客户端在当前轮次中的数据价值作为该类别中所有客户端在当前轮次中的数据价值。对于其余类别,服务端也可执行如同对该类别所执行的操作,故可得到M个客户端在当前轮次中的数据价值。可见,在当前轮次的模型训练中,服务端将M个客户端分成N个类别后,对于N个类别中的任意一个类别,服务端仅需进行一次数据价值计算就可以得到该类别中所有客户端在当前轮次中的数据价值,故对于N个类别,服务端总共仅需进行N次数据价值计算就可以得到M个客户端在当前轮次中的数据价值,由于N通常小于M,故可有效减少服务端进行数据价值评估时所付出的计算量,从而节约计算成本。
附图说明
图1为人工智能主体框架的一种结构示意图;
图2为本申请实施例提供的联邦学习系统的一个结构示意图;
图3为本申请实施例提供的系统100架构的一个示意图;
图4为本申请实施例提供的联邦学习系统的一个应用例示意图;
图5为本申请实施例提供的联邦学习系统的另一个应用例示意图;
图6为本申请实施例提供的联邦学习系统的另一个应用例示意图;
图7为本申请实施例提供的基于联邦学习的数据价值评估方法的一个流程示意图;
图8为本申请实施例提供的基于联邦学习的数据价值评估方法的一个应用例示意图;
图9为本申请实施例提供的模型训练方法的一个流程示意图;
图10为本申请实施例提供的模型训练方法的另一流程示意图;
图11为本申请实施例提供的基于联邦学习的数据价值评估装置的一个结构示意图;
图12为本申请实施例提供的执行设备的一个结构示意图;
图13为本申请实施例提供的训练设备的一个结构示意图;
图14为本申请实施例提供的芯片的一个结构示意图。
具体实施方式
本申请实施例提供了一种基于联邦学习的数据价值评估方法及其相关设备,可有效减少服务端进行数据价值评估时所付出的计算量,从而节约计算成本。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。
随着用户不断增强的数据安全意识,以及用户的个人隐私数据被频繁泄漏等数据安全问题的出现,使得用户不断提高对涉及个人隐私的数据的保护力度,进而给AI技术的模型训练提出了新的挑战。因此,联邦学习(federated learning)这一模型训练方式应运而生。
联邦学习系统通常包含服务端和多个客户端,服务端可联合多个客户端,来对某个神经网络模型进行多轮次的训练。在进行当前轮次的训练时,服务端先下发待训练模型给各个客户端。接着,各个客户端设备可将存储在本地的训练数据输入待训练模型,得到训练数据的处理结果,并基于该结果来更新待训练模型的参数,那么,各个客户端可基于待训练模型更新前后的参数来确定各个客户端在当前轮次中对待训练模型的参数更新量。然后,各个客户端可将自身在当前轮次中对待训练模型的参数更新量上传至服务端。最后,服务端基于各个客户端在当前轮次中对待训练模型的参数更新量来更新待训练模型的参数(即服务端实现聚合),以得到更新后的模型。此后,服务端还可联合多个客户端,来对更新后的模型进行下一轮次的训练,直至完成多轮次的训练,可得到具备某种数据处理功能(例如,图像分类、语义分割、语音识别等等)的目标模型。
在当前轮次的训练中,对于多个客户端中的任意一个客户端,服务端可对该客户端进行当前轮次的数据价值评估(data valuation),即服务端基于该客户端在当前轮次中对待训练模型的参数更新量,来计算客户端在当前轮次中的数据价值,用于描述该客户端在当前轮次中的训练中所作出的贡献。如此一来,服务端可得到多个客户端在当前轮次中的数据价值,从而确认这多个客户端在当前轮次中的训练中所作出的贡献(当服务端向模型使用方交付最终训练得到的目标模型后,模型使用方可基于各个客户端在多轮次的模型训练中的综合数据价值,通过服务端向各个客户端支付相应的费用)。然而,由于客户端的数量往往较多,服务端在对多个客户端进行数据价值评估时,所需进行的数据价值计算的次数等于多个客户端的数量,所需要的计算量很大,导致所需付出的计算成本很高。
进一步地,在当前轮次中的训练中,服务端在执行聚合时,往往是先将多个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,再使用加权求和的结果来更新待训练模型的参数。然而,服务端在进行加权求和时,所使用的权重往往是人为预置的,并未对客户端进行区分,所考虑的因素较少,以这种方式进行加权求和所得到的结果,往往无法弱化一些不重要的客户端所发挥的作用,强化一些重要的客户端所发挥的作用,基于此结果所得到的模型,其性能通常不够强。
为了解决上述问题,本申请实施例提供了一种基于联邦学习的数据价值评估方法,该方法,该方法可结合人工智能(artificial intelligence,AI)技术实现。AI技术是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能的技术学科,AI技术通过感知环境、获取知识并使用知识获得最佳结果。换句话说,人工智能技术是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式做出反应的智能机器。利用人工智能进行数据处理是人工智能常见的一个应用方式。
首先对人工智能系统总体工作流程进行描述,请参见图1,图1为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。
(1)基础设施
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。
(2)数据
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。
(3)数据处理
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。
(4)通用能力
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。
(5)智能产品及行业应用
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、智慧城市等。
接下来介绍几种本申请的应用场景。
图2为本申请实施例提供的联邦学习系统的一个结构示意图,该联邦学习系统包括服务端以及多个客户端,二者可通过通信网络实现连接。其中,客户端包括手机、个人电脑或者信息处理中心等智能终端,服务端可以是云服务器、网络服务器、应用服务器以及管理服务器等具有数据处理功能的设备或服务器,客户端和服务端可协同实现神经网络模型的训练。
多个客户端和服务端之间可实现多轮次(也就是多次迭代)的模型训练。具体地,在首个轮次的模型训练中,各个客户端可通过交互接口接收来自服务端的待训练模型,再通过存储本地数据的存储器以及处理数据的处理器对待训练模型进行机器学习,深度学习,搜索,推理,决策等方式的模型训练。各个客户端完成模型训练后(即对待训练模型的参数进行了更新),可将自身在首个轮次中所得到的更新后的模型上传到服务端,以使得服务端将各个客户端在首个轮次中所得到的更新后的模型进行聚合,从而基于聚合结果训练服务端本地的待训练模型。然后,服务端可将自身在首个轮次中所得到的更新后的模型作为新的待训练模型,再次下发到各个客户端中,以执行第二轮次的模型训练(即重复执行前述过程)。如此一来,经过多轮次的模型训练后,服务端确定自身在最后一个轮次中所得到的更新后的模型满足模型训练条件后,可将自身在最后一个轮次中所得到的更新后的模型作为训练后的模型(也可以称为目标模型,即完成训练的模型)。如此一来,服务端既间接地利用了各个客户端的本地数据完成了模型训练,还能确保各个客户端的数据安全,从而保护用户个人隐私。
需要说明的是,为了进一步保证数据安全,在任意一个轮次的训练中,各个客户端可将自身在该轮次中对待训练模型的参数更新量(代表各个客户端在该轮次中所得到的更新后的模型),上传到服务端。那么,服务端可将各个客户端在该轮次中对待训练模型的参数更新量进行加权求和,再基于参数更新量的加权求和结果,来更新服务端本地的待训练模型的参数,得到更新后的模型。至此,服务端和各个客户端则联合完成了该轮次的模型训练。
进一步地,在任意一个轮次的训练中,服务端还可基于各个客户端在该轮次中对待训练 模型的参数更新量,来评估各个客户端在该轮次中的数据价值,即各个客户端在该轮次的模型训练中所使用的本地数据的价值,可用于描述各个客户端在该轮次的模型训练中所作出的贡献。那么,服务端在对各个客户端在该轮次中对待训练模型的参数更新量进行加权求和时,所使用的权重可基于各个客户端在该轮次中的数据价值来确定(也可以基于各个客户端在前一轮次中的数据价值来确定等等)。需要说明的是,数据价值的获取过程以及数据价值的后续应用过程,此处先不展开。
在图2中,服务端可以执行本申请实施例的数据价值评估方法,且服务端以及客户端可以联合实现本申请实施例的模型训练方法。
此外,本申请实施例提供的联邦学习系统中,服务端得到训练后的模型,具备数据处理功能,故可将该模型部署在各个客户端上。因此,各个客户端可以为用户提供数据处理服务,当某个客户端获取来自用户输入的待处理数据后,可调用训练后的模型,对用户输入的待处理数据进行相应的处理,并向用户返回相应的处理结果。
在图2中,客户端可以利用本申请实施例中服务端最终得到所得到的训练后的模型,实现数据处理功能。
图3为本申请实施例提供的系统100架构的一个示意图,在图3中,执行设备110配置输入/输出(input/output,I/O)接口112,用于与外部设备进行数据交互,用户可以通过客户设备140向I/O接口112输入数据,所述输入数据在本申请实施例中可以包括:各个待调度任务、可调用资源以及其他参数。
在执行设备110对输入数据进行预处理,或者在执行设备110的计算模型111执行计算等相关的处理(比如进行本申请中神经网络的功能实现)过程中,执行设备110可以调用数据存储系统150中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统150中。
最后,I/O接口112将处理结果返回给客户设备140,从而提供给用户。
值得说明的是,训练设备120可以针对不同的目标或称不同的任务,基于不同的训练数据生成相应的目标模型/规则,该相应的目标模型/规则即可以用于实现上述目标或完成上述任务,从而为用户提供所需的结果。其中,训练数据可以存储在数据库130中,且来自于数据采集设备160采集的训练样本。
在图3中所示情况下,用户可以手动给定输入数据,该手动给定可以通过I/O接口112提供的界面进行操作。另一种情况下,客户设备140可以自动地向I/O接口112发送输入数据,如果要求客户设备140自动发送输入数据需要获得用户的授权,则用户可以在客户设备140中设置相应权限。用户可以在客户设备140查看执行设备110输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备140也可以作为数据采集端,采集如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果作为新的样本数据,并存入数据库130。当然,也可以不经过客户设备140进行采集,而是由I/O接口112直接将如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果,作为新的样本数据存入数据库130。
值得注意的是,图3仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图3中,数据存储系统150相对执行设备110是外部存储器,在其它情况下,也可以将数据存储系统150置于执行设备110中。如图3 所示,可以根据训练设备120训练得到神经网络。
需要说明的是,本申请实施例中,训练设备120通常指前述的服务端,执行设备110通常指前述的客户端,训练设备120在训练模型时,可联合执行设备110一起实现模型训练,即二者可以联邦学习的方式来实现模型训练。
本申请实施例还提供的一种芯片,该芯片包括神经网络处理器NPU。该芯片可以被设置在如图3所示的执行设备110中,用以完成计算模型111的计算工作。该芯片也可以被设置在如图3所示的训练设备120中,用以完成训练设备120的训练工作并输出目标模型/规则。
神经网络处理器NPU,NPU作为协处理器挂载到主中央处理器(central processing unit,CPU)(host CPU)上,由主CPU分配任务。NPU的核心部分为运算电路,控制器控制运算电路提取存储器(权重存储器或输入存储器)中的数据并进行运算。
在一些实现中,运算电路内部包括多个处理单元(process engine,PE)。在一些实现中,运算电路是二维脉动阵列。运算电路还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)中。
向量计算单元可以对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。例如,向量计算单元可以用于神经网络中非卷积/非FC层的网络计算,如池化(pooling),批归一化(batch normalization),局部响应归一化(local response normalization)等。
在一些实现种,向量计算单元能将经处理的输出的向量存储到统一缓存器。例如,向量计算单元可以将非线性函数应用到运算电路的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路的激活输入,例如用于在神经网络中的后续层中的使用。
统一存储器用于存放输入数据以及输出数据。
权重数据直接通过存储单元访问控制器(direct memory access controller,DMAC)将外部存储器中的输入数据搬运到输入存储器和/或统一存储器、将外部存储器中的权重数据存入权重存储器,以及将统一存储器中的数据存入外部存储器。
总线接口单元(bus interface unit,BIU),用于通过总线实现主CPU、DMAC和取指存储器之间进行交互。
与控制器连接的取指存储器(instruction fetch buffer),用于存储控制器使用的指令;
控制器,用于调用指存储器中缓存的指令,实现控制该运算加速器的工作过程。
一般地,统一存储器,输入存储器,权重存储器以及取指存储器均为片上(On-Chip)存储器,外部存储器为该NPU外部的存储器,该外部存储器可以为双倍数据率同步动态随机存储器(double data rate synchronous dynamic random access memory,DDR SDRAM)、高带宽存储器(high bandwidth memory,HBM)或其他可读可写的存储器。
此外,本申请实施例提供的联邦学习系统还可应用于多种领域中,下文将分别进行介绍。图4为本申请实施例提供的联邦学习系统的一个应用例示意图,如图4所示,联邦学习系统可 应用于智能家居领域中,此时,系统中的多个客户端为位于多个家庭中的智能家居设备,这多个家庭位于不同的地理位置上。这多个智能家居设备可与云端的服务器(即服务端)实现通信,以实现联邦学习。
云端的服务器为了在各个智能家居设备上部署具备语音识别功能的神经网络模型,可与多个智能家居设备实现多轮次的模型训练。在首个轮次的模型训练中,各个智能家居设备可通过接收来自服务器的待训练模型,再通过本地的语音数据对待训练模型对待训练模型的参数进行更新,并将更新后的模型上传到服务器,以使得服务器将各个智能家居设备上传的更新后的模型进行聚合,从而基于聚合结果训练服务器本地的待训练模型。然后,服务器可将自身训练得到的更新后的模型作为新的待训练模型,再次下发到各个智能家居设备中,以执行第二个轮次的模型训练(即重复执行前述过程)。如此一来,经过多个轮次的模型训练后,服务器确定自身最后一个轮次训练得到的更新后的模型满足模型训练条件后,可将自身最后一个轮次训练得到的更新后的模型作为能够实现语音识别功能的神经网络模型,部署到各个智能家居设备上,为各个家庭提供智能家居服务。
图5为本申请实施例提供的联邦学习系统的另一个应用例示意图,如图5所示,联邦学习系统可应用于教学领域中,此时,系统中的多个客户端为位于多个学校中的教学设备(例如,个人电脑、平板电脑等等),这多个学校位于不同的地理位置上。这多个教学设备可与求解器开发者的服务器(即服务端)实现通信,以实现联邦学习。
求解器开发者的服务器为了在各个教学设备上部署求解器,即具备求解方程功能的神经网络模型,可与多个教学设备实现多轮次的模型训练。在首个轮次的模型训练中,各个教学设备可通过接收来自服务器的待训练模型,再通过本地的数学数据对待训练模型对待训练模型的参数进行更新,并将更新后的模型上传到服务器,以使得服务器将各个教学设备上传的更新后的模型进行聚合,从而基于聚合结果训练服务器本地的待训练模型。然后,服务器可将自身训练得到的更新后的模型作为新的待训练模型,再次下发到各个教学设备中,以执行第二个轮次的模型训练(即重复执行前述过程)。如此一来,经过多个轮次的模型训练后,服务器确定自身最后一个轮次训练得到的更新后的模型满足模型训练条件后,可将自身最后一个轮次训练得到的更新后的模型作为求解器,部署到各个教学设备上,为各个学校中的学生和教师提供教学服务。
图6为本申请实施例提供的联邦学习系统的另一个应用例示意图,如图6所示,联邦学习系统可应用于软件服务领域中,此时,系统中的多个客户端为位于多个用户或企业所使用的智能终端设备。这多个智能终端设备可与远端的软件开发商的服务器(即服务端)实现通信,以实现联邦学习。
软件开发商的服务器为了在各个智能终端设备上部署图像处理软件,即具备图像分类的神经网络模型,可与多个智能终端设备实现多轮次的模型训练。在首个轮次的模型训练中,各个智能终端设备可通过接收来自服务器的待训练模型,再通过本地的图像数据对待训练模型对待训练模型的参数进行更新,并将更新后的模型上传到服务器,以使得服务器将各个智能终端设备上传的更新后的模型进行聚合,从而基于聚合结果训练服务器本地的待训练模型。然后,服务器可将自身训练得到的更新后的模型作为新的待训练模型,再次下发到各个智能终端设备中,以执行第二个轮次的模型训练(即重复执行前述过程)。如此一来,经过多个轮 次的模型训练后,服务器确定自身最后一个轮次训练得到的更新后的模型满足模型训练条件后,可将自身最后一个轮次训练得到的更新后的模型作为图像处理软件,部署到各个智能终端设备上,为企业和个人提供图像处理服务。
应理解,以上仅以联邦学习系统可应用于智能家居领域、教学领域以及软件服务领域进行示意性介绍,在实际应用中,本申请实施例提供的联邦学习系统还可应用到更多领域中,此处不做一一介绍。
由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。
(1)神经网络
神经网络可以是由神经单元组成的,神经单元可以是指以xs和截距1为输入的运算单元,该运算单元的输出可以为:
其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入。激活函数可以是sigmoid函数。神经网络是将许多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。
神经网络中的每一层的工作可以用数学表达式y=a(Wx+b)来描述:从物理层面神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由Wx完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。
因为希望神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于 衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么神经网络的训练就变成了尽可能缩小这个loss的过程。
(2)反向传播算法
神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的神经网络模型中参数的大小,使得神经网络模型的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的神经网络模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的神经网络模型的参数,例如权重矩阵。
(3)联邦学习
联邦学习是一种用于保护用户隐私的机器学习技术,联邦学习结构上一般包括一个服务端(中心服务器)和一些客户端作为参与方,技术流程主要包括模型下发和模型聚合过程。在模型下发过程中,客户端从服务端下载模型,并在本地数据上训练,训练到一定程度后上传模型到服务端。在模型聚合过程中,服务端会收集各个客户端上传的模型,并进行模型融合。这两个过程会反复迭代直至模型收敛,从而得到训练好的模型。
(4)联邦聚合
联邦聚合是联邦学习的一个子过程,联邦学习中服务端的主要任务就是对客户端上传的模型进行聚合,即联邦学习中服务器将多个模型融合为一个模型的过程。
(5)参数点对点聚合
参数点对点聚合是一种最简单的联邦聚合方式,该方式要求多个客户端上传的模型具有一样的结构,服务端可对多个模型同一位置上的神经元的参数进行平均。
下面将对本申请提供的基于联邦学习的数据价值评估方法进行描述,该方法可通过如图2所示的联邦学习系统实现,由于该系统会进行多个轮次的模型训练,在任意一个轮次的模型训练中,服务端可从P个客户端(P为大于1的正整数)中随机选择M个客户端(M为小于P的正整数),再基于M个客户端在该轮次中对待训练模型的参数更新量,来评估M个客户端在该轮次中的数据价值,后续可基于M个客户端在该轮次中的数据价值来完成该轮次的模型训练(当然,也可通过M个客户端在前一轮次中的数据价值来完成该轮次的模型训练)。由于服务端在每个轮次的模型训练中所进行的操作是类似的,故下文将以其中一个轮次的模型训练进行介绍,并将该轮次的模型训练称为当前轮次的模型训练。图7为本申请实施例提供的基于联邦学习的数据价值评估方法的一个流程示意图。如图7所示,该方法包括:
701、服务端获取M个客户端在当前轮次中对待训练模型的参数更新量。
本实施例中,在当前轮次的模型训练中,服务端可先向客户端资源池中的P个客户端下发待训练模型。对于P个客户端中的任意一个客户端而言,该客户端在接收到来自服务端的待训练模型后,可使用本地数据对待训练模型进行训练,从而更新待训练模型的参数得到更新后的模型(例如,该客户端可将本地数据输入至待训练模型,以通过待训练模型对本地数据进行处理,从而得到本地数据的处理结果,故该客户端可基于本地数据的处理结果,来更新待训练模型的参数,得到更新后的模型)。那么,该客户端可计算待训练模型的参数以及更新后的模型的参数之间的差值,该差值即为该客户端在当前轮次中对待训练模型的参数更新量。同理,P个客户端中除该客户端的其余客户端,也可执行如同对该客户端所执行的操作, 故可得到P个客户端在当前轮次中对待训练模型的参数更新量。
此后,服务端可在P个客户端中随机选择M个客户端,以使得M个客户端将M个客户端在当前轮次中对待训练模型的参数更新量,上传到服务端。
702、服务端基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别,M≥N>1。
得到M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可使用聚类算法(例如,K均值聚类算法、层次凝聚聚类算法等等),将M个客户端在当前轮次中对待训练模型的参数更新量进行处理,从而将这些参数更新量划分为N个类别(N为小于或等于M的正整数),在这N个类别中,任意一个类别包含M个客户端中的至少一个客户端在前轮次中对待训练模型的参数更新量。
具体地,在M个客户端在当前轮次中对待训练模型的参数更新量中,服务端可计算任意两个客户端在当前轮次中对待训练模型的参数更新量之间的余弦相似度,从而判断这两个客户端在当前轮次中对待训练模型的参数更新量是否可划分在同一类别中。其中,任意两个客户端在当前轮次中对待训练模型的参数更新量之间的余弦相似度可通过以下公式计算得到:
上式中,t为当前轮次,a为第a个客户端,b为第b个客户端,为第a个客户端在当前轮次中对待训练模型的参数更新量,为第b个客户端在当前轮次中对待训练模型的参数更新量,为第a个客户端在当前轮次中对待训练模型的参数更新量与第b个客户端在当前轮次中对待训练模型的参数更新量之间的余弦相似度,a=1,...,M,b=1,...,M,a≠b。
可见,通过以上公式,在M个客户端在当前轮次中对待训练模型的参数更新量中,服务端可计算任意两个客户端在当前轮次中对待训练模型的参数更新量之间的余弦相似度,若该余弦相似度大于或等于预置的相似度阈值,服务端则将这两个客户端在当前轮次中对待训练模型的参数更新量划分在同一类别中,若该余弦相似度小于预置的相似度阈值,服务端则将这两个客户端在当前轮次中对待训练模型的参数更新量划分在不同的类别中。
如此一来,服务端可成功将M个客户端在当前轮次中对待训练模型的参数更新量划分为N个类别,相当于服务端成功将M个客户端划分为N个类别,在这N个类别中,任意一个类别包含M个客户端中的至少一个客户端。
703、基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值,目标客户端在当前轮次中的数据价值作为第i个类别中所有客户端在当前轮次中的数据价值,i=1,...,N。
将M个客户端划分为N个类别后,对于这N个类别中的任意一个类别,即N个类别中的 第i个类别,服务端可从第i个类别所包含的所有客户端中,选定一个客户端作为第i个类别的代表,即第i个类别的目标客户端。具体地,第i个类别的目标客户端可通过以下方式进行选取:(1)服务端可从第i个类别的所有客户端中,随机选择一个客户端作为第i个类别的目标客户端。(2)服务端可从第i个类别的所有客户端中,将位于第i个类别的聚类中心的客户端作为第i个类别的目标客户端。
确定第i个类别的目标客户端后,服务端可对第i个类别的目标客户端在当前轮次中对待训练模型的参数更新量进行计算,得到第i个类别的目标客户端在当前轮次中的数据价值。由于第i个类别的目标客户端为第i个类别的代表,故第i个类别的目标客户端在当前轮次中的数据价值,可作为第i个类别(的所有客户端)在当前轮次中的数据价值。具体地,第i个类别的目标客户端在当前轮次中的数据价值可通过以下方式获取:
(1)确定第i个类别的目标客户端后,服务端可在M个客户端中除目标客户端之外的其余客户端中,选择S个客户端,由此可见,服务端所选择的S个客户端不包含目标客户端。接着,服务端可对S个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,再基于加权求和的结果来对待训练模型的参数进行更新,从而得到第一模型。
(2)得到第一模型后,服务端可将S个客户端以及目标客户端视为一个整体,即T个客户端,由此可见,服务端所得到的T个客户端包含目标客户端以及S个客户端。接着,服务端可对T个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,再基于加权求和的结果来对待训练模型的参数进行更新,从而得到第二模型。
(3)得到第一模型和第二模型后,服务端可利用一批测试数据,来测试第一模型的精度以及第二模型的精度。那么,服务端可基于第一模型的精度以及第二模型的精度,计算目标客户端在当前轮次中的数据价值,目标客户端在当前轮次中的数据价值可通过以下公式计算得到:
上式中,i为第i个类别中的目标客户端,为第i个类别中的目标客户端在当前轮次中的数据价值,Ct为M个客户端,|Ct|为M个客户端的数量,S为S个客户端,|S|为S个客户端的数量,S∪{i}为T个客户端,为服务端在M个客户端中选择S个客户端的组合数量,v(S)为第一模型的精度,v(S∪{i})为第二模型的精度。
如此一来,服务端可得到第i个类别的目标客户端在当前轮次中的数据价值,即得到了第i个类别中所有客户端在当前轮次中的数据价值。对于N个类别除第i个类别之外的其余类别,服务端也可执行如同对第i个类别所执行的操作,故服务端可得到N个类别在当前轮次中的数据价值,即M个客户端在当前轮次中的数据价值,故可确定M个客户端在当前轮次的模型训练中所付出的贡献。
值得注意的是,服务端可记录P个客户端在每个轮次中的数据价值,那么,在得到M个 客户端在当前轮次中的数据价值后,服务端可将其余P-M个客户端在前一轮次中的数据价值,作为这P-M个客户端在当前轮次中的数据价值。如此一来,服务端可成功得到并记录P个客户端在当前轮次中的数据价值。
此外,为了进一步了解本申请实施例提供的数据价值评估方法,下文结合一个具体应用例对该方法做进一步的介绍。图8为本申请实施例提供的基于联邦学习的数据价值评估方法的一个应用例示意图,如图8所示,该应用例包括:
(a)服务端向客户端资源池下发待训练模型,客户端资源池中的所有客户端可利用本地数据对待训练模型进行训练。
(b)服务端可在客户端资源池中的所有客户端中,随即选择多个客户端。
(c)服务端可对这多个客户端进行聚类,从而将相似的若干个客户端聚成一类,从而得到多个类别。
(d)在任意一个类别中,服务端可挑选出一个作为代表的客户端,那么,服务端通过计算该客户端的数据价值,即可得到该类别中所有客户端的数据价值。
本申请实施例中,在获取M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别。对于N个类别中的任意一个类别,服务端可对该类别中目标客户端在当前轮次中对待训练模型的参数更新量进行处理,得到目标客户端在当前轮次中的数据价值,并将目标客户端在当前轮次中的数据价值作为该类别中所有客户端在当前轮次中的数据价值。对于其余类别,服务端也可执行如同对该类别所执行的操作,故可得到M个客户端在当前轮次中的数据价值。可见,在当前轮次的模型训练中,服务端将M个客户端分成N个类别后,对于N个类别中的任意一个类别,服务端仅需进行一次数据价值计算就可以得到该类别中所有客户端在当前轮次中的数据价值,故对于N个类别,服务端总共仅需进行N次数据价值计算就可以得到M个客户端在当前轮次中的数据价值,由于N通常小于M,故可有效减少服务端进行数据价值评估时所付出的计算量,从而节约计算成本。
基于上述的数据价值评估方法,本申请实施例还提供了一种模型训练方法,图9为本申请实施例提供的模型训练方法的一个流程示意图,如图9所示,该方法包括:
901、服务端获取M个客户端在当前轮次中对待训练模型的参数更新量。
902、服务端基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别,M≥N>1。
903、基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值,目标客户端在当前轮次中的数据价值作为第i个类别中所有客户端在当前轮次中的数据价值,i=1,...,N。
关于步骤901至步骤903的介绍,可参考图7所示实施例中步骤701至步骤703的相关说明部分,此处不再赘述。
904、基于M个客户端在当前轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。
得到M个客户端在当前轮次中的数据价值后,服务端可将M个客户端在当前轮次中的数据价值作为M个客户端的权重,并利用这些权重对M个客户端在当前轮次中对待训练模型的 参数更新量进行加权求和,从而得到相应的加权求和结果。然后,服务端可利用该加权求和结果来更新待训练模型的参数,从而得到更新后的模型。具体地,服务端可先对M个客户端在当前轮次中的数据价值进行标准化,从而得到M个客户端在当前轮次中标准化后的数据价值,其中,标准化的过程如以下公式所示:
上式中,为第j个客户端在当前轮次中的数据价值,j=1,...,m,为第j个客户端在当前轮次中标准化后的数据价值。
然后,服务端可对M个客户端在当前轮次中标准化后的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量进行计算,得到加权求和结果,该结果可通过以下公式获取:
上式中,为第j个客户端在当前轮次中对待训练模型的参数更新量,Wt为加权求和结果。
随后,服务端可利用该加权求和结果来更新待训练模型的参数,从而得到更新后的模型。至此,服务端和M个客户端则联合完成了当前轮次的模型训练,那么,服务端可将更新后的模型作为新的待训练模型,并下发到客户端资源池中,从而进行下一轮次的模型训练,直至完成多个轮次的模型训练,得到目标模型。
本申请实施例中,在当前轮次中的模型训练中,服务端在对M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和时,所使用的权重是M个客户端在当前轮次中的数据价值,由于这些数据价值可表明M个客户端在当前轮次中所付出的贡献,故贡献较大(较为重要)的客户端所占的权重较大,贡献较小(较为不重要)的客户端所占的权重较小,以这种方式进行加权求和所得到的结果,可以弱化一些不重要的客户端所发挥的作用,强化一些重要的客户端所发挥的作用,基于此结果训练得到的模型,可以具备较好的性能。
图10为本申请实施例提供的模型训练方法的另一流程示意图,如图10所示,该方法包括:
1001、服务端获取M个客户端在当前轮次中对待训练模型的参数更新量。
1002、服务端基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别,M≥N>1。
1003、基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值,目标客户端在当前轮次中的数据价值作为第i个类别中所有客户端在当前轮次中的数据价值,i=1,...,N。
关于步骤1001至步骤1003的介绍,可参考图7所示实施例中步骤701至步骤703的相 关说明部分,此处不再赘述。
1004、基于M个客户端在前一轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。
得到M个客户端在当前轮次中的数据价值后,服务端可保留M个客户端在当前轮次中的数据价值,以在下一轮次中使用。接着,服务端可获取M个客户端在前一轮次中的数据价值,并将M个客户端在前一轮次中的数据价值作为M个客户端的权重,以利用这些权重对M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,从而得到相应的加权求和结果。然后,服务端可利用该加权求和结果来更新待训练模型的参数,从而得到更新后的模型。具体地,服务端可先对M个客户端在前一轮次中的数据价值进行标准化,从而得到M个客户端在前一轮次中标准化后的数据价值,其中,标准化的过程如以下公式所示:
上式中,为第j个客户端在前一轮次中的数据价值,j=1,...,m,为第j个客户端在前一轮次中标准化后的数据价值。
然后,服务端可对M个客户端在前一轮次中标准化后的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量进行计算,得到加权求和结果,该结果可通过以下公式获取:
上式中,为第j个客户端在当前轮次中对待训练模型的参数更新量,Wt为加权求和结果。
随后,服务端可利用该加权求和结果来更新待训练模型的参数,从而得到更新后的模型。至此,服务端和M个客户端则联合完成了当前轮次的模型训练,那么,服务端可将更新后的模型作为新的待训练模型,并下发到客户端资源池中,从而进行下一轮次的模型训练,直至完成多个轮次的模型训练,得到目标模型。
本申请实施例中,在当前轮次中的模型训练中,服务端在对M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和时,所使用的权重是M个客户端在前一轮次中的数据价值,由于这些数据价值可表明M个客户端在前一轮次中所付出的贡献,故贡献较大(较为重要)的客户端所占的权重较大,贡献较小(较为不重要)的客户端所占的权重较小,以这种方式进行加权求和所得到的结果,可以弱化一些不重要的客户端所发挥的作用,强化一些重要的客户端所发挥的作用,基于此结果训练得到的模型,可以具备较好的性能。
以上是对本申请实施例提供的数据价值评估方法以及模型训练方式所进行的详细说明,以下将对本申请是实力提供的数据价值评估装置进行介绍。图11为本申请实施例提供的基于联邦学习的数据价值评估装置的一个结构示意图,如图11所示,该装置部署在服务端中,该 装置包括:
第一获取模块1101,用于获取M个客户端在当前轮次中对待训练模型的参数更新量;
划分模块1102,用于基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别,M≥N>1;
第二获取模块1103,用于基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取目标客户端在当前轮次中的数据价值,目标客户端在当前轮次中的数据价值作为第i个类别中所有客户端在当前轮次中的数据价值,i=1,...,N。
本申请实施例中,在获取M个客户端在当前轮次中对待训练模型的参数更新量后,服务端可基于M个客户端在当前轮次中对待训练模型的参数更新量,将M个客户端划分为N个类别。对于N个类别中的任意一个类别,服务端可对该类别中目标客户端在当前轮次中对待训练模型的参数更新量进行处理,得到目标客户端在当前轮次中的数据价值,并将目标客户端在当前轮次中的数据价值作为该类别中所有客户端在当前轮次中的数据价值。对于其余类别,服务端也可执行如同对该类别所执行的操作,故可得到M个客户端在当前轮次中的数据价值。可见,在当前轮次的模型训练中,服务端将M个客户端分成N个类别后,对于N个类别中的任意一个类别,服务端仅需进行一次数据价值计算就可以得到该类别中所有客户端在当前轮次中的数据价值,故对于N个类别,服务端总共仅需进行N次数据价值计算就可以得到M个客户端在当前轮次中的数据价值,由于N通常小于M,故可有效减少服务端进行数据价值评估时所付出的计算量,从而节约计算成本。
在一种可能的实现方式中,第二获取模块,用于:基于M个客户端中S个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到第一模型,S个客户端不包含目标客户端;基于M个客户端中T个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到第二模型,T个客户端包含目标客户端以及S个客户端;基于第一模型的精度以及第二模型的精度,计算目标客户端在当前轮次中的数据价值。
在一种可能的实现方式中,目标客户端为第i个类别中任意一个客户端,或,第i个类别中位于聚类中心的客户端。
在一种可能的实现方式中,该装置还包括:更新模块,用于基于M个客户端在当前轮次中的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,更新模块,用于:以M个客户端在当前轮次中的数据价值作为M个客户端的权重,并对M个客户端的权重以及M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;基于加权求和结果,对待训练模型进行更新,得到更新后的模型。
在一种可能的实现方式中,该装置还包括:更新模块,用于基于M个客户端在前一轮次的数据价值以及M个客户端在当前轮次中对待训练模型的参数更新量,对待训练模型进行更新,得到更新后的模型。
在一种可能实现的方式中,更新模块,用于:以M个客户端在前一轮次中的数据价值作为M个客户端的权重,并对M个客户端的权重以及M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;基于加权求和结果,对待训练模型进行更新, 得到更新后的模型。
在一种可能的实现方式中,N个类别可通过以下至少一项获取:K均值聚类算法或层次凝聚聚类算法。
需要说明的是,上述装置各模块/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其带来的技术效果与本申请方法实施例相同,具体内容可参考本申请实施例前述所示的方法实施例中的叙述,此处不再赘述。
本申请实施例还涉及一种执行设备,图12为本申请实施例提供的执行设备的一个结构示意图。如图12所示,执行设备1200具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备1200上可部署有图2所示的客户端,用于联合后续的训练设备共同实现图9或图10对应实施例中模型训练的功能。具体的,执行设备1200包括:接收器1201、发射器1202、处理器1203和存储器1204(其中执行设备1200中的处理器1203的数量可以一个或多个,图12中以一个处理器为例),其中,处理器1203可以包括应用处理器12031和通信处理器12032。在本申请的一些实施例中,接收器1201、发射器1202、处理器1203和存储器1204可通过总线或其它方式连接。
存储器1204可以包括只读存储器和随机存取存储器,并向处理器1203提供指令和数据。存储器1204的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器1204存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。
处理器1203控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。
上述本申请实施例揭示的方法可以应用于处理器1203中,或者由处理器1203实现。处理器1203可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1203中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1203可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器1203可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1204,处理器1203读取存储器1204中的信息,结合其硬件完成上述方法的步骤。
接收器1201可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器1202可用于通过第一接口输出数字或字符信息;发射器1202还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器1202还可以包括显示屏等显示设备。
本申请实施例中,在一种情况下,处理器1203,可用于实现图9或图10对应实施例中的模型训练方法,还可用于通过图9或图10对应实施例所得到的目标模型,实现相应的数据处理功能。
本申请实施例还涉及一种训练设备,图13为本申请实施例提供的训练设备的一个结构示意图。如图13所示,训练设备1300可包含图2所示的服务端,训练设备1300可由一个或多个服务器实现,训练设备1300可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1314(例如,一个或一个以上处理器)和存储器1332,一个或一个以上存储应用程序1342或数据1344的存储介质1330(例如一个或一个以上海量存储设备)。其中,存储器1332和存储介质1330可以是短暂存储或持久存储。存储在存储介质1330的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1314可以设置为与存储介质1330通信,在训练设备1300上执行存储介质1330中的一系列指令操作。
训练设备1300还可以包括一个或一个以上电源1326,一个或一个以上有线或无线网络接口1350,一个或一个以上输入输出接口1358;或,一个或一个以上操作系统1341,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
具体的,训练设备可执行图7对应实施例中的数据价值评估方法,且训练设备可以联合前述的执行设备,共同执行图9或图10对应实施例中的模型训练方法。
本申请实施例还涉及一种计算机存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例还涉及一种计算机程序产品,该计算机程序产品存储有指令,该指令在由计算机执行时使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。
具体的,请参阅图14,图14为本申请实施例提供的芯片的一个结构示意图,所述芯片可以表现为神经网络处理器NPU 1400,NPU 1400作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1403,通过控制器1404控制运算电路1403提取存储器中的矩阵数据并进行乘法运算。
在一些实现中,运算电路1403内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1403是二维脉动阵列。运算电路1403还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1403是通用的 矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1402中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1401中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1408中。
统一存储器1406用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1405,DMAC被搬运到权重存储器1402中。输入数据也通过DMAC被搬运到统一存储器1406中。
BIU为Bus Interface Unit即,总线接口单元1613,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1409的交互。
总线接口单元1613(Bus Interface Unit,简称BIU),用于取指存储器1409从外部存储器获取指令,还用于存储单元访问控制器1405从外部存储器获取输入矩阵A或者权重矩阵B的原数据。
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1406或将权重数据搬运到权重存储器1402中或将输入数据数据搬运到输入存储器1401中。
向量计算单元1407包括多个运算处理单元,在需要的情况下,对运算电路1403的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对预测标签平面进行上采样等。
在一些实现中,向量计算单元1407能将经处理的输出的向量存储到统一存储器1406。例如,向量计算单元1407可以将线性函数;或,非线性函数应用到运算电路1403的输出,例如对卷积层提取的预测标签平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1407生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1403的激活输入,例如用于在神经网络中的后续层中的使用。
控制器1404连接的取指存储器(instruction fetch buffer)1409,用于存储控制器1404使用的指令;
统一存储器1406,输入存储器1401,权重存储器1402以及取指存储器1409均为On-Chip存储器。外部存储器私有于该NPU硬件架构。
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件 加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。

Claims (19)

  1. 一种基于联邦学习的数据价值评估方法,其特征在于,所述方法包括:
    获取M个客户端在当前轮次中对待训练模型的参数更新量;
    基于所述M个客户端在当前轮次中对待训练模型的参数更新量,将所述M个客户端划分为N个类别,M≥N>1;
    基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取所述目标客户端在当前轮次中的数据价值,所述目标客户端在当前轮次中的数据价值作为所述第i个类别中所有客户端在当前轮次中的数据价值,i=1,...,N。
  2. 根据权力要求1所述的方法,其特征在于,所述基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取所述目标客户端在当前轮次中的数据价值包括:
    基于所述M个客户端中S个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到第一模型,所述S个客户端不包含所述目标客户端;
    基于所述M个客户端中T个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到第二模型,所述T个客户端包含所述目标客户端以及所述S个客户端;
    基于所述第一模型的精度以及所述第二模型的精度,计算所述目标客户端在当前轮次中的数据价值。
  3. 根据权利要求1或2所述的方法,其特征在于,所述目标客户端为所述第i个类别中任意一个客户端,或,所述第i个类别中位于聚类中心的客户端。
  4. 根据权利要求1至3任意一项所述的方法,其特征在于,所述基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取所述目标客户端在当前轮次中的数据价值之后,所述方法还包括:
    基于所述M个客户端在当前轮次中的数据价值以及所述M个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到更新后的模型。
  5. 根据权利要求4所述的方法,其特征在于,所述基于所述M个客户端在当前轮次中的数据价值以及所述M个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到更新后的模型包括:
    以所述M个客户端在当前轮次中的数据价值作为所述M个客户端的权重,并对所述M个客户端的权重以及所述M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;
    基于所述加权求和结果,对所述待训练模型进行更新,得到更新后的模型。
  6. 根据权利要求1至3任意一项所述的方法,其特征在于,所述基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取所述目标客户端在当前轮次中的数据价值之后,所述方法还包括:
    基于所述M个客户端在前一轮次中的数据价值以及所述M个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到更新后的模型。
  7. 根据权利要求6所述的方法,其特征在于,所述基于所述M个客户端在前一轮次中的数据价值以及所述M个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型 进行更新,得到更新后的模型包括:
    以所述M个客户端在前一轮次中的数据价值作为所述M个客户端的权重,并对所述M个客户端的权重以及所述M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;
    基于所述加权求和结果,对所述待训练模型进行更新,得到更新后的模型。
  8. 根据权利要求1至7任意一项所述的方法,其特征在于,所述N个类别可通过以下至少一项获取:K均值聚类算法或层次凝聚聚类算法。
  9. 一种基于联邦学习的数据价值评估装置,其特征在于,所述装置包括:
    第一获取模块,用于获取M个客户端在当前轮次中对待训练模型的参数更新量;
    划分模块,用于基于所述M个客户端在当前轮次中对待训练模型的参数更新量,将所述M个客户端划分为N个类别,M≥N>1;
    第二获取模块,用于基于第i个类别中目标客户端在当前轮次中对待训练模型的参数更新量,获取所述目标客户端在当前轮次中的数据价值,所述目标客户端在当前轮次中的数据价值作为所述第i个类别中所有客户端在当前轮次中的数据价值,i=1,...,N。
  10. 根据权力要求9所述的装置,其特征在于,所述第二获取模块,用于:
    基于所述M个客户端中S个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到第一模型,所述S个客户端不包含所述目标客户端;
    基于所述M个客户端中T个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到第二模型,所述T个客户端包含所述目标客户端以及所述S个客户端;
    基于所述第一模型的精度以及所述第二模型的精度,计算所述目标客户端在当前轮次中的数据价值。
  11. 根据权利要求9或10所述的装置,其特征在于,所述目标客户端为所述第i个类别中任意一个客户端,或,所述第i个类别中位于聚类中心的客户端。
  12. 根据权利要求9至11任意一项所述的装置,其特征在于,所述装置还包括:
    更新模块,用于基于所述M个客户端在当前轮次中的数据价值以及所述M个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到更新后的模型。
  13. 根据权利要求12所述的装置,其特征在于,所述更新模块,用于:
    以所述M个客户端在当前轮次中的数据价值作为所述M个客户端的权重,并对所述M个客户端的权重以及所述M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和,得到加权求和结果;
    基于所述加权求和结果,对所述待训练模型进行更新,得到更新后的模型。
  14. 根据权利要求9至12任意一项所述的装置,其特征在于,所述装置还包括:
    更新模块,用于基于所述M个客户端在前一轮次的数据价值以及所述M个客户端在当前轮次中对待训练模型的参数更新量,对所述待训练模型进行更新,得到更新后的模型。
  15. 根据权利要求14所述的装置,其特征在于,所述更新模块,用于:
    以所述M个客户端在前一轮次中的数据价值作为所述M个客户端的权重,并对所述M个客户端的权重以及所述M个客户端在当前轮次中对待训练模型的参数更新量进行加权求和, 得到加权求和结果;
    基于所述加权求和结果,对所述待训练模型进行更新,得到更新后的模型。
  16. 根据权利要求9至15任意一项所述的装置,其特征在于,所述N个类别可通过以下至少一项获取:K均值聚类算法或层次凝聚聚类算法。
  17. 一种服务端,其特征在于,所述服务端包括存储器和处理器;
    所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述服务端执行如权利要求1至8任一项所述的方法。
  18. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该程序由计算机执行时,使得所述计算机实施权利要求1至8任一项所述的方法。
  19. 一种计算机程序产品,其特征在于,所述计算机程序产品存储有指令,所述指令在由计算机执行时,使得所述计算机实施权利要求1至8任一项所述的方法。
PCT/CN2023/100395 2022-06-28 2023-06-15 一种基于联邦学习的数据价值评估方法及其相关设备 WO2024001806A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210743272.5A CN115238909A (zh) 2022-06-28 2022-06-28 一种基于联邦学习的数据价值评估方法及其相关设备
CN202210743272.5 2022-06-28

Publications (1)

Publication Number Publication Date
WO2024001806A1 true WO2024001806A1 (zh) 2024-01-04

Family

ID=83671864

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/100395 WO2024001806A1 (zh) 2022-06-28 2023-06-15 一种基于联邦学习的数据价值评估方法及其相关设备

Country Status (2)

Country Link
CN (1) CN115238909A (zh)
WO (1) WO2024001806A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118657196A (zh) * 2024-08-21 2024-09-17 湖南苏科智能科技有限公司 基于数据分布聚簇式联邦学习的安检模型升级方法和装置

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115238909A (zh) * 2022-06-28 2022-10-25 华为技术有限公司 一种基于联邦学习的数据价值评估方法及其相关设备
WO2024134556A1 (en) * 2022-12-20 2024-06-27 Anmut Ltd. Machine learning architectures and prediction models for generating data asset predictions
CN117077817B (zh) * 2023-10-13 2024-01-30 之江实验室 一种基于标签分布的个性化联邦学习模型训练方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112926897A (zh) * 2021-04-12 2021-06-08 平安科技(深圳)有限公司 基于联邦学习的客户端贡献计算方法和装置
CN114091356A (zh) * 2022-01-18 2022-02-25 北京邮电大学 一种联邦学习方法及装置
WO2022110721A1 (zh) * 2020-11-24 2022-06-02 平安科技(深圳)有限公司 基于客户端分类聚合的联合风险评估方法及相关设备
CN114580662A (zh) * 2022-02-28 2022-06-03 浙江大学 基于锚点聚合的联邦学习方法和系统
CN115238909A (zh) * 2022-06-28 2022-10-25 华为技术有限公司 一种基于联邦学习的数据价值评估方法及其相关设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022110721A1 (zh) * 2020-11-24 2022-06-02 平安科技(深圳)有限公司 基于客户端分类聚合的联合风险评估方法及相关设备
CN112926897A (zh) * 2021-04-12 2021-06-08 平安科技(深圳)有限公司 基于联邦学习的客户端贡献计算方法和装置
CN114091356A (zh) * 2022-01-18 2022-02-25 北京邮电大学 一种联邦学习方法及装置
CN114580662A (zh) * 2022-02-28 2022-06-03 浙江大学 基于锚点聚合的联邦学习方法和系统
CN115238909A (zh) * 2022-06-28 2022-10-25 华为技术有限公司 一种基于联邦学习的数据价值评估方法及其相关设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LU, CHENYANG; DENG, SU; MA, WU-BIN; WU, YA-HUI; ZHOU, HAO-HAO: "Clustered Federated Learning Methods Based on DBSCAN Clustering", COMPUTER SCIENCE, CHINA, vol. 49, no. 6A, 22 June 2022 (2022-06-22), China, pages 232 - 237, XP009552129, DOI: 10.11896/jsjkx.211100059 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118657196A (zh) * 2024-08-21 2024-09-17 湖南苏科智能科技有限公司 基于数据分布聚簇式联邦学习的安检模型升级方法和装置

Also Published As

Publication number Publication date
CN115238909A (zh) 2022-10-25

Similar Documents

Publication Publication Date Title
WO2022042002A1 (zh) 一种半监督学习模型的训练方法、图像处理方法及设备
CN111797893B (zh) 一种神经网络的训练方法、图像分类系统及相关设备
US20210012198A1 (en) Method for training deep neural network and apparatus
WO2022022274A1 (zh) 一种模型训练方法及装置
WO2022116933A1 (zh) 一种训练模型的方法、数据处理的方法以及装置
WO2022083536A1 (zh) 一种神经网络构建方法以及装置
WO2024001806A1 (zh) 一种基于联邦学习的数据价值评估方法及其相关设备
EP4163831A1 (en) Neural network distillation method and device
WO2022179586A1 (zh) 一种模型训练方法及其相关联设备
WO2024041479A1 (zh) 一种数据处理方法及其装置
WO2022111387A1 (zh) 一种数据处理方法及相关装置
CN113039555A (zh) 通过使用基于注意力的神经网络在视频剪辑中进行动作分类
CN111738403B (zh) 一种神经网络的优化方法及相关设备
WO2023274052A1 (zh) 一种图像分类方法及其相关设备
WO2024083121A1 (zh) 一种数据处理方法及其装置
WO2023050143A1 (zh) 一种推荐模型训练方法及装置
US20240232575A1 (en) Neural network obtaining method, data processing method, and related device
WO2021169366A1 (zh) 数据增强方法和装置
WO2024160186A1 (zh) 一种模型训练方法及其相关设备
WO2021036397A1 (zh) 目标神经网络模型的生成方法和装置
WO2024213099A1 (zh) 一种数据处理方法及其装置
WO2024199404A1 (zh) 一种消费预测方法及其相关设备
WO2024179485A1 (zh) 一种图像处理方法及其相关设备
WO2024175014A1 (zh) 一种图像处理方法及其相关设备
WO2024114659A1 (zh) 一种摘要生成方法及其相关设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23829987

Country of ref document: EP

Kind code of ref document: A1