Method and device for training neural network

By establishing a training resource library in the data center and using distributed training algorithms to automatically match computing resources, it solves the problem of cost-limited neural network training rates, improves training efficiency and security, and meets the needs of small and medium-sized enterprises.

CN112400160BActive Publication Date: 2024-09-27HUAWEI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN201880095511.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-09-30
Publication Date
2024-09-27
Estimated Expiration
2038-09-30

AI Technical Summary

Technical Problem

In the existing technology, the training rate of neural networks is limited by the cost of high-performance processors, which is difficult for individual users and small and medium-sized enterprises to afford. Moreover, under the unclear computing resource pool infrastructure, it is difficult to select appropriate training resources, affecting training efficiency. and security.

Method used

By establishing a training resource library in the data center, the target training resources are determined according to the number of parameters of the neural network training task, and distributed training algorithms such as ring aggregation algorithms are used to automatically match computing units and transmission links, optimizing the parameter update rate and the number of sample iterations. Ensure reasonable allocation and use of training resources.

Benefits of technology

Neural network training can be completed without exposing the computing resource pool infrastructure to users, which improves data center security and user experience, reduces the complexity of users determining resource requirements, and improves training efficiency and satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112400160B
    Figure CN112400160B
Patent Text Reader

Abstract

A method for training a neural network includes: determining the number of training parameters of a neural network training task; determining a target training resource from a training resource library according to the number of training parameters, wherein the training resource library includes at least one training resource, there is a corresponding relationship between the at least one training resource and the at least one parameter number, the at least one training resource includes a target training resource, and the at least one parameter number includes the number of training parameters of the neural network training task; and executing the neural network training task through the target training resource. According to the method for training a neural network, a data center can determine the target training resource from the training resource library according to the neural network training task, and can complete the neural network training task without providing the user with the basic architecture of the resource pool, thereby reducing the risk caused by the exposure of the basic architecture of the resource pool and improving the security of the data center.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a method and device for training a neural network. Background Art

[0002] A neural network is a mathematical model that can obtain solutions through learning. It is widely used in image recognition, speech recognition, natural language processing, etc. Usually, a neural network needs to be trained with a large number of training samples before it can be used. The number of training samples and the number of neural network model parameters are the main factors that restrict the training rate of the neural network.

[0003] In order to speed up the training rate of neural networks, high-performance processors are needed to train neural networks. However, for individual users and small and medium-sized enterprises, the cost of high-performance processors is relatively high, which has an adverse impact on the development and application of neural networks.

[0004] One way to solve the above problem is to deploy high-performance processors in the cloud to form a computing resource pool, which provides users with computing resource rental services. Users do not need to purchase high-performance processors to perform neural network training, thereby solving the problem of high costs for individual users and small and medium-sized enterprises to develop neural networks.

[0005] However, the infrastructure (e.g., topology) of the computing resource pool is usually not exposed to users, and the training efficiency of the neural network is closely related to the infrastructure of the computing resource pool. When the infrastructure is unclear, it is difficult for users to make appropriate choices. Summary of the invention

[0006] The present application provides a method and apparatus for training a neural network, which can provide a neural network training service to a user without exposing a computing resource pool to the user.

[0007] In a first aspect, a method for training a neural network is provided, comprising: determining the number of training parameters for a neural network training task; determining a target training resource from a training resource library according to the number of training parameters, wherein the training resource library includes at least one training resource, there is a corresponding relationship between the at least one training resource and the at least one parameter number, the at least one training resource includes a target training resource, and the at least one parameter number includes the number of training parameters for the neural network training task; and executing the neural network training task through the target training resource.

[0008] According to the method for training a neural network provided in the present application, a data center can determine target training resources from a training resource library based on a neural network training task, and can complete the neural network training task without providing the infrastructure of the resource pool to users, thereby reducing the risks caused by exposure of the infrastructure of the resource pool and improving the security of the data center.

[0009] In addition, users do not need to determine which training resources are needed to complete the neural network training task, they only need to send the requirements to the data center, thereby improving the user experience satisfaction.

[0010] Optionally, before determining the target training resources from the training resource library based on the number of training parameters, the method also includes: establishing a training resource library, wherein the target training resources include multiple computing units and transmission links between the multiple computing units, and the corresponding relationship includes an association relationship between the following three: the target training resources, at least one parameter number, and a parameter update rate of at least one parameter number.

[0011] The data center can establish a training resource library by testing itself, so as to obtain a training resource library that matches the actual situation of the data center.

[0012] Optionally, establishing a training resource library includes: updating multiple neural network parameters through target training resources, the number of the multiple neural network parameters is any one of the at least one parameter number mentioned above; determining parameter update rates of the multiple neural network parameters according to the update completion time of the multiple neural network parameters, the parameter update rates of the multiple neural network parameters are inversely proportional to the update completion time of the multiple neural network parameters; and saving the corresponding relationship between the parameter update rates of the multiple neural network parameters, the number of the multiple neural network parameters and the target training resources.

[0013] The data center can use small batches of data to update different numbers of neural network parameters on different training resources, obtain multiple parameter update rates, and record the relationship between training resources, number of parameters, and parameter update rates, so as to obtain a training resource database. Among them, for a fixed number of neural network parameters, the shorter the update completion time, the faster the update rate; the longer the update completion time, the slower the update rate.

[0014] Optionally, the neural network training task also includes a training model of the neural network training task and a specified number of sample iterations, where the number of sample iterations is the number of training samples required to be input to update a parameter once.

[0015] Determine a target training resource from a training resource library according to the number of training parameters, including: determine at least one candidate training resource corresponding to the number of training parameters from the training resource library according to a corresponding relationship; test the trained model on at least one candidate training resource to determine the parameter generation rate of at least one candidate training resource; determine a preferred sample iteration number of at least one candidate training resource according to the parameter generation rate, the preferred sample iteration number being the sample iteration number of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; determine from at least one candidate training resource a candidate training resource whose preferred sample iteration number is closest to the specified sample iteration number as the target training resource.

[0016] If the user specifies the training model and the number of iteration samples, the target training resources that meet the user's needs can be determined according to the above scheme. In some cases, the user knows the characteristics of the training model better than the data center, and the user can specify the number of iteration samples based on the characteristics of the training model. Therefore, the above scheme can improve the training efficiency of the neural network. The user can also specify the appropriate number of iteration samples based on the budget.

[0017] Optionally, the neural network training task also includes a training model for the neural network training task.

[0018] Determine a target training resource from a training resource library according to the number of training parameters, including: determine at least one candidate training resource corresponding to the number of training parameters from the training resource library according to a corresponding relationship; test the trained model on at least one candidate training resource to determine the parameter generation rate of at least one candidate training resource; determine a preferred sample iteration number of at least one candidate training resource according to the parameter generation rate, the preferred sample iteration number being the sample iteration number of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; determine the candidate training resource with the largest preferred sample iteration number from at least one candidate training resource as the target training resource.

[0019] If the user does not specify the number of iteration samples, the target training resources that meet the user's needs can be determined according to the above scheme.

[0020] Optionally, in the target training resource, the number of training samples carried by any one of the multiple computing units is proportional to a parameter update rate of the any one of the computing units.

[0021] The above scheme can reasonably allocate the number of samples carried by each computing unit of the target training resource.

[0022] In a second aspect, the present application provides a device for training a neural network, which can implement the functions corresponding to the various steps in the method involved in the first aspect, and the functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more units or modules corresponding to the above functions.

[0023] In one possible design, the device includes a processor configured to support the device to perform the corresponding functions in the method involved in the first aspect. The device may also include a memory, which is used to couple with the processor and store program instructions and data necessary for the device. Optionally, the device also includes a communication interface, which is used to support communication between the device and other devices.

[0024] In a third aspect, the present application provides a computer program product, comprising: a computer program code, when the computer program code is executed by a processor of a device for training a neural network (e.g., a server), the device for training a neural network executes the method of the first aspect.

[0025] In a fourth aspect, the present application provides a computer storage medium for storing computer software instructions used for the above-mentioned apparatus for training a neural network, which includes a program designed to execute the method of the first aspect.

[0026] In a fifth aspect, the present application provides a system for training a neural network, comprising the apparatus of the second aspect, the computer program product of the third aspect, and the computing storage medium of the fourth aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a schematic diagram of a ring suitable for use in the present application;

[0028] Figure 2 It is a schematic diagram of the initial state of each computing unit of the ring executing the ring aggregation algorithm;

[0029] Figure 3 is a schematic diagram of one step of the ring aggregation algorithm;

[0030] Figure 4 is a schematic diagram of another step of the ring aggregation algorithm;

[0031] Figure 5 is a schematic diagram of the end state of each computing unit of the ring executing the ring aggregation algorithm;

[0032] Figure 6 is a schematic diagram of a method for training a neural network provided in the present application;

[0033] Figure 7is a schematic diagram of a device for training a neural network provided by the present application;

[0034] Figure 8 is a schematic diagram of another apparatus for training a neural network provided by the present application;

[0035] Fig. 9 It is a schematic diagram of a system for training a neural network provided in the present application. DETAILED DESCRIPTION

[0036] In order to facilitate understanding of the technical solution of the present application, a brief introduction to the concepts involved in the present application is first given.

[0037] In order to improve the training efficiency of neural networks (especially deep neural networks), one method is to use a distributed training algorithm for training. The process of the distributed training algorithm is as follows:

[0038] 1. Each computing unit in a cluster composed of multiple computing units (also called "computing nodes") independently completes the calculation of its own mini-batch training data to obtain the gradient;

[0039] 2. All computing units in the cluster need to aggregate the calculated gradients to form aggregated gradients;

[0040] 3. Distribute the aggregated gradient to each computing unit in the cluster;

[0041] 4. Each computing unit calculates new neural network parameters based on the aggregated gradient and combined with hyperparameters such as learning rate. Neural network parameters are the parameters that make up the neural network model, which can also be referred to as "parameters" for short.

[0042] 5. All computing units can start the next round of iterative calculation only after obtaining new parameters.

[0043] In order to efficiently perform gradient aggregation, the ring allreduce algorithm is currently commonly used in academia and industry. The logical structure of the ring is as follows: Figure 1 shown.

[0044] Figure 1 In the embodiment, ring 100 includes 5 computing units, which are located in a system, which is a cluster formed by a device or multiple devices. Each computing unit can be a device or equipment, or multiple computing units are located in a device or equipment. The device or equipment can be various electronic devices, including but not limited to servers, mainframes, minicomputers, portable computers or terminals. Each unit can be a computing element in a device or equipment, such as a chip, a chipset or a circuit board carrying a chip or chipset.

[0045] The above-mentioned computing unit can be a neural-network processing unit (NPU), a graphics processing unit (GPU) or a central processing unit (CPU), or a field programmable gate array (FPGA) or other processors. Figure 1 The five computing units shown may be chips of the same type or chips of different types.

[0046] Each computing unit has a predecessor and a successor, and the position of each computing unit in the ring is determined by the creator of the ring (e.g., user software). For example, the predecessor of computing unit 0 is computing unit 4, and the successor of computing unit 0 is computing unit 1. Each computing unit can receive data from the predecessor of the computing unit and can also send its own data to the successor of the computing unit.

[0047] by Figure 1 Taking the ring 100 shown as an example, in the preparation stage of the ring aggregation algorithm, the creator of the ring 100 (for example, user software) sends control information to each computing unit to slice the data, and the gradient data calculated by each computing unit is equally divided into 5 blocks. Figure 1 The gradient data calculated by the five calculation units shown are a, b, c, d and e respectively. Each calculation unit has its own complete data calculated. The initial state of the five calculation units is as follows: Figure 2 shown.

[0048] Subsequently, the five computing units enter the scatter reduce phase, where each computing unit sends a piece of its own data to its subsequent unit and aggregates the data received from the preceding unit and its own stored data.

[0049] Figure 3 A step in the hash aggregation phase is shown. In this step, computing unit 0 sends data chunk a0 to computing unit 1. After computing unit 1 receives data chunk a0, it aggregates a0 and its own stored data chunk a1. At the same time, computing unit 1 sends data chunk b1 to computing unit 2. After computing unit 2 receives data chunk b1, it aggregates b1 and its own stored data chunk b2. The operations of other computing units are similar.

[0050] Figure 4Another step of the hash aggregation phase is shown. In this step, taking computing unit 0 as an example, computing unit 0 receives data b4+b3+b2+b1 from the preceding unit (computing unit 4), and performs aggregation operation on the data and its own stored data b0, and the obtained aggregation operation result is b0+b1+b2+b3+b4. While receiving the data b4+b3+b2+b1, computing unit 0 sends its own stored data c0+c4+c3+c2 to the subsequent unit (computing unit 1) so that the subsequent unit can perform gradient aggregation operation.

[0051] After the hash aggregation phase is completed, the ring aggregation algorithm proceeds to the next step, that is, the all gather phase. In the all gather phase, ring 100 sends the final results obtained by each computing unit to other computing units through 4 passes. For example, the final result obtained by computing unit 0 for the aggregation operation on data b is b0+b1+b2+b3+b4, then AI computing node 0 passes the result to computing unit 1, computing unit 1 passes the result to computing unit 2, and so on. After 4 passes, each computing unit obtains the final result of the aggregation operation of data b. Similarly, for the other 4 data (a, c, d and e), after 4 passes, each computing unit also obtains the final result of the aggregation operation of each data, such as Figure 5 shown.

[0052] From the above training algorithm, it can be seen that in the distributed training scheme, there are two factors that affect the efficiency of neural network training. One is the computing power of each computing unit, for example, the rate at which the computing unit generates gradients by processing a fixed number of training samples; the other is the transmission capacity between each computing unit, for example, the rate at which gradients are transmitted between two computing units. For a data center that provides a computing resource pool (hereinafter referred to as a "resource pool"), the computing power of the computing unit and the transmission rate between the computing units are both training resources.

[0053] Below, the method for training a neural network provided by the present application will be described in detail using ring 100 as an example. It should be noted that the method provided by the present application is not limited to Figure 1 The ring-shaped distributed architecture shown, the method provided in this application can be applied to any distributed training architecture, for example, a reduce-tree.

[0054] Figure 6 A schematic diagram of a method for training a neural network provided by the present application is shown.

[0055] Figure 6In the method 600 shown, the data center includes three modules, namely, a training module, an adaptive module, and a resource library management module. These three modules are only modules divided from the functional point of view, which can be independent modules or submodules of the same module. In addition, these three modules can be hardware circuits or software programs. The specific forms of these three modules in this application are not limited.

[0056] The data center can provide neural network training services to users by performing the following steps.

[0057] S601, establishing a training resource library.

[0058] Before providing neural network training services to users, the data center must first determine the correspondence between training resources and the number of neural network parameters (referred to as "parameter number", where neural network parameters can be referred to as "parameters"), that is, establish a training resource library. In this application, the training resource library refers to a database containing the above correspondence, and the above correspondence is not limited to the correspondence between training resources and parameter numbers. For example, the above correspondence may also include training resources, parameter numbers, and parameter update rates corresponding to the parameter numbers.

[0059] The above correspondence can be interpreted as follows: for a set of fixed number of parameters, different training resources in the resource pool are used to update the set of parameters. If the update of the set of parameters is completed, it is determined that there is a correspondence between the training resources and the number of the set of parameters.

[0060] The data center may determine the above correspondence by means of testing (ie, detection).

[0061] For example, a data center can obtain resources from a resource pool such as Figure 1 In the ring 100 shown, for a set of fixed number of parameters, the data center can deploy the set of parameters on the ring 100 for update testing, and obtain the parameter update rate according to the update completion time of the set of parameters. By testing different numbers of parameters on the ring 100, the association relationship between the ring 100 and different numbers of parameters and different parameter update rates can be obtained. By testing a set of fixed number of parameters on different training resources, the association relationship between the number of the set of parameters, different training resources and different parameter update rates can be obtained.

[0062] Optionally, the data center can input different numbers of training samples (including adjusting the number of training samples input by each computing unit) to obtain different parameter update rates, and save the preferred parameter update rate to the training resource library. The preferred parameter update rate refers to the parameter update rate when the parameter generation rate of the training resource matches the parameter transmission rate. The preferred parameter update rate corresponds to a preferred number of sample iterations. For example, a fixed number of parameters are tested on ring 100, and 1000 samples are input at a time to obtain parameter update rate A; 1500 samples are input at a time to obtain parameter update rate B; 2000 samples are input at a time to obtain parameter update rate C; if B is the largest among the three values ​​ABC, then B is used as the parameter update rate corresponding to ring 100, and the number 2000 is the preferred number of iterative samples of ring 100.

[0063] In this application, the number of sample iterations is the number of training samples required to be input to update a parameter once.

[0064] In the above example, the reason why A is smaller than B may be that the number of input samples is small, and the computing power (parameter generation rate) of ring 100 is smaller than the transmission capacity (parameter transmission rate); the reason why C is smaller than B may be that the number of input samples is too large, and the computing power of ring 100 is greater than the transmission capacity. Therefore, only when the computing power of the training resource matches the transmission capacity (the same or approximately the same), the parameter update rate of the training resource is the fastest.

[0065] After the test is completed, the resource library management module records the corresponding relationship between the parameter quantity, training resources and training rate, thereby establishing a training resource library.

[0066] The corresponding relationship can be in the following form.

[0067] Correspondence relationship 1: [(ring 0: GPU0, GPU1, GPU2; (parameter update rate 11, parameter 11), (parameter update rate 12, parameter 12), (parameter update rate 13, parameter 13)].

[0068] Corresponding relationship 2: [(ring 1: GPU1, GPU2, GPU3; (parameter update rate 21, parameter 21), (parameter update rate 22, parameter 22), (parameter update rate 23, parameter 23)].

[0069] Corresponding relationship 3: [(ring 2: GPU0, GPU2, GPU3; (parameter update rate 31, parameter 31), (parameter update rate 32, parameter 32), (parameter update rate 33, parameter 33)].

[0070] In the above correspondence, the parameters in the same correspondence are different, and the parameters in different correspondences can be the same or different. For example, parameter 11, parameter 12 and parameter 13 are different from each other; parameter 11, parameter 21 and parameter 31 can be the same or different.

[0071] It should be understood that S601 is only an optional implementation of the technical solution of the present application, and in some cases, the data center does not need to execute S601. For example, the manufacturer of the computing unit pre-configures the corresponding relationship in the resource library of the data center based on empirical data.

[0072] S602, obtaining a neural network training task.

[0073] The data center determines the user's needs based on the training task, such as the number of parameters of the neural network to be trained (ie, the "number of training parameters" in the claims). The user's needs may also include other information.

[0074] For example, a user can specify a training model of a neural network. The data center first determines at least one candidate training resource from a training resource library based on the number of training parameters. Subsequently, the data center tests the training model on the at least one candidate training resource to obtain a parameter generation rate of the at least one candidate training resource.

[0075] The above-mentioned test training model refers to: deploying a user-specified training model on a candidate training resource, inputting a small batch of samples, generating parameters (eg, gradients), and obtaining a parameter generation rate (eg, a gradient generation rate).

[0076] Subsequently, the data center determines a preferred number of sample iterations for at least one candidate training resource based on the parameter generation rate, where the preferred number of sample iterations is the number of sample iterations for the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate.

[0077] Due to the different complexities of different training models, the number of sample iterations of different training models when the parameter update rate is maximum on the same training resources is different. Therefore, it is impossible to pre-store the preferred number of sample iterations of candidate training resources in the training resource library. It is necessary to test the training model specified by the user to determine the preferred number of sample iterations of the candidate training resources.

[0078] The testing process is as follows: deploy the user-specified training model on the candidate training resources and input different numbers of samples. When the actual parameter generation rate matches (is equal or approximately equal to) the parameter update rate of the candidate training resources stored in the training resource library, the number of samples input into the training model is the preferred sample iteration number of the candidate training resources.

[0079] The preferred sample iteration numbers of multiple candidate training resources are tested, and the candidate training resource with the largest preferred sample iteration number is determined as the target training resource from the multiple candidate training resources.

[0080] If the user specifies the number of sample iterations, the data center determines, from among multiple candidate training resources, a candidate training resource whose number of sample iterations is closest to the number of sample iterations specified by the user as the target training resource.

[0081] For example, there are currently two candidate training resources, the preferred sample iteration number of candidate training resource A is 5, and the preferred sample iteration number of candidate training resource B is 8. If the user-specified sample iteration number is 7, candidate training resource A is determined as the target training resource; if the user-specified sample iteration number is 6, candidate training resource A is determined as the target training resource.

[0082] As an optional example, the user can specify the training model and model training rate of the neural network in the training task according to the budget. When the budget is high, a faster model training rate can be specified; when the budget is low, a slower model training rate can be specified. The data center can determine the training resources that match the training rate required by the user as the target training resources through small batch data testing.

[0083] As another optional example, the user may also specify a training model and training resources for the neural network.

[0084] The data center determines the target training resources based on the user's needs, thereby satisfying different users and improving user satisfaction.

[0085] The data center determines the training resources (ie, target training resources) corresponding to the requirements from the training resource library according to the requirements. For example, S605 and S606 are executed.

[0086] S605: query the resource library according to the demand to obtain candidate training resources.

[0087] S606: Determine a target training resource from the candidate training resources.

[0088] In S605, the adaptive module may send a query message to the resource library management module. After the resource library management module obtains the query message, it queries one or more training resources that correspond to the user's needs (for example, the number of training parameters) from the resource library, that is, obtains at least one candidate training resource. Subsequently, the resource library management module sends an information list containing at least one candidate training resource to the adaptive module, and the adaptive module determines the target training resource from the information list. For example, the adaptive module can determine the target training resource from the candidate training resources according to the relevant description above based on the specific needs of the user.

[0089] By executing S605 and S606, the data center can determine the target training resources from the training resource library according to the neural network training task, and complete the neural network training task without providing the infrastructure of the resource pool to the user, thereby reducing the risk caused by the exposure of the infrastructure of the resource pool and improving the security of the data center.

[0090] In addition, users do not need to determine which training resources are needed to complete the neural network training task, they only need to send the requirements to the data center, thereby improving the user experience satisfaction.

[0091] After the adaptive module determines the target resource, S607 may be executed.

[0092] S607: The adaptive module sends information about target training resources to the training module.

[0093] The information of the target training resource includes, for example, the type and quantity of computing units, the transmission links between the computing units, and the preferred number of sample iterations of the target training resource.

[0094] After receiving the information of the target training resource, the training module executes S608.

[0095] S608: Execute the training task according to the information of the target training resource.

[0096] Optionally, the training module may adjust the number of samples deployed on each computing unit to obtain a preferred training rate.

[0097] Taking ring 100 as an example, if the parameter generation rate of computing unit 0 is 5 gradients per second and the parameter generation rate of computing unit 1 is 8 gradients per second, fewer samples can be deployed on computing unit 0 and more samples can be deployed on computing unit 1.

[0098] The above describes in detail an example of a method for training a neural network provided by the present application. It is understandable that, in order to achieve the above functions, the device for training a neural network includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0099] The present application can divide the functional units of the apparatus for training a neural network according to the above method example. For example, each function can be divided into each functional unit, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.

[0100] In the case of an integrated unit, Figure 7 A possible structural diagram of the apparatus for training a neural network provided in the present application is shown. The apparatus 700 includes: a processing unit 701. The processing unit 701 is used to control the apparatus 700 to execute Figure 6 The processing unit 701 may also be used to execute other processes of the technology described herein. The apparatus 700 may also include an input / output unit 702 for communicating with other devices (e.g., user equipment), and a storage unit 703 for storing program codes and data of the apparatus 700.

[0101] For example, the processing unit 701 is used to execute:

[0102] Determine the number of training parameters for the neural network training task;

[0103] Determine a target training resource from a training resource library according to the number of training parameters, wherein the training resource library includes at least one training resource, there is a corresponding relationship between the at least one training resource and the at least one parameter number, the at least one training resource includes the target training resource, and the at least one parameter number includes the number of training parameters of the neural network training task;

[0104] The neural network training task is performed through the target training resource.

[0105] The processing unit 701 may be a processor or a controller, for example, a CPU, a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements a computing function, for example, a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The input-output unit 702 may be, for example, a communication interface, and the storage unit 703 may be a memory.

[0106] When the processing unit 701 is a processor, the input and output unit 702 is a communication interface, and the storage unit 703 is a memory, the apparatus for training a neural network involved in the present application can be Figure 8 The device shown.

[0107] See also Figure 8 As shown, the device 800 includes: a processor 801, a communication interface 802 (optional) and a memory 803 (optional). The processor 801, the communication interface 802 and the memory 803 can communicate with each other through an internal connection path to transmit control and / or data signals.

[0108] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0109] Therefore, the device for training a neural network provided in the present application can determine the target training resources from the training resource library according to the neural network training task, and can complete the neural network training task without providing the user with the infrastructure of the resource pool, thereby reducing the risks caused by exposure of the infrastructure of the resource pool and improving the security of the data center.

[0110] In addition, users do not need to determine which training resources are needed to complete the neural network training task, they only need to send the requirements to the data center, thereby improving the user experience satisfaction.

[0111] See also Fig. 9 , the present application also provides a system architecture 200 for training a neural network.

[0112] The server 210 is configured with an input / output (I / O) interface 212 for data exchange with an external device (e.g., a client device 230), and a "user" can input a neural network training task to the I / O interface 212 through the client device 230. The server 210 is, for example, a data center.

[0113] The server 210 can call data, codes, etc. in the data storage system 240 , and can also store data, instructions, etc. in the data storage system 250 .

[0114] Processor 211 may use Figure 6 The method 600 shown is for training a neural network. For specific processing, see Figure 6 Related description.

[0115] The training device 220 is used to train the neural network according to the command of the processor 211. The training device 220 is, for example, Figure 1 The various computing units shown, among which the training device 220 is used to process neural network training tasks, can also be considered as the processor of the server 210.

[0116] Finally, the I / O interface 212 returns the processing result (eg, the trained neural network) to the client device 240 for the user.

[0117] exist Fig. 9 In the case shown in , the user can manually specify the data input into the server 210, for example, by operating in the interface provided by the I / O interface 212. In another case, the client device 230 can automatically input data into the I / O interface 212 and obtain the result. If the client device 230 needs to obtain the user's authorization to automatically input data, the user can set the corresponding authority in the client device 230. The user can view the result output by the processor 210 on the client device 230, and the specific presentation form can be, for example, displaying the output result on the screen. The client device 230 can also serve as a data acquisition terminal to store the collected data (for example, training samples) in the data storage system 240.

[0118] It is worth noting that Fig. 9 This is only a schematic diagram of a system architecture provided by an embodiment of the present invention. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation to the technical solution of the present application. For example, Fig. 9 In the embodiment, the data storage system 240 is an external memory relative to the server 210. Optionally, the data storage system 240 may also be placed in the server 210. Similarly, the training device 200 may also be placed in the server 210.

[0119] In each embodiment of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the present application.

[0120] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0121] The steps of the method or algorithm described in conjunction with the disclosure of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, read-only compact disks (CD-ROMs) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0123] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only the specific implementation methods of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present application should be included in the scope of protection of the present application.

Claims

1. A method for training a neural network, characterized in that: The method is applied to a data center, comprising: Establishing a training resource library, wherein the training resource library includes at least one training resource, and there is a corresponding relationship between the at least one training resource, at least one parameter quantity, and a parameter update rate of the at least one parameter quantity; Determine the number of training parameters and training model for the neural network training task; Determine at least one candidate training resource from the training resource library according to the number of training parameters, the at least one training resource includes the at least one candidate training resource, and the at least one parameter number includes the number of training parameters of the neural network training task; Testing the training model on the at least one candidate training resource to determine a parameter generation rate of the at least one candidate training resource; Determine a preferred number of sample iterations of the at least one candidate training resource according to a parameter generation rate of the at least one candidate training resource, wherein the preferred number of sample iterations is the number of sample iterations of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; Determining a target training resource from the at least one candidate training resource according to the preferred sample iteration number of the at least one candidate training resource; The neural network training task is performed by using the target training resource.

2. The method according to claim 1, characterized in that The target training resources include multiple computing units and transmission links between the multiple computing units, and the corresponding relationship includes an association relationship between the following three: the target training resources, the at least one parameter quantity, and the parameter update rate of the at least one parameter quantity.

3. The method according to claim 2, characterized in that The step of establishing the training resource library comprises: Updating a plurality of neural network parameters by using the target training resource, wherein the number of the plurality of neural network parameters is any one of the at least one parameter number; Determining a parameter update rate of the plurality of neural network parameters according to the update completion time of the plurality of neural network parameters, wherein the parameter update rate of the plurality of neural network parameters is inversely proportional to the update completion time of the plurality of neural network parameters; The corresponding relationship between the parameter update rate of the plurality of neural network parameters, the quantity of the plurality of neural network parameters and the target training resource is saved.

4. The method according to claim 2 or 3, characterized in that: The neural network training task also includes a training model of the neural network training task and a specified number of sample iterations, where the number of sample iterations is the number of training samples required to input a parameter update. The step of determining the target training resource from the training resource library according to the number of training parameters includes: Determining at least one candidate training resource corresponding to the number of training parameters from the training resource library according to the corresponding relationship; Testing the training model on the at least one candidate training resource to determine a parameter generation rate of the at least one candidate training resource; Determine a preferred number of sample iterations of the at least one candidate training resource according to the parameter generation rate, wherein the preferred number of sample iterations is the number of sample iterations of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; A candidate training resource whose preferred number of sample iterations is closest to the specified number of sample iterations is determined from the at least one candidate training resource as the target training resource.

5. The method according to claim 2 or 3, characterized in that: The neural network training task also includes a training model for the neural network training task. The step of determining the target training resource from the training resource library according to the number of training parameters includes: Determining at least one candidate training resource corresponding to the number of training parameters from the training resource library according to the corresponding relationship; Testing the training model on the at least one candidate training resource to determine a parameter generation rate of the at least one candidate training resource; Determine a preferred number of sample iterations of the at least one candidate training resource according to the parameter generation rate, wherein the preferred number of sample iterations is the number of sample iterations of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; Determine, from the at least one candidate training resource, a candidate training resource with the largest number of preferred sample iterations as the target training resource.

6. The method according to any one of claims 1 to 3, characterized in that In the target training resource, the number of training samples carried by any one of the multiple computing units is proportional to the parameter update rate of the any one of the computing units.

7. A device for training a neural network, characterized in that: The device is applied to a data center and includes a processing unit for: Establishing a training resource library, wherein the training resource library includes at least one training resource, and there is a corresponding relationship between the at least one training resource, at least one parameter quantity, and a parameter update rate of the at least one parameter quantity; Determine the number of training parameters and training model for the neural network training task; Determine at least one candidate training resource from the training resource library according to the number of training parameters, the at least one training resource includes the at least one candidate training resource, and the at least one parameter number includes the number of training parameters of the neural network training task; Testing the training model on the at least one candidate training resource to determine a parameter generation rate of the at least one candidate training resource; Determine a preferred number of sample iterations of the at least one candidate training resource according to a parameter generation rate of the at least one candidate training resource, wherein the preferred number of sample iterations is the number of sample iterations of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; Determining a target training resource from the at least one candidate training resource according to the preferred sample iteration number of the at least one candidate training resource; The neural network training task is performed by using the target training resource.

8. The device according to claim 7, characterized in that The target training resources include multiple computing units and transmission links between the multiple computing units, and the corresponding relationship includes an association relationship between the following three: the target training resources, the at least one parameter quantity, and the parameter update rate of the at least one parameter quantity.

9. The device according to claim 8, characterized in that The processing unit is specifically used for: Updating a plurality of neural network parameters by using the target training resource, wherein the number of the plurality of neural network parameters is any one of the at least one parameter number; Determining a parameter update rate of the plurality of neural network parameters according to the update completion time of the plurality of neural network parameters, wherein the parameter update rate of the plurality of neural network parameters is inversely proportional to the update completion time of the plurality of neural network parameters; The corresponding relationship between the parameter update rate of the plurality of neural network parameters, the quantity of the plurality of neural network parameters and the target training resource is saved.

10. The device according to claim 8 or 9, characterized in that The neural network training task also includes a training model of the neural network training task and a specified number of sample iterations, where the number of sample iterations is the number of training samples required to input a parameter update. The processing unit is specifically used for: Determining at least one candidate training resource corresponding to the number of training parameters from the training resource library according to the corresponding relationship; Testing the training model on the at least one candidate training resource to determine a parameter generation rate of the at least one candidate training resource; Determine a preferred number of sample iterations of the at least one candidate training resource according to the parameter generation rate, wherein the preferred number of sample iterations is the number of sample iterations of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; A candidate training resource whose preferred number of sample iterations is closest to the specified number of sample iterations is determined from the at least one candidate training resource as the target training resource.

11. The device according to claim 8 or 9, characterized in that The neural network training task also includes a training model for the neural network training task. The processing unit is specifically used for: Determining at least one candidate training resource corresponding to the number of training parameters from the training resource library according to the corresponding relationship; Testing the training model on the at least one candidate training resource to determine a parameter generation rate of the at least one candidate training resource; Determine a preferred number of sample iterations of the at least one candidate training resource according to the parameter generation rate, wherein the preferred number of sample iterations is the number of sample iterations of the candidate training resource when the parameter generation rate of the candidate training resource matches the parameter update rate; Determine, from the at least one candidate training resource, a candidate training resource with the largest number of preferred sample iterations as the target training resource.

12. The device according to any one of claims 7 to 9, characterized in that In the target training resource, the number of training samples carried by any one of the multiple computing units is proportional to the parameter update rate of the any one of the computing units.

13. A system for training a neural network, characterized in that: The method comprises a processor, a plurality of computing units and a memory, wherein the processor is used to execute the method according to any one of claims 1 to 6 based on instructions stored in the memory to determine the target training resource; The multiple computing units are used to: execute the neural network training task through the target training resource.

Citation Information

Patent Citations

  • Resource scheduling method and device for data centre

    CN106201723A

  • Method, device and system for training deep neural networks

    CN107688493A

  • Method and System for Anatomical Object Detection Using Marginal Space Deep Neural Networks

    US20160174902A1

  • Apparatus and method for training a neural network language model, speech recognition apparatus and method

    US20180068652A1

  • Method and computer for determination of a training function for generating annotated training images

    US20180174049A1