Method and apparatus for training neural network, and device and storage medium

WO2024104232A8PCT designated stage expired Publication Date: 2024-10-31DOUYIN VISION CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/130540
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-11-15
Filing Date
2023-11-08
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

Existing data parallel methods are difficult to achieve linear acceleration when training neural networks due to frequent communication interactions between multiple working nodes, and the introduction of gradient delays will affect the convergence and accuracy of the model.

Method used

By dividing the network layers of the neural network into two groups, the local gradients of the current training step and the previous training step are obtained respectively, and the gradient delay is only introduced to some network layers to hide the communication overhead, and reduce the gradient delay through gradient prediction and buffer optimization. impact on the model.

Benefits of technology

It achieves the convergence and accuracy of the model while hiding communication overhead, and improves the efficiency and speed of neural network training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023130540_31102024_PF_FP_ABST
    Figure CN2023130540_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a method and apparatus for training a neural network, and a device and a storage medium. The method comprises: at a first working node among a plurality of working nodes, acquiring a first set of global gradients for a first set of network layers in a neural network, the first set of global gradients being obtained from aggregating local gradients determined by the plurality of working nodes for the first set of network layers in the current training step, and the plurality of working nodes being configured to jointly train the neural network; acquiring a second set of global gradients for a second set of network layers in the neural network, the second set of network layers being different from the first set of network layers, and the second set of global gradients being obtained from aggregating local gradients determined by the plurality of working nodes for the second set of network layers in a training step previous to the current training step; and updating parameters of the neural network on the basis of the first set of global gradients and the second set of global gradients. In this way, convergence and accuracy of the trained neural network may be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Method, apparatus, device and storage medium for training neural network

[0001] This application claims priority to the Chinese invention patent application with application number 202211431463.4 filed on November 15, 2022, entitled “Methods, devices, equipment and storage media for training neural networks”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, apparatuses, devices, and computer-readable storage media for training neural networks. Background Art

[0003] With the rapid development of computer technology, neural networks (NNs) are increasingly used in fields such as computer vision and natural language processing. At the same time, the exponential growth in model size and data volume makes training neural networks more time-consuming and resource-intensive.

[0004] Currently, a common method for accelerating neural network training is data parallelism, which uses multiple computing devices to train the neural network. Although data parallelism significantly speeds up training, it is difficult to achieve linear acceleration due to the frequent communication interactions between multiple computing devices.

[0005] Summary of the Invention

[0006] According to a first aspect of the present disclosure, a method for training a neural network is provided. In this method, at a first working node among a plurality of working nodes, a first set of global gradients for a first set of network layers in the neural network is obtained. The first set of global gradients is obtained by aggregating local gradients determined by the plurality of working nodes for the first set of network layers in a current training step. The plurality of working nodes are configured to jointly train the neural network. Furthermore, a second set of global gradients for a second set of network layers in the neural network is obtained. The second set of network layers is different from the first set of network layers. The second set of global gradients is obtained by aggregating local gradients determined by the plurality of working nodes for the second set of network layers in a previous training step before the current training step. Furthermore, parameters of the neural network are updated based on the first set of global gradients and the second set of global gradients.

[0007] According to a second aspect of the present disclosure, a device for training a neural network is provided. The device includes a first acquisition module, a second acquisition module, and an update module. The first acquisition module is configured to: obtain a first set of global gradients for a first group of network layers in the neural network at a first working node among a plurality of working nodes, the first set of global gradients being obtained by aggregating local gradients determined by a plurality of working nodes for the first group of network layers in a current training step, and the plurality of working nodes being configured to jointly train the neural network. The second acquisition module is configured to: obtain a second set of global gradients for a second group of network layers in the neural network, the second group of network layers being different from the first group of network layers, the second set of global gradients being obtained by aggregating local gradients determined by a plurality of working nodes for the second group of network layers in a previous training step before the current training step. The update module is configured to: update the parameters of the neural network based on the first set of global gradients and the second set of global gradients.

[0008] According to a third aspect of the present disclosure, an electronic device is provided. The electronic device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the electronic device to perform the method according to the first aspect of the present disclosure.

[0009] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to perform the method according to the first aspect of the present disclosure.

[0010] It should be understood that the contents described in the summary of the present invention are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent hereinafter with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0012] FIG1 shows a schematic diagram of an example environment in which embodiments of the present disclosure can be implemented;

[0013] FIG2 shows a flowchart of a method for training a neural network according to some embodiments of the present disclosure;

[0014] FIG3 illustrates a neural network training pipeline according to some embodiments of the present disclosure;

[0015] FIG4 shows a block diagram of an example apparatus for training a neural network according to some embodiments of the present disclosure; and

[0016] FIG5 illustrates a block diagram illustrating a computing device in which one or more embodiments of the present disclosure may be implemented. DETAILED DESCRIPTION

[0017] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0018] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, i.e., "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below.

[0019] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.

[0020] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0021] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.

[0022] As an optional but non-limiting implementation, in response to receiving a user's active request, a prompt message may be sent to the user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form. Furthermore, the pop-up window may also include a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0023] It is understandable that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0024] As used herein, the term "in response to" refers to a state in which a corresponding event occurs or a condition is satisfied. It will be understood that the timing of executing a subsequent action executed in response to the event or condition is not necessarily strongly correlated with the time when the event occurs or the condition is satisfied. For example, in some cases, a subsequent action may be executed immediately upon the occurrence of the event or the satisfaction of the condition; in other cases, the subsequent action may be executed some time after the occurrence of the event or the satisfaction of the condition.

[0025] As used herein, the term "model" can learn the association between corresponding inputs and outputs from training data, so that after training is completed, corresponding outputs can be generated for given inputs. The generation of the model can be based on machine learning technology. Deep learning is a machine learning algorithm that processes inputs and provides corresponding outputs by using multiple layers of processing units. A neural network model is an example of a model based on deep learning. In this article, a "model" may also be referred to as a "machine learning model", "learning model", "machine learning network" or "learning network", and these terms are used interchangeably in this article.

[0026] A "neural network" is a machine learning network based on deep learning. A neural network is capable of processing inputs and providing corresponding outputs, and typically includes an input layer and an output layer, as well as one or more hidden layers between the input layer and the output layer. Neural networks used in deep learning applications typically include many hidden layers, thereby increasing the depth of the network. The layers of a neural network are connected in sequence so that the output of the previous layer is provided as input to the next layer, wherein the input layer receives the input of the neural network, and the output of the output layer serves as the final output of the neural network. Each layer of a neural network includes one or more nodes (also referred to as processing nodes or neurons), each of which processes the input from the previous layer. In the context of the present disclosure, the input layer, output layer, and hidden layer may also be referred to individually or collectively as network layers.

[0027] Generally speaking, machine learning can be roughly divided into three stages, namely the training stage, the testing stage, and the application stage (also known as the inference stage). In the training stage, a given model can be trained using a large amount of training data, and the parameter values ​​are continuously updated iteratively until the model can obtain consistent inferences that meet the expected goals from the training data. Through training, the model can be considered to be able to learn the association between input and output (also known as input-to-output mapping) from the training data. The parameter values ​​of the trained model are determined. In the testing stage, the test input is applied to the trained model to test whether the model can provide the correct output, thereby determining the performance of the model. In the application stage, the model can be used to process the actual input based on the parameter values ​​obtained through training to determine the corresponding output.

[0028] FIG1 illustrates a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. Environment 100 relates to a data-parallel neural network training environment, comprising N worker nodes 110-1, 110-2, ..., 110-N (where N is an integer greater than 1) and a service node 120. Worker nodes 110-1, 110-2, ..., 110-N can each maintain a local training dataset 112-1, 112-2, ..., 112-N and be configured to jointly train a neural network. For ease of discussion, worker nodes 110-1, 110-2, ..., 110-N may be individually or collectively referred to as worker nodes 110, and local training datasets 112-1, 112-2, ..., 112-N may be individually or collectively referred to as local training datasets 112.

[0029] Data Parallelism is an acceleration method for neural network training. In data parallel neural network training, the training task is divided into multiple worker nodes 110. Each worker node 110 maintains the same model parameters and the same computing tasks, but processes different training data. The service node 120 can aggregate the gradient data at each worker node 110 and synchronize the aggregated gradient data to each worker node 110. In this way, the training and calculation under the same global training data are divided into different worker nodes 110, thereby reducing the computing and storage pressure at a single worker node 110. Worker nodes are sometimes also referred to as clients, worker node devices, clients, terminal nodes, terminal devices, edge devices, etc.

[0030] In data-parallel neural network training, worker nodes 110 store their own local neural networks 132, such as local neural networks 132-1, 132-2, ..., 132-N (hereinafter referred to individually or collectively as local neural networks 132 for ease of discussion). Worker nodes 110 perform local training using their corresponding local training datasets 112. Worker nodes 110 send the gradients for each network layer determined during local training to service node 120. Service node 120 aggregates the gradients from each worker node 110 to obtain a global gradient and synchronizes the aggregated global gradient to each worker node 110. Worker nodes 110 can update local neural networks 132 based on the synchronized global gradient to perform the next training step. The above process can be repeated until neural network training converges. Because the corresponding neural networks ultimately trained at each worker node 110 are identical, for ease of description, the local neural networks may also be referred to as neural networks below.

[0031] In some embodiments, working node 110 and / or service node 120 can be implemented at terminal device or server.Terminal device can be any type of mobile terminal, fixed terminal or portable terminal, including mobile phone, desktop computer, laptop computer, notebook computer, netbook computer, tablet computer, media computer, multimedia tablet, personal communication system (PCS) equipment, personal navigation device, personal digital assistant (PDA), audio / video player, digital camera / camcorder, positioning device, television receiver, radio broadcast receiver, e-book device, gaming device or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof.In some embodiments, terminal device can also support any type of interface (such as " wearable " circuit etc.) for user.Server is the computing system / server of various types that can provide computing power, including but not limited to mainframe, edge computing node, computing device in cloud environment, etc.

[0032] It should be understood that FIG1 merely illustrates an exemplary data-parallel neural network training environment. Depending on the neural network training and actual application requirements, the environment may also vary. For example, although service node 120 is shown as a separate node in FIG1 , in certain applications, service node 120 may function as a worker node 110 for local training, in addition to serving as a central node. The scope of the present disclosure is not limited in this respect.

[0033] As described above, although data-parallel neural network training methods can significantly accelerate training, the frequent communication interactions required between multiple working nodes 110 make it difficult for this method to achieve a linear acceleration effect. Currently, existing methods use the gradients determined in the previous training step to update all network layers of the neural network in the current training step to eliminate the dependency between the gradient communication process and the computation process of the current training step, and hide the communication overhead by constructing a pipeline that parallelizes communication and computation. However, introducing gradient delays for all network layers of the neural network can adversely affect the convergence and accuracy of the model.

[0034] After research, the inventors found that: due to the hierarchical structure of the neural network and the reverse order of forward propagation and backpropagation, it is only necessary to introduce gradients for some network layers in the neural network rather than all network layers to hide the communication overhead. In this regard, the embodiments of the present disclosure propose an improved neural network training scheme based on gradient delay. Specifically, according to the embodiments of the present disclosure, the network layers in the neural network are divided into a first group of network layers and a second group of network layers, and a first group of gradients for the first group of network layers and a second group of gradients for the second group of network layers are obtained respectively, wherein the first group of gradients is obtained by aggregating local gradients determined by multiple working nodes 110 for the first group of network layers in the current training step, and the second group of gradients is obtained by aggregating local gradients determined by multiple working nodes 110 for the second group of network layers in the previous training step. Furthermore, the parameters of the neural network are updated based on the first group of gradients and the second group of gradients.

[0035] As will be more clearly understood from the following description, according to embodiments of the present disclosure, communication overhead is hidden by introducing gradient delays only for a subset of network layers in a neural network. In this way, the impact of the introduced gradient delays on model convergence and accuracy can be minimized, thereby ensuring model convergence and accuracy while hiding communication overhead.

[0036] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.

[0037] Partial delay

[0038] FIG2 shows a flow chart of a method 200 for training a neural network according to some embodiments of the present disclosure. In some embodiments, the method 200 may be performed by the worker node 110 shown in FIG1 . It should be understood that the method 200 may include additional blocks not shown and / or may omit one (or some) of the blocks shown, and the scope of the present disclosure is not limited in this respect.

[0039] In block 202, worker node 110 obtains a first set of global gradients for a first set of network layers in a neural network. This first set of global gradients is obtained by aggregating local gradients determined by multiple worker nodes 110 for the first set of network layers in a current training step. That is, the global gradients for the first set of network layers are not delayed. In block 204, worker node 110 obtains a second set of global gradients for a second set of network layers in the neural network. The second set of network layers is different from the first set of network layers. This second set of global gradients is obtained by aggregating local gradients determined by multiple worker nodes 110 for the second set of network layers in a previous training step prior to the current training step. That is, the gradients for the second set of network layers are delayed. In some embodiments, the previous training step may be the previous training step before the current training step. It should be understood that the previous training step may also include any other suitable training step prior to the current training step, and the scope of the present disclosure is not limited in this respect.

[0040] For ease of explanation, the following description will refer to FIG3 . FIG3 illustrates a neural network training pipeline 300 according to some embodiments of the present disclosure. The pipeline 300 is illustrated using a neural network having three network layers as an example. It should be understood that the solutions according to the embodiments of the present disclosure can be applied to neural networks having any other suitable number of network layers, and the scope of the present disclosure is not limited in this respect.

[0041] In the example of Figure 3, the first group of network layers includes the output layer of the neural network, i.e., the third network layer. The second group of network layers includes the first two network layers from the input layer of the neural network, i.e., the first network layer and the second network layer. As shown in Figure 3, blocks 302-1, 302-2, and 302-3 schematically illustrate the backpropagation computation process for the first network layer, the second network layer, and the third network layer of the neural network, respectively, during the current training step. Note that since the backpropagation computation process begins from the output layer and propagates backward to the input layer, i.e., first calculating the gradient for the third network layer, then calculating the gradient for the second network layer, and finally calculating the gradient for the first network layer, block 302-3 is shown before block 302-2 in Figure 3, and block 302-2 is shown before block 302-1. Blocks 304-1, 304-2, and 304-3 schematically illustrate the forward propagation computation process for the first network layer, the second network layer, and the third network layer of the neural network, respectively, during the next training step following the current training step. Blocks 306-1, 306-2, and 306-3 schematically illustrate the round-trip communication process for the first, second, and third network layers in the neural network, respectively, during the current training step. This round-trip communication process corresponds to the worker node 110 sending locally determined local gradients to the service node 120, and receiving from the service node 120 a global gradient obtained by aggregating the local gradients determined by multiple worker nodes 110 for the corresponding network layers. For simplicity, the "round-trip communication process" may also be referred to as the "communication process" hereinafter.

[0042] As shown in FIG3 , since the gradients for the first group of network layers (i.e., the third network layer) are not delayed, the worker node 110 can obtain the gradients for the first group of network layers from the service node 120 via the communication process 306-3. Furthermore, since the gradients for the second group of network layers (i.e., the first network layer and the second network layer) are delayed, the worker node 110 can retrieve from the buffer 310 the second group of global gradients for the second group of network layers that were stored in the buffer 310 in the previous training step before the current training step.

[0043] Referring back to FIG. 2 , at block 206 , worker node 110 updates the parameters of the neural network based on the first and second sets of global gradients. In some embodiments, worker node 110 may directly use the obtained global gradients to update the corresponding layers in the neural network. Referring to FIG. 3 , worker node 110 may use the global gradients for the first and second network layers retrieved from buffer 310 to update the parameters of the first and second network layers. This update process corresponds to block 308 - 1 in FIG. Worker node 110 may then perform forward propagation calculations for the first and second network layers in the next training step based on the updated parameters. Furthermore, worker node 110 may use the global gradients for the third network layer obtained via communication process 306 - 3 to update the parameters of the third network layer. This update process corresponds to block 308 - 2 in FIG. Worker node 110 may then perform forward propagation calculations for the third network layer in the next training step based on the updated parameters.

[0044] By introducing gradient delays only for some layers of the neural network rather than all layers to hide the communication overhead, the impact of the introduced gradient delay on the model convergence and accuracy can be minimized, thereby ensuring the convergence and accuracy of the model while hiding the communication overhead.

[0045] In some embodiments, the minimum number of network layers for gradient delay can also be determined to completely hide communication overhead, thereby ensuring that the training pipeline does not stall, that is, there is no waiting time at the worker node 110. The inventors have discovered that for a hierarchical neural network, in a training pipeline without stalls, if a forward network layer is delayed, all forward network layers before it are also delayed. Therefore, the minimum number of network layers required to introduce gradient delays to completely hide communication overhead can be determined by solving the following optimization problem:

[0046] Where k represents the number of network layers that need to introduce gradient delay, v i represents the round-trip communication time between the worker node 110 and the service node 120 for the i-th network layer, b i represents the back propagation calculation time for the i-th network layer, u i represents the forward propagation computation time for the i-th network layer, and m represents the total number of network layers in the neural network. The first constraint in this optimization problem is It is used to ensure that communication and computation are completely overlapped, that is, the communication overhead is completely hidden; and the second constraint Used to ensure that undelayed gradients are synchronized before the forward propagation calculation of their corresponding network layer begins.

[0047] In some embodiments, the forward propagation calculation time, the backward propagation calculation time, and the round-trip communication time for each network layer in the neural network can be determined by monitoring the duration of the forward propagation calculation process, the backward propagation calculation process, and the communication process of the corresponding network layer during the warm-up training phase of the neural network. The worker node 110 can then determine the number of network layers for gradient delay based on the determined forward propagation calculation time, the backward propagation calculation time, and the round-trip communication time. In one example, the worker node 110 can obtain the minimum number of network layers that need to introduce gradient delay by solving the above-mentioned optimization problem, and determine the number of network layers for gradient delay based on the minimum number. For example, the number of network layers for gradient delay can be determined to be any suitable value that is equal to or greater than the minimum number and less than the total number of network layers in the neural network.

[0048] Furthermore, the worker node 110 may determine the first group of network layers and the second group of network layers based on the determined number of network layers. In some embodiments, the worker node 110 may select the determined number of network layers from the input layer of the neural network as the second group of network layers, and determine the remaining network layers in the neural network as the first group of network layers. Referring to FIG3 , when the determined number of network layers for gradient delay is 2, the worker node 110 may determine the first two network layers of the neural network from the input layer (i.e., the first network layer and the second network layer) as the second group of network layers, and determine the remaining network layers of the neural network (i.e., the third network layer) as the first group of network layers.

[0049] Delay Compensation

[0050] In some embodiments, the worker node 110 may predict a third set of global gradients determined for the second set of network layers in the current training step based on the second set of global gradients for the second set of network layers. In one example, the inventors have discovered that the third set of global gradients may be predicted based on a Taylor expansion of a gradient function, as shown in the following equation (1):

[0051] where g t Represents the predicted third set of global gradients, g t′ represents the predicted third set of global gradients, λ is a predetermined hyperparameter, Represents the matrix g t′ The transpose of x t-1 represents the parameters of the second set of network layers in the current training step, and x t′-1represents the parameters of the second set of network layers in the previous training step. Furthermore, worker node 110 can use the determined third set of global gradients to update the parameters of the second set of network layers. In this way, the introduced gradient delay can be compensated with the help of the predicted global gradient, further reducing the impact of the introduced gradient delay on model convergence and accuracy.

[0052] In some embodiments, to compensate for the lag introduced by gradient delay, the gradient for one step backward can be obtained by predicting the model parameters in the next training step. To this end, the worker node 110 can locally store two identical neural networks, one of which is used for training purposes (hereinafter referred to as the training neural network) and the other is used to predict model parameters (hereinafter referred to as the prediction neural network).

[0053] In one embodiment, the worker node 110 may obtain a first set of local gradients for the second set of network layers. The first set of local gradients is determined for the second set of network layers in a previous training step. The worker node 110 may predict parameters of the neural network in a next training step after the current training step based on the first set of local gradients, and determine a second set of local gradients for the second set of network layers in the current training step based on the predicted parameters, for aggregation with the local gradients determined by the remaining worker nodes 110 in the plurality of worker nodes 110 to obtain a global gradient for the second set of network layers.

[0054] For example, worker node 110 may retrieve a first set of local gradients determined for the second set of network layers in a previous training step from cache 310 and use this first set of local gradients to update the parameters of the prediction neural network by considering the parameters and learning rate of the neural network in the current training step, thereby obtaining the parameters of the prediction neural network in the next training step as a prediction of the parameters of the neural network in the next training step. Furthermore, worker node 110 may determine a second set of local gradients for the second set of network layers in the current training step based on the updated parameters of the prediction neural network. Note that this second set of local gradients is the gradients for one step backward. Worker node 110 may then aggregate this second set of local gradients with the local gradients determined by the remaining worker nodes 110 in the plurality of worker nodes 110 to obtain global gradients for the second set of network layers, which are used to update the parameters of the training neural network in the next training step. In this way, the gradients for one step backward can be used to update the parameters of the network layers that have been subjected to gradient delay, thereby offsetting the introduced gradient delay and reducing the impact of the introduced gradient delay on model convergence and accuracy.

[0055] In another embodiment, the worker node 110 may predict parameters of the neural network in the next training step after the current training step based on the second set of global gradients, and determine a set of local gradients for the second set of network layers in the current training step based on the predicted parameters, for aggregation with the local gradients determined by the remaining worker nodes 110 in the plurality of worker nodes 110 to obtain the global gradients for the second set of network layers.

[0056] For example, worker node 110 can use the second set of global gradients obtained from buffer 310 to update the parameters of the prediction neural network by considering the parameters and learning rate of the neural network in the current training step, thereby obtaining the parameters of the prediction neural network in the next training step as a prediction of the parameters of the neural network in the next training step. Furthermore, worker node 110 can determine a set of local gradients for the second set of network layers in the current training step based on the updated parameters of the prediction neural network. Note that this set of local gradients is the gradients for one step backward. Worker node 110 can then use this set of local gradients to aggregate with the local gradients determined by the remaining worker nodes 110 in the plurality of worker nodes 110 to obtain global gradients for the second set of network layers, which are used to update the parameters of the training neural network in the next training step. In this way, the gradients for one step backward can be used to update the parameters of the network layers that have been introduced with gradient delay, thereby offsetting the introduced gradient delay and reducing the impact of the introduced gradient delay on model convergence and accuracy.

[0057] In another embodiment, the worker node 110 may obtain a first set of local gradients for the second set of network layers. The first set of local gradients is determined for the second set of network layers in a previous training step. The worker node 110 may predict a third set of global gradients determined for the second set of network layers in a current training step based on the first set of local gradients and the second set of global gradients. Furthermore, the worker node 110 may predict parameters of the neural network in a next training step after the current training step based on the third set of global gradients, and determine a second set of local gradients for the second set of network layers in the current training step based on the predicted parameters, for aggregation with the local gradients determined by the remaining worker nodes 110 in the plurality of worker nodes 110 to obtain a global gradient for the second set of network layers.

[0058] For example, the worker node 110 may retrieve the first set of local gradients determined for the second set of network layers in the previous training step from the cache 310. The worker node 110 may use the first set of local gradients and the second set of global gradients to predict the third set of global gradients determined for the second set of network layers in the current training step based on the following equation (2): where Δx t =x t-1 -x t-2(2)

[0059] in Represents the predicted third set of global gradients, g t-1 represents the second set of global gradients, g i,t-1 represents the local gradients used to aggregate to obtain the second set of global gradients, g i,t represents the first set of local gradients, n represents the total number of the plurality of working nodes 110, and x t-1 Represents the parameters of the neural network in the current training step, x t-2 Represents the parameters of the neural network in the previous training step, and the function DC λ () is defined in formula (1).

[0060] Furthermore, worker node 110 can use the predicted third set of global gradients to update the parameters of the prediction neural network by considering the parameters and learning rate of the neural network in the current training step, thereby obtaining the parameters of the prediction neural network in the next training step as a prediction of the parameters of the neural network in the next training step. Furthermore, worker node 110 can determine a second set of local gradients for the second set of network layers in the current training step based on the updated parameters of the prediction neural network. Note that this second set of local gradients is the gradients predicted one step backward. Worker node 110 can then use this second set of local gradients to aggregate with the local gradients determined by the remaining worker nodes 110 in the plurality of worker nodes 110 to obtain global gradients for the second set of network layers, which are used to update the parameters of the training neural network in the next training step. In this way, the gradients predicted one step backward can be used to update the parameters of the network layers introduced with gradient delay, thereby offsetting the introduced gradient delay and reducing the impact of the introduced gradient delay on model convergence and accuracy.

[0061] A variety of possible ways to compensate for gradient delay are described above. It should be understood that the introduced gradient delay may be compensated in any other suitable way, and the scope of the present disclosure is not limited in this respect.

[0062] System Design

[0063] By introducing gradient delays for the second set of network layers, the second set of global gradients for the second set of network layers can be stored in the buffer 310. This allows the second set of global gradients to be retrieved simultaneously. Therefore, when the second set of network layers includes multiple network layers, parameter updates for the multiple network layers can be performed simultaneously. In some embodiments, the worker node 110 can use the same kernel to update the parameters of the second set of network layers. In this way, compared to existing solutions that require calling different kernels to update parameters for different network layers, system resources and time overhead can be saved, thereby improving the training speed of the neural network.

[0064] In some embodiments, cache 310 may include two different cache areas, namely a first cache area and a second cache area. Worker node 110 may store the second set of global gradients in the first cache area of ​​cache 310 in a previous training step and directly read the second set of global gradients from the first cache area in the current training step. Furthermore, in the current training step, worker node 110 obtains a third set of global gradients for the second set of network layers through a communication process. This third set of global gradients is obtained by aggregating the local gradients determined by multiple worker nodes 110 for the second set of network layers in the current training step. Worker node 110 may then store the third set of global gradients in the second cache area of ​​cache 310 and directly read the third set of global gradients from the second cache area in the next training step. In this way, compared to existing solutions, the system overhead of copying gradient data from one cache area to another can be avoided, thereby improving the training speed of the neural network.

[0065] In some embodiments, in a previous training step, the worker node 110 may store a second set of global gradients in the buffer 310, and after the second set of global gradients is stored in the buffer 310, the worker node 110 may lock the buffer 310. Furthermore, when the second set of global gradients needs to be obtained in the current training step, the worker node 110 may unlock the buffer 310 and read the second set of global gradients from the buffer 310. Subsequently, the worker node 110 may store a third set of global gradients for the second set of network layers obtained in the current training step in the buffer 310. In this way, a shared buffer 310 may be implemented, thereby reducing the memory resource overhead of the buffer 310.

[0066] In some embodiments, worker node 110 may include two different processing units, namely a first processing unit and a second processing unit, wherein the first processing unit is configured to implement training of the neural network, and the second processing unit is configured to control communication at the worker node 110. Worker node 110 may determine the total computation time and the total communication time for the neural network in a training step based on warm-up training of the neural network, and select a buffer from a first buffer associated with the first processing unit and a second buffer associated with the second processing unit based on a comparison of the total computation time and the total communication time. Further, worker node 110 may store the second set of global gradients in the selected buffer.

[0067] Exemplarily, the worker node 110 may include a central processing unit (CPU) and a graphics processing unit (GPU), wherein the CPU may be used to control communications at the worker node 110, and the GPU may be used to train the neural network. If it is determined that the total computation time of the neural network in a training step is greater than the total communication time, a cache associated with the GPU may be selected to store a second set of global gradients. If it is determined that the total computation time of the neural network in a training step is less than the total communication time, a cache associated with the CPU may be selected to store a second set of global gradients. In this way, the transmission overhead may be shifted from a relatively slow pipeline stage to a relatively fast pipeline stage, thereby balancing the neural network training pipeline and thereby improving the training speed of the neural network.

[0068] As can be seen from the above description in conjunction with Figures 1 to 3, the method for training a neural network according to an embodiment of the present disclosure hides communication overhead by introducing gradient delays only for some layers in the neural network. In this way, the impact of the introduced gradient delays on model convergence and accuracy can be minimized, thereby ensuring model convergence and accuracy while hiding communication overhead.

[0069] An example implementation of the method according to the present disclosure has been described in detail above with reference to FIG. 1 to FIG. 3 , and implementation of corresponding apparatuses and devices will be described below with reference to FIG. 4 and FIG. 5 .

[0070] Example devices and equipment

[0071] FIG4 illustrates a block diagram of an example apparatus 400 for training a neural network according to some embodiments of the present disclosure. The apparatus 400 may, for example, be used to implement the worker node 110 shown in FIG1 . The apparatus 400 may include a first acquisition module 402 configured to: obtain, at a first worker node among a plurality of worker nodes, a first set of global gradients for a first set of network layers in the neural network; the first set of global gradients is obtained by aggregating local gradients determined by the plurality of worker nodes for the first set of network layers in a current training step; the plurality of worker nodes are configured to jointly train the neural network. Furthermore, the apparatus 400 may include a second acquisition module 404 configured to: obtain a second set of global gradients for a second set of network layers in the neural network; the second set of network layers is different from the first set of network layers; the second set of global gradients is obtained by aggregating local gradients determined by the plurality of worker nodes for the second set of network layers in a previous training step prior to the current training step. Furthermore, the apparatus 400 may also include an update module 406 configured to: update parameters of the neural network based on the first set of global gradients and the second set of global gradients.

[0072] In some embodiments, the first group of global gradients and the second group of global gradients are aggregated at the service node, and the apparatus 400 further includes: a time determination module configured to: determine, based on warm-up training of the neural network, a forward propagation calculation time, a backward propagation calculation time, and a round-trip communication time between the first working node and the service node for each network layer in the neural network; a number determination module configured to: determine, based on the determined forward propagation calculation time, backward propagation calculation time, and round-trip communication time, the number of network layers used for gradient delay; and a network layer determination module configured to: determine, based on the determined number of network layers, the first group of network layers and the second group of network layers.

[0073] In some embodiments, the update module 406 includes: a first parameter update module, configured to: update the parameters of the first group of network layers using the first set of global gradients; a gradient prediction module, configured to: predict a third set of global gradients determined for the second group of network layers in the current training step based on the second set of global gradients; and a second parameter update module, configured to: update the parameters of the second group of network layers using the third set of global gradients.

[0074] In some embodiments, the apparatus 400 further includes: a first gradient acquisition module configured to acquire a first set of local gradients for the second group of network layers, the first set of local gradients being determined for the second group of network layers in a previous training step; a first parameter prediction module configured to predict parameters of the neural network in a next training step after the current training step based on the first set of local gradients; and a first gradient determination module configured to determine, based on the predicted parameters, a second set of local gradients for the second group of network layers in the current training step, for aggregation with the local gradients determined by the remaining working nodes in the plurality of working nodes to obtain a global gradient for the second group of network layers.

[0075] In some embodiments, the apparatus 400 further includes: a second parameter prediction module configured to: predict the parameters of the neural network in the next training step after the current training step based on the second set of global gradients; and a second gradient determination module configured to: determine a set of local gradients for the second set of network layers in the current training step based on the predicted parameters, for aggregation with the local gradients determined by the remaining working nodes in the plurality of working nodes to obtain the global gradients for the second set of network layers.

[0076] In some embodiments, the apparatus 400 further includes: a second gradient acquisition module configured to acquire a first set of local gradients for the second group of network layers, the first set of local gradients being determined for the second group of network layers in a previous training step; a global gradient prediction module configured to predict a third set of global gradients determined for the second group of network layers in a current training step based on the first set of local gradients and the second set of global gradients; a third parameter prediction module configured to predict parameters of the neural network in a next training step after the current training step based on the third set of global gradients; and a third gradient determination module configured to determine a second set of local gradients for the second group of network layers in the current training step based on the predicted parameters, for aggregation with the local gradients determined by the remaining working nodes in the plurality of working nodes to obtain a global gradient for the second group of network layers.

[0077] The modules and / or units included in the device 400 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units can be implemented using software and / or firmware, such as machine executable instructions stored on a storage medium. In addition to or as an alternative to machine executable instructions, some or all of the units in the device 400 can be implemented at least in part by one or more hardware logic components. By way of example and not limitation, exemplary types of hardware logic components that can be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0078] The modules and / or units shown in Figure 4 may be partially or entirely implemented as hardware modules, software modules, firmware modules, or any combination thereof. In particular, in some embodiments, the processes, methods, or procedures described above may be implemented by hardware in a storage system, a host corresponding to the storage system, or other computing devices independent of the storage system.

[0079] FIG5 shows a block diagram of a computing device 500 in which one or more embodiments of the present disclosure may be implemented. It should be understood that the computing device 500 shown in FIG5 is merely exemplary and should not be construed as limiting the functionality and scope of the embodiments described herein. The computing device 500 shown in FIG5 can be used to implement the worker node 110 of FIG1 .

[0080] As shown in FIG5 , computing device 500 is in the form of a general-purpose computing device. Components of computing device 500 may include, but are not limited to, one or more processors or processing units 510, memory 520, storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. Processing unit 510 may be a real or virtual processor and is capable of performing various processes according to a program stored in memory 520. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to increase the parallel processing capabilities of computing device 500.

[0081] The computing device 500 typically includes a plurality of computer storage media. Such media can be any available media accessible to the computing device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 520 can be a volatile memory (e.g., registers, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 530 can be a removable or non-removable medium and can include a machine-readable medium, such as a flash drive, a disk, or any other medium that can be used to store information and / or data (e.g., training data for training) and can be accessed within the computing device 500.

[0082] The computing device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG. 5 , a disk drive for reading from or writing to a removable, non-volatile disk (e.g., a “floppy disk”) and an optical drive for reading from or writing to a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to a bus (not shown) by one or more data media interfaces. The memory 520 may include a computer program product 525 having one or more program modules configured to perform various methods or actions of various embodiments of the present disclosure.

[0083] The communication unit 540 enables communication with other computing devices via a communication medium. Additionally, the functionality of the components of the computing device 500 can be implemented as a single computing cluster or multiple computing machines that can communicate via a communication connection. Thus, the computing device 500 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or other network nodes.

[0084] Input device 550 may be one or more input devices, such as a mouse, keyboard, or trackball. Output device 560 may be one or more output devices, such as a display, a speaker, or a printer. Computing device 500 may also communicate with one or more external devices (not shown) via communication unit 540, as needed, such as storage devices, display devices, or the like, with one or more devices that allow a user to interact with computing device 500, or with any device that allows computing device 500 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0085] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.

[0086] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0087] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0088] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0089] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple implementations of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part for a module, program segment or instruction, and a part for a module, program segment or instruction comprises one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.

[0090] While various implementations of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is selected to best explain the principles of the implementations, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the various implementations disclosed herein.

Claims

1. A method for training a neural network, comprising: obtaining, at a first worker node among a plurality of worker nodes, a first set of global gradients for a first set of network layers in a neural network, the first set of global gradients being aggregated from local gradients determined by the plurality of worker nodes for the first set of network layers in a current training step, the plurality of worker nodes being configured to jointly train the neural network; Obtaining a second set of global gradients for a second set of network layers in the neural network, the second set of network layers being different from the first set of network layers, the second set of global gradients being aggregated from local gradients determined by the plurality of worker nodes for the second set of network layers in a previous training step before the current training step; and Parameters of the neural network are updated based on the first set of global gradients and the second set of global gradients.

2. The method according to claim 1, wherein the first set of global gradients and the second set of global gradients are aggregated at a service node, the method further comprising: Determining, based on pre-training of the neural network, a forward propagation computation time, a backward propagation computation time, and a round-trip communication time between the first worker node and the service node for each network layer in the neural network; determining a number of network layers for gradient delay based on the determined forward propagation computation time, the backpropagation computation time, and the round-trip communication time; as well as Based on the determined number of network layers, the first group of network layers and the second group of network layers are determined.

3. The method of claim 2, wherein determining the first set of network layers and the second set of network layers comprises: Starting from the input layer of the neural network, selecting the determined number of network layers as the second group of network layers; as well as The remaining network layers in the neural network are determined as the first group of network layers.

4. The method according to any one of claims 1 to 3, wherein updating the parameters of the neural network comprises: Updating parameters of the first set of network layers using the first set of global gradients; Predicting a third set of global gradients determined for the second set of network layers in the current training step based on the second set of global gradients; and Utilizing the third set of global gradients to update parameters of the second set of network layers.

5. The method according to any one of claims 1 to 4, further comprising: Obtaining a first set of local gradients for the second set of network layers, the first set of local gradients being determined for the second set of network layers in the previous training step; predicting parameters of the neural network in a next training step after the current training step based on the first set of local gradients; as well as Based on the predicted parameters, determine a second set of local gradients for the second set of network layers in the current training step, for aggregation with local gradients determined by the remaining working nodes in the plurality of working nodes to obtain a global gradient for the second set of network layers.

6. The method according to any one of claims 1 to 5, further comprising: predicting parameters of the neural network in a next training step after the current training step based on the second set of global gradients; as well as Based on the predicted parameters, determine a set of local gradients for the second group of network layers in the current training step, for aggregation with local gradients determined by the remaining working nodes in the plurality of working nodes to obtain a global gradient for the second group of network layers.

7. The method according to any one of claims 1 to 6, further comprising: Obtaining a first set of local gradients for the second set of network layers, the first set of local gradients being determined for the second set of network layers in the previous training step; Predicting a third set of global gradients determined for the second set of network layers in the current training step based on the first set of local gradients and the second set of global gradients; predicting parameters of the neural network in a next training step after the current training step based on the third set of global gradients; as well as Based on the predicted parameters, determine the A second set of local gradients for the second set of network layers is aggregated with local gradients determined by the remaining worker nodes in the plurality of worker nodes to obtain a global gradient for the second set of network layers.

8. The method according to any one of claims 1 to 7, wherein the parameters of the second set of network layers are updated by using the same kernel.

9. The method according to any one of claims 1 to 7, wherein the second set of global gradients is stored in a first buffer area of ​​a buffer in the previous training step, and wherein obtaining the second set of global gradients comprises: The second set of global gradients is read from the first buffer.

10. The method according to claim 9, further comprising: Obtaining a third set of global gradients for the second set of network layers in the neural network, the third set of global gradients being obtained by aggregating local gradients determined by the plurality of worker nodes for the second set of network layers in the current training step; as well as The third set of global gradients is stored in a second buffer area of ​​the buffer, the second buffer area being different from the first buffer area.

11. The method according to any one of claims 1 to 7, wherein the second set of global gradients is stored in a buffer in the previous training step, the method further comprising: In response to the second set of global gradients being stored in the buffer, locking the buffer, and Obtaining the second set of global gradients includes: unlocking the buffer in the current training step; and The second set of global gradients is read from the buffer.

12. The method according to any one of claims 1 to 7, wherein the training of the neural network is implemented in a first processing unit, the method further comprising: Determining a total computation time and a total communication time for the neural network in a training step based on a warm-up training of the neural network; Based on the comparison of the total computation time and the total communication time, a first buffer associated with the first processing unit and a second buffer associated with the second processing unit are used. Selecting a buffer from the buffers, the second processing unit is configured to control communication at the first working node; as well as The second set of global gradients is stored in the selected buffer.

13. An apparatus for training a neural network, comprising: a first acquisition module configured to: acquire, at a first working node among a plurality of working nodes, a first set of global gradients for a first set of network layers in a neural network, wherein the first set of global gradients is obtained by aggregating local gradients determined by the plurality of working nodes for the first set of network layers in a current training step, the plurality of working nodes being configured to jointly train the neural network; a second acquisition module configured to: acquire a second set of global gradients for a second set of network layers in the neural network, wherein the second set of network layers is different from the first set of network layers, and the second set of global gradients is obtained by aggregating local gradients determined by the plurality of worker nodes for the second set of network layers in a previous training step before the current training step; as well as An updating module is configured to update parameters of the neural network based on the first set of global gradients and the second set of global gradients.

14. The apparatus according to claim 13, wherein the first set of global gradients and the second set of global gradients are aggregated at a service node, the apparatus further comprising: a time determination module configured to: determine, based on pre-training of the neural network, a forward propagation computation time, a backward propagation computation time, and a round-trip communication time between the first working node and the service node for each network layer in the neural network; a number determination module configured to: determine the number of network layers for gradient delay based on the determined forward propagation calculation time, the backpropagation calculation time, and the round-trip communication time; as well as The network layer determination module is configured to determine the first group of network layers and the second group of network layers based on the determined number of network layers.

15. The apparatus according to any one of claims 13 to 14, wherein the update module comprises: A first parameter updating module is configured to: update the parameters of the first group of network layers using the first group of global gradients; a gradient prediction module configured to: predict a third set of global gradients determined for the second set of network layers in the current training step based on the second set of global gradients; and The second parameter updating module is configured to update the parameters of the second group of network layers using the third group of global gradients.

16. The apparatus according to any one of claims 13 to 15, further comprising: A first gradient acquisition module is configured to: acquire a first set of local gradients for the second set of network layers, where the first set of local gradients is determined for the second set of network layers in the previous training step; A first parameter prediction module is configured to: predict parameters of the neural network in a next training step after the current training step based on the first set of local gradients; as well as The first gradient determination module is configured to: determine, based on the predicted parameters, a second set of local gradients for the second set of network layers in the current training step, for aggregation with local gradients determined by the remaining working nodes in the plurality of working nodes to obtain a global gradient for the second set of network layers.

17. The apparatus according to any one of claims 13 to 16, further comprising: A second parameter prediction module is configured to: predict parameters of the neural network in a next training step after the current training step based on the second set of global gradients; as well as A second gradient determination module is configured to: determine, based on the predicted parameters, a set of local gradients for the second group of network layers in the current training step, for aggregating with local gradients determined by the remaining working nodes in the plurality of working nodes to obtain a global gradient for the second group of network layers.

18. The apparatus according to any one of claims 13 to 17, further comprising: The second gradient acquisition module is configured to: obtain a first set of local gradients for the second set of network layers, wherein the first set of local gradients is obtained in the previous training step for the Determined by the second group of network layers; a global gradient prediction module, configured to: predict a third set of global gradients determined for the second set of network layers in the current training step based on the first set of local gradients and the second set of global gradients; A third parameter prediction module is configured to: predict parameters of the neural network in a next training step after the current training step based on the third set of global gradients; as well as A third gradient determination module is configured to: determine, based on the predicted parameters, a second set of local gradients for the second set of network layers in the current training step, for aggregation with local gradients determined by the remaining working nodes in the plurality of working nodes to obtain a global gradient for the second set of network layers.

19. An electronic device comprising: at least one processing unit; as well as At least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the apparatus to perform the method according to any one of claims 1 to 12.

20. A computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable by a processor to implement the method according to any one of claims 1 to 12.