Neural network device and operation condition determination method

The neural network device addresses high power consumption by using MTJ elements to reduce write current and allow bit errors, achieving efficient power reduction with maintained accuracy.

WO2024204806A1PCT designated stage expired Publication Date: 2024-10-03TOHOKU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2024/013285
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-30
Filing Date
2024-03-29
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

Neural network devices face high power consumption due to large numbers of calculations and memory accesses, necessitating a new approach beyond traditional clock gating and power gating techniques.

Method used

A neural network device configured with a memory system using MTJ elements that reduces write current below a specified value while maintaining processing accuracy by allowing bit inversion, thereby lowering power consumption.

Benefits of technology

The approach effectively reduces power consumption while maintaining recognition accuracy by setting the write current to a value that allows for bit errors with minimal impact on processing performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2024013285_03102024_PF_FP_ABST
    Figure JP2024013285_03102024_PF_FP_ABST
Patent Text Reader

Abstract

Provided are a neural network device and an operation condition determination method with which it is possible to reduce power consumption. A neural network device 10 comprises: a processor 12; a power supply unit 14; and an operation condition determination unit 16. The processor 12 has a logic arithmetic circuit 21 and a memory 22, and performs recognition processing on processing object data by a convolutional neural network. An output control circuit 32 of the power supply unit 14 adjusts writing current so that recognition accuracy can satisfy preset setting accuracy and become a setting value that is set lower than a prescribed value determined so as to invert a bit of a memory cell 24.
Need to check novelty before this filing date? Find Prior Art

Description

Neural network device and method for determining operating conditions

[0001] The present invention relates to a neural network device and a method for determining operating conditions.

[0002] Known technologies for reducing power consumption in semiconductor circuits include clock gating, which stops the supply of clocks to circuit blocks not involved in calculations, and power gating, which cuts off the power supply. Both reduce power consumption by stopping the supply of clocks and power to the circuit blocks targeted for gating when they do not need to operate.

[0003] Various neural network devices have also been proposed that perform information processing on semiconductor circuits modeled on the mechanisms of the biological brain. Among these neural network devices, some are known to employ clock gating and power gating (see, for example, Patent Documents 1 and 2). Patent Document 3 proposes a neural network device that utilizes parallel processors and parallel input processing to reduce power consumption by optimizing the processing flow.

[0004] JP 2019-46199 A U.S. Patent Application Publication No. 2021 / 0081773 U.S. Patent Application Publication No. 2018 / 0300615

[0005] Neural network devices require a large number of calculations and memory accesses, which necessitates new technologies that reduce power consumption and are different from clock gating and power gating.

[0006] The present invention has been made in view of the above circumstances, and has as its object to provide a neural network device and an operating condition determination method that can reduce power consumption.

[0007] The neural network device of the present invention comprises a neural network calculation unit having a memory composed of a plurality of memory cells for storing calculation data for neural network processing, and a calculation circuit for transmitting and receiving calculation data to and from the memory and performing calculations for neural network processing using the calculation data, and a power supply unit for supplying a write current or write voltage of a set value to the memory when writing calculation data, the set value being equal to or higher than a set accuracy for the processing accuracy of the neural network processing by the neural network calculation unit and lower than a specified value determined to invert bits for a plurality of memory cells.

[0008] The operating condition determination method of the present invention includes an accuracy setting step of setting, as a set accuracy, the processing accuracy to be satisfied by a neural network calculation unit which is composed of a plurality of memory cells and has a memory for storing calculation data for neural network processing, and an arithmetic circuit which exchanges calculation data with the memory and performs calculations for neural network processing using the calculation data, and a determination step of determining, for a write current or write voltage to be supplied to the memory when writing calculation data to the memory, a set value which satisfies the set accuracy and is set lower than a specified value determined to invert bits for a plurality of memory cells.

[0009] According to the present invention, the write current for calculation data in neural network processing is made lower than the specified value while maintaining a predetermined processing accuracy, thereby reducing the power consumption of the neural network device.

[0010] 1 is a block diagram showing the configuration of a neural network device of a first embodiment; FIG. 2 is a circuit diagram showing an example of the configuration of a memory cell; FIG. 3 is a graph showing an example of the relationship between the write current of an MTJ element provided in a memory cell and the magnetization reversal probability; FIG. 4 is a flowchart showing a procedure for determining a set value of a write current; FIG. 5 is a graph showing an example of determining a set value when there is variation in the relationship between the write current of the MTJ element and the magnetization reversal probability; FIG. 6 is a graph showing an example of determining a set value when an MTJ element is connected in parallel to a memory cell; FIG. 7 is a block diagram showing the configuration of a neural network device of a second embodiment; FIG. 8 is a flowchart showing a procedure for determining a set value by gradually reducing the write current; FIG. 9 is a flowchart showing a procedure for determining a set value by reducing the write current including in a learning mode; FIG. 10 is a graph showing the results of a simulation of the effect of an error in calculation data on the recognition accuracy of a neural network;

[0011] 1, a neural network device 10 includes a processor 12 as a neural network calculation unit, a power supply unit 14, an operating condition determination unit 16, and a control unit 17 that controls these units in an integrated manner. The neural network device 10 uses the processor 12 to perform neural network processing on data to be processed. The data to be processed is made up of a plurality of element data. In this example, the neural network processing involves, for example, recognition processing to recognize an object in an image. In this case, the processing target is an image, and the image data is input as the data to be processed, with the element data being pixel data.

[0012] The neural network device 10 in this example focuses on the fact that even if some data is lost, it does not have much effect on the processing accuracy (recognition accuracy) of neural network processing, and allows for a certain probability of write errors occurring when writing to memory cells, thereby reducing the power required to write data to memory while ensuring the necessary processing accuracy. Note that in this example, recognition processing of images, etc. will be described as an example of neural network processing, but neural network processing is not limited to this.

[0013] The neural network device 10 has a learning mode, a recognition mode, and an operating condition determination mode. The learning mode is a mode for performing machine learning, in which weights (also referred to as parameters, etc.) used in the recognition mode are optimized using a learning data set. The learning data set is, for example, a collection of multiple learning data for which correct labels of recognition results are prepared. That is, in the learning mode, each learning data set in the learning data set is used as the processing target data, and a recognition process similar to that in the recognition mode is performed. The filter weights are updated based on the recognition results, and the filter weights are determined to achieve high recognition accuracy. In the recognition mode, the filter optimized in the learning mode is used to perform recognition processing on input recognition processing data, and the recognition results are output. The operating condition determination mode is a mode for determining a write current, as will be described in detail below.

[0014] The training dataset used in the recognition process is of the same type as the processing target. Therefore, if the processing target is an image, a training dataset in which the training data is image data is used, and the element data of the training data is pixel data. Note that the test dataset, which will be described later, is similar to the training dataset and is a collection of multiple test data sets for which correct labels for the recognition results are prepared, and each test data set is composed of multiple element data sets.

[0015] In this example, a training data set and a test data set are stored in the storage 18. The data to be processed is input to the processor 12 during recognition processing in the recognition mode. The storage 18 may be provided in the neural network device 10, or may be connected to the neural network device 10 when necessary.

[0016] The processor 12 has a logic operation circuit 21 and a memory 22, and performs recognition processing on the data to be processed using a neural network, in this example, a convolutional neural network (CNN). The logic operation circuit 21 is composed of a CPU, multipliers, adders, registers, etc., and in the recognition processing, it performs calculations on the convolutional layer, pooling layer, fully connected layer, and output layer in sequence. In addition, in the learning mode, the processor 12 rewrites the weight data in the memory 22, which are weights used in the calculations on the convolutional layer and fully connected layer, based on the results of the recognition processing.

[0017] In this example, the architecture of the convolutional neural network performed by the processor 12 as described above is not limited to the above, and may, for example, repeatedly perform calculations on the convolutional layer and pooling layer multiple times before performing calculations on the fully connected layer and output layer. Furthermore, the neural network processing by the processor 12 is not limited to a convolutional neural network, and may be, for example, a fully convolutional network (FCN) consisting only of convolutional layers, or a deep neural network in which calculations on the fully connected layer are repeated multiple times. Furthermore, known architectures such as SSD, YOLO, and TinyYOLO may also be used as the architecture of the neural network processing performed by the processor 12.

[0018] For example, in the calculation of the convolution layer, the logic operation circuit 21 reads element data of the input layer, i.e., element data of the data to be processed and weight data of the convolution filter, from the memory 22, performs a convolution calculation, and then performs an operation using an activation function on the element data, writing the calculation result as element data of the convolution layer to the memory 22. The element data of the convolution layer is feature map data. In the calculation of the pooling layer, the logic operation circuit 21 reads each element data of the convolution layer from the memory 22, and writes data extracted by, for example, maximum value pooling processing to the memory 22 as element data of the pooling layer.

[0019] Furthermore, in the calculation of the fully connected layer, the logic operation circuit 21 reads the element data of the pooling layer and the weight data of the fully connected layer from the memory 22, performs calculations using these data, and writes the resulting data as element data of the fully connected layer to the memory 22. In the calculation of the output layer, the logic operation circuit 21 reads the element data of the fully connected layer from the memory 22, performs calculations using a predetermined activation function (e.g., a softmax function), and outputs the calculation results as the results of the recognition processing. In this example, the element data and weight data used in the convolution layer, pooling layer, fully connected layer, and output layer are calculation data.

[0020] Here, the set of element data of the convolution layer is referred to as convolution layer data, the set of element data of the pooling layer as pooling layer data, and the element data of the fully connected layer as fully connected layer data. Furthermore, the set of weight data of the convolution layer is referred to as the convolution layer weight dataset, and the set of weight data of the fully connected layer is referred to as the fully connected layer weight dataset. In the following description, when there is no need to distinguish between the convolution layer data, pooling layer data, and fully connected layer data, they will be collectively referred to as layer data, and when there is no need to distinguish between the convolution layer weight dataset and the fully connected layer weight dataset, they will be collectively referred to as the weight dataset.

[0021] The memory 22 is composed of a plurality of memory cells 24 and stores data for calculation in the recognition process. That is, the logic operation circuit 21 exchanges data for calculation with the memory 22 and performs calculations for the recognition process using the data for calculation. The data for calculation stored in the memory 22 are each element data and each weight data, such as input layer data (data to be processed), convolution layer data, pooling layer data, fully connected layer data, a convolution layer weight data set, and a fully connected layer weight data set. The weight data set determined in the learning mode is stored in the storage 18, read from the storage 18, and written to the memory 22.

[0022] Each memory cell 24 stores one bit of data. Therefore, multiple bits of operational data are held by multiple memory cells 24. As shown in FIG. 2, the memory cell 24 in this example is a 1T-1MTJ type memory cell consisting of one MTJ (magnetic tunnel junction) element 25, which essentially serves as a memory element, and one select transistor 26. The MTJ element 25 has a stacked structure in which a magnetization fixed layer 25a, whose magnetization direction is fixed, and a magnetization free layer 25b, whose magnetization direction can be changed, are sandwiched between an insulating film 25c. The memory 22 is, for example, an STT-MRAM using a spin-transfer torque (STT) type MTJ element 25. Therefore, the MTJ element 25 can change the magnetization direction of the magnetization free layer 25b by passing a write current through it, and the magnetization direction of the magnetization free layer 25b is determined by the direction of the write current. Although the memory cell 24 in this example is a 1T-1MTJ type, the configuration of the memory cell 24 is not limited to this and may be a 1T-2MTJ type, a 2T-2MTJ type, etc. When using 1T-1MTJ type or 2T-2MTJ type memory cells, which are relatively prone to write errors, power consumption can be reduced more effectively.

[0023] The MTJ element 25 can be in either a parallel state, in which the magnetization directions of the magnetization fixed layer 25 a and the magnetization free layer 25 b are aligned, or an antiparallel state, in which the magnetization directions are opposite to each other. That is, by turning on the select transistor 26 via the word line WL and changing the direction of the write current supplied to the memory cell 24—in this example, the write current flowing through the MTJ element 25 between the bit line BL and the source line SL—the MTJ element 25 can be placed in either the parallel state or the antiparallel state. Specifically, when the write current flows from the magnetization free layer 25 b toward the magnetization fixed layer 25 a, the MTJ element 25 is placed in the parallel state. When the write current flows from the magnetization fixed layer 25 a toward the magnetization free layer 25 b, the MTJ element 25 is placed in the antiparallel state. The magnetization direction of the magnetization free layer 25 b does not change even when the write current is cut off. That is, the memory 22 is a nonvolatile memory.

[0024] For example, one bit of data has a value of "1" associated with the parallel state of the MTJ element 25 and a value of "0" associated with the antiparallel state of the MTJ element 25. Therefore, by reversing the magnetization direction of the magnetization free layer 25 b, the value of the bit ("0" or "1") held by the memory cell 24 is reversed.

[0025] Under the condition that the time for which the write current is passed is constant, the bit reversal probability that the value of the bit held in the memory cell 24 is rewritten, i.e., the magnetization reversal probability that the magnetization reversal of the magnetization free layer 25b occurs, depends on the magnitude of the write current, and the higher the write current, the higher the magnetization reversal probability. In this example, by utilizing the fact that the magnetization reversal probability depends on the magnitude of the write current, and by allowing a certain probability of write errors when writing to the memory cell 24 as described above, the write current for the calculation data in the recognition mode is reduced, thereby reducing power consumption.

[0026] The MTJ element 25 has low electrical resistance in the parallel state and high electrical resistance in the antiparallel state. To read one bit stored in the memory cell 24, the selection transistor 26 is turned on, and a read current is passed through the MTJ element 25 to the extent that the magnetization of the free magnetization layer 25b does not reverse. The level of the electrical resistance of the MTJ element 25 is determined, for example, from the current flowing through the bit line BL or a change in the potential of the bit line BL. Note that a circuit (not shown) provided in the memory 22 controls the on / off of the selection transistor 26, the direction of the write current passed through the MTJ element 25, and determines the level of the electrical resistance of the MTJ element 25. The magnitude of the write current is controlled by the power supply unit 14.

[0027] 1, the power supply unit 14 has a main circuit 31 and an output control circuit 32, and supplies power for operating the processor 12. The main circuit 31 supplies a drive voltage for driving the logic operation circuit 21 and the select transistor 26 of the memory cell 24, and a read current for the memory cell 24. The output control circuit 32 is configured, for example, by a constant current circuit or the like whose current magnitude is variable, and supplies a write current for the memory cell 24.

[0028] The output control circuit 32 outputs a predetermined value I SW0 The set value I is set lower than SW The write current is adjusted so that the specified value I SW0 is determined as an electrical characteristic specification of the MTJ element 25, or is set so that the magnetization reversal probability is theoretically approximately 100% (for example, 99% or more) in the design of a memory circuit based on the MTJ element 25. SW is a write current at which the magnetization reversal probability is less than 99%, for example. SW is the preset accuracy M of the recognition process by the processor 12. A0 is determined to satisfy the following.

[0029] In this example, the MTJ element 25 having two states corresponding to one bit is described, so the specified value I SW0is defined as the write current that inverts a bit, but the specified value I SW0 The specified value I can be used as the specified value of the write current for inverting the state (bit inversion) of a nonvolatile memory element other than the MTJ element 25, which takes two states, and as the write current for transitioning between states in a multi-state (multi-value) nonvolatile memory element. SW0 The same is true for .

[0030] In addition, the write current to the memory cell 24 is set to a specified value I SW0 A lower set value I SW On the premise that the memory 22 is driven by the select transistor 26, the size of the select transistor 26 can be reduced, which is advantageous for increasing the integration density of the memory 22 and the processor 12. As a result, it is also advantageous for increasing the speed of the memory 22 and the processor 12.

[0031] In the neural network device 10, as described above, the write current to the memory cell 24 is set to the specified value I SW0 Since power consumption can be reduced by lowering the clock frequency to a value lower than the reference clock frequency, clock gating and power gating can be further applied to further reduce power consumption. For example, when the logic operation circuit 21 does not access the memory 22, the clock supply to the memory 22 can be stopped or the power supply can be cut off. Of course, clock gating and power gating can also be applied to the logic operation circuit 21.

[0032] In the operation condition determination mode, the operation condition determination unit 16 determines the recognition accuracy based on a preset accuracy M A0 and meets the specified value I SW0 The set value I of the write current is lower than SW The operating condition determining unit 16 determines the set value I SW When determining the set value I, the processor 12 is operated via the control unit 17, errors are introduced into the calculation data stored in the memory 22, and a recognition process is performed on the test data set, and the recognition accuracy is evaluated to determine the set value I. SWThe operation condition determining unit 16 determines the effective bit ratio P FT Based on this, the set value I of the write current is SW and an evaluation determination unit 29 that determines the evaluation result.

[0033] The total number of bits of the calculation data stored in the memory 22 in one recognition process of the test data is set to the total number of bits N A , the number of bits (hereinafter referred to as valid bits) that are not erroneous in the calculation data stored in the memory 22 in one recognition process of the test data is the number of valid bits N S When the total number of bits is N A Number of effective bits N for S The ratio of these is the effective bit ratio P FT (=N S / N A )

[0034] The total number of bits of the calculation data is N A The number of errors, i.e., bits inverted (hereinafter referred to as error bits) contained in the data for calculation is called the number of error bits N E Then, the effective bit ratio P FT is "P FT = (N A -N E ) / N A " and the total number of bits N A Number of error bits N E The ratio of these is the error ratio R E (=N E / N A ), then the effective bit ratio P FT and the error ratio R E The relationship between FT = 1 - R E is.

[0035] In this example, the calculation data stored in the memory 22 are the data to be processed (test data), the convolution layer data, the pooling layer data, the fully connected layer data, the convolution layer weight data set, and the fully connected layer weight data set, and the sum of the number of bits of these data is the total number of bits N A is.

[0036] The error adding unit 28 adds an error (mistake) to a part of the calculation data stored in the memory 22. In this example, the error adding unit 28 adds an error to a part of the convolutional layer weight data set and the fully connected layer weight data set. That is, in this example, the number of error bits N E Invert the values ​​of some bits in the convolutional layer weight data set and the fully connected layer weight data set.

[0037] Note that the data to which an error is added is not limited to the above, and may be any of the calculation data stored in the memory 22 (in this example, the test data, the convolutional layer data, the pooling layer data, the fully connected layer data, the convolutional layer weight data set, and the fully connected layer weight data set), or a combination of some or all of them. When an error is added to layer data, for example, the error adding unit 28 may add an error when the layer data to which an error is to be added is written to the memory 22 during the recognition process.

[0038] It is preferable to randomly introduce errors into the calculation data. The calculation data stored in the memory 22 may be provided with errors by randomly selecting and inverting individual bits of the load data or element data, or by changing the value of the data itself. Methods for introducing errors include, for example, random quantization, random bit-flip, and random pruning.

[0039] The error adding unit 28 calculates the number of error bits N for the calculation data for each test data in one recognition process for the test data set. EFor each recognition process on the test data set, the number of error bits N E In this example, the error adding unit 28 changes the recognition accuracy stepwise. A0 until the number of error bits N E In other words, the recognition accuracy increases gradually from the set accuracy M A0 until the effective bit ratio P FT is gradually reduced.

[0040] The evaluation determination unit 29 receives the recognition results from the logic operation circuit 21. The evaluation determination unit 29 determines the effective bit ratio P for each test data set based on the recognition results and the correct answer labels for each test data set. FT The recognition accuracy can be calculated using an evaluation index such as mAP (mean average precision).

[0041] The evaluation determination unit 29 determines whether the recognition accuracy is greater than the set accuracy M A0 The number of error bits N E The largest number of error bits N E The effective bit ratio P FT The set value of the write current I SW Specifically, the number of error bits N E When the recognition process is performed on the test dataset while gradually increasing the set accuracy M A0 The number of error bits just before it fell below N E The effective bit ratio P FT and this specified effective bit ratio P FT to the set value I of the write current SW Decide.

[0042] The evaluation determination unit 29 determines the effective bit ratio P FT The write current setting value I is determined based on the characteristics of the memory cell 24. SW The characteristics of the memory cell 24 in this example can be considered to be the same as the characteristics of the MTJ element 25. The evaluation and determination unit 29 converts the specified effective bit ratio P FTis the magnetization reversal probability P SW Based on the characteristics of the MTJ element 25, the magnetization reversal probability P SW The write current is set to a set value I SW The evaluation determination unit 29 determines the set value I SW is set in the output control circuit 32.

[0043] 3 shows an example of the relationship between the write current and the magnetization reversal probability of the MTJ element 25. The MTJ element 25 exhibits an S-shaped characteristic in which the magnetization reversal probability increases gradually as the write current increases, and the magnetization reversal probability increases proportionally to the increase in the write current when the write current exceeds a certain value, and the rate of increase in the magnetization reversal probability decreases with increasing write current when the magnetization reversal probability approaches "1.0". Based on such characteristics of the MTJ element 25, the effective bit ratio P FT The magnetization reversal probability P is equal to SW The write current corresponding to the set value I SW Let's say.

[0044] In this example, after machine learning in the learning mode, i.e., after determining the load data set, the operation condition determination unit 16 activates the processor 12 to perform recognition processing on the test data set, and sets the obtained recognition accuracy to the set accuracy M A0 In the machine learning in the learning mode and the recognition process for the test data set, the write current is set to the specified value I SW0 Therefore, in this example, the write current that satisfies the maximum recognition accuracy is set to the set value I SW It states that:

[0045] In addition, the setting accuracy M A0 The setting method of M is not limited to this. A0 It is also possible to configure the system so that the set accuracy M can be set arbitrarily according to the required recognition accuracy, the degree of power saving, etc. A0 may be set.

[0046] Next, the operation of the above configuration will be described. First, in the operating condition determination mode, the set value I of the write current is SWIn the operating condition determination mode in this example, the write current to the memory 22 is set to a specified value I SW0 is set to

[0047] The operating condition determination mode does not always need to be executed prior to the recognition mode. For example, the setting value I of the write current may be set. SW The operating condition determination mode may be executed when the architecture of the neural network processing by the processor 12 changes. For example, it is preferable to execute the operating condition determination mode each time machine learning is performed in the learning mode, when there is a change in the architecture of the neural network processing by the processor 12. Also, assuming that the characteristics of the memory 22 change over time, the operating condition determination mode may be executed every time a predetermined time has elapsed or a predetermined number of times of recognition processing is performed in the recognition mode. Furthermore, the operating condition determination mode may be executed each time the neural network device 10 is started up.

[0048] A first recognition process is performed on the test dataset. First, the convolutional layer weight dataset and the fully connected layer weight dataset determined using machine learning in the learning mode and the test dataset are read from the storage 18 and written to the memory 22. The error adding unit 28 calculates the number of error bits N E The initial value of the first error bit number N E1 In this example, the number of error bits N E1 As a result, the recognition accuracy is set to M A0 The error assigning unit 28 assigns the first error bit number N to the convolutional layer weight data set and the fully connected layer weight data set stored in the memory 22, for example, randomly. E1 It selects only the bits and inverts the value of those selected bits to give an error.

[0049] After applying the errors as described above, recognition processing is performed on the test data set from the storage 18. First, the first test data is read and written to the memory 22, where it is stored as input layer data. After this, the logic operation circuit 21 sequentially reads the element data of the first input layer (test data) along with the weight data of the convolutional layer from the memory 22, and performs calculations on the convolutional layer using these element data and weight data. The element data of the convolutional layer obtained by this calculation is sequentially written to the memory 22.

[0050] When all the operations of the convolutional layer are completed, the logic operation circuit 21 sequentially reads out the element data of the convolutional layer from the memory 22, and performs the operation of the pooling layer. For example, data extracted by maximum value pooling processing is written to the memory 22 as the element data of the pooling layer. After the operation of the pooling layer, the logic operation circuit 21 sequentially reads out the element data of the pooling layer and the weight data of the fully connected layer, and performs the operation of the fully connected layer using these data. The data obtained by this operation is then written to the memory 22 as the element data of the fully connected layer.

[0051] After the calculation of the fully connected layer, the element data of the fully connected layer is read from the memory 22, and a calculation using, for example, a softmax function is performed by the logic calculation circuit 21, and the calculation result is output as the result of the recognition processing. In the operating condition determination mode, the result of the recognition processing is input from the logic calculation circuit 21 to the evaluation determination unit 29.

[0052] The evaluation determination unit 29 compares the result of the recognition process for the first test data input from the logic operation circuit 21 with the correct label for the first test data obtained from the storage 18, and determines whether the result of the recognition process is correct or incorrect.

[0053] After performing the recognition process on the first test data as described above, the second test data is read from the storage 18 and subjected to the same recognition process. When the recognition process on the second test data is input from the logic operation circuit 21, the evaluation determination unit 29 compares the result of the recognition process with the correct label for the second test data and determines whether the result of the recognition process is correct or incorrect. The third and subsequent test data are also subjected to the same recognition process as described above, and the result of the recognition process is compared with the corresponding correct label to determine whether the result of the recognition process is correct or incorrect.

[0054] After comparing the results of the recognition process for the final test data with the correct labels, the recognition accuracy M is calculated based on the recognition results for each test data set. A1 The evaluation determination unit 29 obtains the recognition accuracy M A1 is the setting accuracy M A0 It is determined whether or not it is equal to or greater than this.

[0055] For example, the recognition accuracy M A1 is the setting accuracy M A0 If it is equal to or greater than this, the number of error bits N E is increased by one stage and a second recognition process is performed on the test dataset.

[0056] In the second recognition process, the convolutional layer weight data set and the fully connected layer weight data set are read from the storage 18 and written to the memory 22. Then, the bits of the convolutional layer weight data set and the fully connected layer weight data set stored in the memory 22 are randomly calculated to the second error bit number N E2 After applying errors in this way, the recognition process for the test data set is carried out in the same manner as in the first recognition process.

[0057] The evaluation determination unit 29 determines the recognition accuracy M obtained in the second recognition process. A2 is the setting accuracy M A0 For example, it is determined whether the recognition accuracy M A2 is the setting accuracy M A0 If it is equal to or greater than this, the number of error bits NE is further increased by one step, and a third recognition process is performed on the test data set. E While gradually increasing the recognition accuracy M Ai (i is 1, 2, 3, etc.) is the setting accuracy M A0 The recognition process is performed on the test dataset until the value of σ is smaller than σ.

[0058] Recognition accuracy M Ai is the setting accuracy M A0 When the number of error bits N used in the previous recognition process is reached, the recognition process for the test data set is completed. E The set value of the write current I SW is determined by the evaluation determination unit 29.

[0059] For example, the recognition accuracy M Ak is the setting accuracy M A0 The above is the recognition accuracy M Ak+1 is the setting accuracy M A0 If it is smaller than the number of error bits N used in the k-th recognition process, Ek Using the set value I SW is determined. FT , the total number of bits of the calculation data N A , the number of error bits N E From the above relationship, "P FT = (N A -N Ek ) / N A ", and the number of error bits N Ek The effective bit ratio P FT is calculated by the evaluation determination unit 29. Then, this effective bit ratio P FT The magnetization reversal probability P SW and the magnetization reversal probability P SW The write current I W Set value I SW To do so.

[0060] In the above example, the number of error bits N E is gradually increased, but the number of error bits NE In this case, the number of error bits N E1 As a result, the recognition accuracy is set to M A0 A value smaller than the above is selected, and the recognition accuracy M Ai First, the setting accuracy M A0 When the number of error bits becomes equal to or greater than N Ei Similarly, the set value I SW It is sufficient to determine the following.

[0061] Next, the recognition mode will be described. Prior to the recognition process in the recognition mode, the convolutional layer weight data set and the fully connected layer weight data set are read from the storage 18 and written to the memory 22. In this example, when writing the convolutional layer weight data set and the fully connected layer weight data set, the write current is set to a specified value I SW0 However, the setting value I SW In addition, the set value I determined by the evaluation determination unit 29 as described above may be SW are set in the output control circuit 32. Note that since the memory 22 is nonvolatile, once the convolutional layer weight data set and the fully connected layer weight data set are written, there is no need to write them again unless there is a change in the convolutional layer weight data set and the fully connected layer weight data set.

[0062] Processing target data to be recognized is written to the memory 22 and held as input layer data. Once the processing target data is written to the memory 22, the logic operation circuit 21 sequentially reads element data of the input layer (processing target data) and weight data of the convolutional layer from the memory 22, performs calculations on the convolutional layer, and sequentially writes the resulting element data of the convolutional layer to the memory 22. After the calculations on the convolutional layer, the logic operation circuit 21 sequentially reads element data of the convolutional layer from the memory 22, performs calculations on the pooling layer, and writes element data extracted by maximum value pooling to the memory 22 as element data of the pooling layer. Next, the logic operation circuit 21 sequentially reads element data of the pooling layer and weight data of the fully connected layer, and writes the data obtained by the calculations on the fully connected layer to the memory 22 as element data of the fully connected layer. After the calculations on the fully connected layer, the logic operation circuit 21 reads element data of the fully connected layer from the memory 22, performs calculations using a softmax function, and outputs the results as the results of the recognition process on the input processing target data.

[0063] As described above, the recognition process is performed on the data to be processed, and when element data of the input layer, element data of the convolutional layer, element data of the pooling layer, and element data of the fully connected layer are written to the memory 22, a write current is passed through each memory cell 24 to which the element data is to be written. At this time, a write current is passed through each MTJ element 25 of each memory cell 24 in a direction corresponding to the bit value of the data to be held.

[0064] Here, the write current is a specified value I SW0In this case, when a write current flows, the magnetization direction of the magnetization free layer 25 b of the MTJ element 25 of each memory cell 24 to be written corresponds to the direction of the write current. For example, when the value of the stored bit is “0” and the value of the bit to be written is “1,” a write current flows through the MTJ element 25 in the antiparallel state, from the magnetization fixed layer 25 a to the magnetization free layer 25 b. This reverses the magnetization direction of the magnetization free layer 25 b, causing the MTJ element 25 to enter the parallel state, and the stored bit is rewritten from “0” to “1.” Conversely, when the value of the stored bit is “1” and the value of the bit to be written is “0,” a write current flows through the MTJ element 25 in the parallel state, from the magnetization free layer 25 b to the magnetization fixed layer 25 a. As a result, the magnetization direction of the magnetization free layer 25b is reversed, the MTJ element 25 is put into an antiparallel state, and the value of the held bit is rewritten from "1" to "0." Note that if the value of the held bit and the value of the bit to be written are the same, the magnetization direction of the magnetization free layer 25b is not reversed.

[0065] In the memory 22 of the processor 12, the output control circuit 32 writes the element data to the specified value I SW0 A lower set value I SW Therefore, the probability that the value of the bit held as described above is rewritten is determined by the magnitude of the write current, i.e., the set value I SW Magnetization reversal probability P SW In other words, the set value I SW The probability according to (1-P SW ) does not cause the value of the bit to be rewritten. In this case, if the value that has been held for that bit is different from the value that should be rewritten, it becomes an error bit, but if the value that has been held and the value that should be rewritten are the same, it does not become an error bit.

[0066] Magnetization reversal probability P SW is the set value I SW The effective bit ratio P FT Since this is the same value as the total number of bits N of the calculation data written to the memory 22 as described above, A Actual number of effective bits N forS The actual ratio of the effective bit ratio P FT As a result, the recognition accuracy is at least equal to the set accuracy M A0 The recognition process of the processing target data is carried out while ensuring this.

[0067] As described above, when writing element data, the specified value I SW0 A lower set value I SW Therefore, the power consumption when writing data to the memory 22 is reduced.

[0068] When Tiny YOLOV3 is used as the architecture for neural network processing by the processor 12, the effective bit ratio P FT becomes "0.7", and the specified value I SW0 is 270 μA, the set value I SW It has been confirmed that the power consumption can be reduced to 256 μA, which is a reduction of 14 μA.

[0069] The characteristics of the memory cells 24, in this example, the MTJ elements 25, may vary due to process variations, etc. In such a case, as shown in FIG. 5, the magnetization reversal probability P SW Based on the characteristics of the highest write current for SW The set value of the write current I SW Furthermore, when the memory cell 24 includes a configuration in which a plurality of MTJ elements 25 are connected in parallel, even if the characteristics of the MTJ elements 25 vary, the memory cell 24 can be regarded as being composed of MTJ elements having average characteristics. Therefore, in such a case, as shown in FIG. 6, the magnetization reversal probability P SW The set value of the write current I SW It can also be converted to

[0070] Second Embodiment In the second embodiment, in the operating condition determination mode, the write current is changed in stages to determine the set value of the write current. Note that the second embodiment is similar to the first embodiment except that the write current is changed in stages to determine the set value of the write current. Components that are substantially the same as those in the first embodiment are denoted by the same reference numerals and will not be described in detail.

[0071] 7, the neural network device 40 in this example has the same configuration as the neural network device 10 of the first embodiment, except that the error adding section is omitted. In the operating condition determination mode, the operating condition determining section 16 of the neural network device 40 operates the processor 12 via the control section 17 to execute recognition processing on the test data set, and also determines the setting accuracy M by gradually changing the write current by the output control circuit 32 for each recognition processing on the test data set. A0 The minimum write current that satisfies the set value I SW In this example, the write current is gradually reduced for each recognition process performed on the test data set.

[0072] In the operating condition determination mode, as shown in FIG. 8, the write current is set to a provisional value I SW1 Then, the recognition process is performed on the test dataset, and the recognition accuracy M A1 In this example, the provisional value I SW1 As a result, the recognition accuracy is set to M A0 Then, the evaluation determination unit 29 selects a value that is larger than the recognition accuracy M A1 is the setting accuracy M A0 For example, it is determined whether the recognition accuracy M A1 is the setting accuracy M A0 If it is equal to or greater than this, the write current is reduced by one step to a provisional value I SW2 The second recognition process is performed on the test dataset, and the recognition accuracy M A2 is the setting accuracy M A0 It is determined whether or not it is equal to or greater than this.

[0073] The write current (provisional value I SWiWhen gradually changing the magnetization reversal probability, it is also preferable to increase or decrease the write current so as to change the magnetization reversal probability in increments of a fixed value based on the relationship between the write current and the magnetization reversal probability of the element constituting the memory cell 24. For example, when the memory cell 24 is constituted by an STT-type MTJ element 25 as described above, the write current is increased or decreased so as to change the magnetization reversal probability in increments of a fixed value based on the relationship between the write current and the magnetization reversal probability as shown in FIG. 3. In this case, the change in the magnetization reversal probability is preferably within a range of 95% to 5%, more preferably within a range of 70% to 30%, and particularly preferably within a range of 55% to 45%.

[0074] In this way, the recognition accuracy M Ai is the setting accuracy M A0 The write current is gradually reduced until the recognition accuracy M Ai is the setting accuracy M A0 When the value of the interim value I first becomes smaller than SWi-1 The set value of the write current I SW Let's say.

[0075] In this example, in the operating condition determination mode, the specified value I SW0 Each recognition process is performed on the test data set in a state where the weight data set is written in advance to the memory 22 using a write current of I SWi may be used to write the load data set to memory 22.

[0076] In the recognition mode, the set value I determined as above is used. SW A write current of I is supplied to the memory 22 to write the data for calculation. SW0 A lower set value I SW Since a write current of at least M flows, the power consumption when writing data to the memory 22 is reduced. A0 The recognition process of the processing target data is carried out while ensuring this.

[0077] In this example, the write current is decreased in stages, but the write current may be increased in stages. In this case, the provisional value I SW1 As a result, the recognition accuracy is set to M A0 A value smaller than the above is selected, and the recognition accuracy M Ai First, the setting accuracy M A0 When it reaches or exceeds the provisional value I SWi Similarly, the set value I SW It is sufficient to determine the following.

[0078] In the operating condition determination mode in each of the above embodiments, the write current is set to a specified value I SW0 The load data set is determined by machine learning and executed by setting the load data set to I. As shown in FIG. 9, the write current is changed in a stepwise manner, and the load data set is determined by machine learning and the write current setting value I. SW It has been decided that:

[0079] In the example shown in FIG. 9, the recognition accuracy is set to M A0 A provisional value I that is smaller than SW1 After setting the write current of the memory 22 to the value, the processor 12 performs machine learning using the learning data set to optimize the load data set held in the memory 22. When optimizing the load data set through this machine learning, the load data in the memory 22 is rewritten (written), and therefore the load data set will contain error bits with a probability according to the write current.

[0080] Next, the processor 12 performs a recognition process on the test data set using the weight data set in the memory 22 optimized as described above. SW1 The element data is written with a write current of . Then, the recognition accuracy M A1 is the setting accuracy M A0 It is determined whether the setting accuracy M is equal to or greater than the A0 can be set arbitrarily, and may be set to the maximum recognition accuracy according to the architecture of the recognition process when the recognition process is performed on the test dataset, for example.

[0081] For example, the recognition accuracy M A1 is the setting accuracy M A0 If it is smaller, the write current is increased by one step to a provisional value I SW2 Then, machine learning is performed using the training dataset in the same manner as above, and recognition processing is performed on the test dataset using the weight dataset optimized by the machine learning. The recognition accuracy M A2 is the setting accuracy M A0 It is determined whether or not it is equal to or greater than this.

[0082] In this way, the recognition accuracy M Ai is the setting accuracy M A0 Until this is achieved, machine learning is performed using the learning dataset, and recognition processing is performed on the test dataset using the weight dataset optimized by this. Then, the recognition accuracy M Ai is the setting accuracy M A0 At this point, the recognition process for the test data set is completed, and the provisional value I SWi The set value of the write current I SW and also determine the weight data set to be used in the recognition mode.

[0083] 9, the write current is increased in stages, but it may be decreased in stages as in the second embodiment. Also, in this example, the write current is changed in stages, but it may be changed in stages to increase the number of error bits in the operation data, that is, to decrease the effective bit ratio P FT is gradually changed to obtain the machine learning and write current setting value I SW The decision may be made.

[0084] The write current of only some layers, such as the input layer, the output layer, and intermediate layers (hidden layers) between the input layer and the output layer, such as the convolutional layer and the fully connected layer, can be set to a value smaller than the specified value. Also, for example, the write current of the convolutional layer, which has a large amount of weight data and the largest number of calculations, can be set to a value smaller than the specified value. For example, when the write current of only the convolutional layer in the above example is to be set to a value smaller than the specified value, the write current setting value can be determined by gradually changing the write current when writing the convolutional layer weight data set used in the calculation of the convolutional layer and the element data obtained by that calculation in an operating condition determination mode. Furthermore, when determining the write current setting value by adding an error, an error is added to either or both of the convolutional layer weight data set used in the calculation of the convolutional layer and the convolutional layer data obtained by that calculation, and the total number of bits N of those convolutional layer weight data set and convolutional layer data is calculated. A and the number of effective bits N S The effective bit ratio P is calculated from FT The set value of the write current can be determined from the above.

[0085] The memory 22 in the above example is an STT-MRAM configured with memory cells 24 using STT-type MTJ elements that perform writing, i.e., bit value inversion, using a current. However, the memory is not limited to this, and memory cells configured with memory elements in which the probability of bit value inversion changes depending on the magnitude of the write current or write voltage can also be used. If the bit value held in the memory element (memory cell) is rewritten by applying a write voltage, a write voltage that satisfies the set accuracy can be determined instead of a write current, and data can be written using that write voltage. For example, the memory may be an SOT-MRAM configured with memory cells using SOT (spin-orbit torque)-type MTJ elements that invert the bit value by applying a write voltage, or a resistance change memory (ReRAM) that changes resistance by applying a write voltage or write current. Furthermore, the memory is not limited to non-volatile memory, and may be a volatile memory such as an SRAM.

[0086] As described above, in the neural network devices 10 and 40, power consumption is reduced by setting the write current lower than the specified value, and therefore power consumption can be further reduced by applying clock gating and power gating. For example, when the logic operation circuit 21 does not access the memory 22, the clock supply to the memory 22 can be stopped or the power supply can be cut off. Of course, clock gating and power gating can also be applied to the logic operation circuit 21.

[0087] Using neural network models ResNet50 and VGG16, which are convolutional neural networks, a simulation was performed assuming that the write current or voltage to the memory cells constituting the neural network device was lower than the specified value, and the impact of error bits in the calculation data on recognition accuracy was verified. In this verification, assuming that the write current to the memory cells was lower than the specified value, errors were randomly applied at a rate of 10% to 20% (effective bit ratio PFT of 0.9 to 0.8) to the lowest 8 bits of the weight of the filter for the convolution calculation. In addition, Top-1 accuracy and Top-5 accuracy were used to evaluate recognition. The results are shown in Figures 10 and 11. Note that in each graph shown in Figures 10 and 11, the horizontal axis represents the rate of applied error (Random Error Rate (1-P FT )) and the vertical axis is recognition accuracy.

[0088] The degradation in recognition accuracy from the baseline recognition accuracy when an error is introduced was 0.037 for Top-1 accuracy and 0.020 for Top-5 accuracy at a 10% error for ResNet50, and 0.060 for Top-1 accuracy and 0.033 for Top-5 accuracy at a 20% error for VGG16. Furthermore, the degradation in recognition accuracy from the baseline recognition accuracy when an error is introduced was 0.008 for Top-1 accuracy and 0.003 for Top-5 accuracy at a 10% error, and 0.013 for Top-5 accuracy at a 20% error for Top-1 accuracy and 0.007 for Top-5 accuracy at a 20% error. Thus, it can be seen that introducing an error of 10% to 20% has little effect on recognition accuracy. These results demonstrate that power consumption can be reduced by lowering the write current or voltage to the memory cells constituting the neural network device below the specified value without significantly affecting recognition accuracy. The standard recognition accuracy without errors was 0.749 for Top-1 accuracy and 0.921 for Top-5 accuracyd for ResNet50, and 0.713 for Top-1 accuracy and 0.901 for Top-5 accuracyd for VGG16.

[0089] The above describes an example in which an operating condition determination unit is provided in a neural network device, but the operating condition determination unit may also be an independent operating condition determination device that is connected to a processor and a power supply unit when determining the setting value of the write current or write voltage.

[0090] 10, 40 Neural network device 12 Processor 14 Power supply unit 16 Operation condition determination unit 21 Logic operation circuit 22 Memory 24 Memory cell 25 MTJ element 32 Output control circuit

Claims

1. A neural network device comprising: a neural network calculation unit comprising a memory composed of a plurality of memory cells for storing calculation data for neural network processing; and a calculation circuit for transmitting and receiving the calculation data between the memory and performing calculations for neural network processing using the calculation data; and a power supply unit for supplying a write current or write voltage of a set value to the memory when writing the calculation data, the set value being set to be equal to or higher than a set accuracy for the processing accuracy of the neural network processing by the neural network calculation unit and lower than a specified value determined to invert bits for the plurality of memory cells.

2. The neural network device according to claim 1, further comprising an operating condition determination unit which operates the neural network calculation unit to determine the set value, and wherein the power supply unit supplies the write current or the write voltage of the set value determined by the operating condition determination unit to the memory.

3. The neural network device according to claim 2, characterized in that: the ratio of the number of effective bits of the calculation data excluding error bits to the total number of bits of the calculation data in one neural network processing is defined as an effective bit ratio; the operating condition determination unit specifies an effective bit ratio at which the processing accuracy for the test data set is equal to or greater than the set accuracy by introducing an error into part of the calculation data for a test data set and having the neural network calculation unit execute the operation; the specified effective bit ratio is defined as an inversion probability that the value of a bit in the memory cell is inverted; and the write current or write voltage for the memory cell corresponding to the inversion probability is determined as the set value based on the characteristics of the memory cell.

4. The neural network device of claim 3, characterized in that the operating condition determination unit gradually changes the number of error bits for the calculation data for each test data of the test data set for each neural network processing performed on the test data set, and obtains the specified effective bit ratio from the maximum number of error bits when the processing accuracy obtained by having the neural network calculation unit perform multiple neural network processing on the test data set becomes equal to or greater than the set accuracy.

5. The neural network device of claim 2, characterized in that the operating condition determination unit determines the setting value such that the processing accuracy for a test data set is equal to or greater than the set accuracy by operating the neural network calculation unit by lowering the write current or the write voltage supplied to the memory from the power supply unit below the specified value.

6. The neural network device of claim 5, wherein the operating condition determination unit changes the write current or the write voltage supplied from the power supply unit in stages for each neural network processing on the test data set, and causes the neural network calculation unit to perform multiple neural network processing on the test data set, so that the processing accuracy obtained is equal to or greater than the set accuracy, and the minimum write current or write voltage is set as the set value.

7. The neural network device according to any one of claims 1 to 6, wherein the memory is any one of STT-MRAM, SOT-MRAM, ReRAM, and SRAM.

8. A method for determining operating conditions, comprising: an accuracy setting step for setting, as a set accuracy, a processing accuracy to be satisfied by a neural network calculation unit, the neural network calculation unit being composed of a plurality of memory cells and having a memory for storing calculation data for neural network processing, and an arithmetic circuit for transmitting and receiving the calculation data between the memory and the neural network processing unit and performing calculations for neural network processing using the calculation data; and a determination step for determining, for a write current or write voltage to be supplied to the memory when writing the calculation data to the memory, a set value that satisfies the set accuracy and is set lower than a specified value determined to invert bits for the plurality of memory cells.

9. The operating condition determination method according to claim 8, characterized in that the determination step defines an effective bit ratio as a ratio of the number of effective bits of the calculation data excluding error bits to the total number of bits of the calculation data in one neural network processing, and the determination step includes: a specifying step of specifying an effective bit ratio at which the processing accuracy for the test data set is equal to or greater than the set accuracy by introducing an error into a part of the calculation data for a test data set and having the neural network calculation unit execute the operation; and a conversion step of defining the specified effective bit ratio as an inversion probability at which a bit value in the memory cell is inverted, and setting the write current or the write voltage for the memory cell corresponding to the inversion probability based on the characteristics of the memory cell as the set value.

10. The operating condition determination method according to claim 9, characterized in that the identification step involves gradually changing the number of error bits for the calculation data for each test data of the test data set for each neural network processing performed on the test data set, executing multiple neural network processing on the test data set in the neural network calculation unit to determine the maximum number of error bits for which the processing accuracy is equal to or greater than the set accuracy, and obtaining the specified effective bit ratio from the determined number of error bits.

11. The operating condition determination method of claim 8, characterized in that the determination step operates the neural network calculation unit by lowering the write current or write voltage to the memory below the specified value, thereby determining the setting value such that the processing accuracy for the test data set is equal to or greater than the set accuracy.

12. The operating condition determination method of claim 11, characterized in that the determination step involves gradually changing the write current or the write voltage for each neural network processing of the test data set, and having the neural network calculation unit perform multiple neural network processing of the test data set, thereby setting the minimum write current or the write voltage as the set value, at which the processing accuracy obtained is equal to or greater than the set accuracy.

Citation Information

Patent Citations

  • Method and apparatus for using memory in a probabilistic manner to store synaptic weights of a neural network

    JP2015501972A

  • Arithmetic device

    JP2020123414A