Memristor memory and calculation integrated on-chip training method and device based on matrix low-rank decomposition

Through matrix low-rank decomposition technology, it solves the problems of high time and power consumption and poor scalability in existing on-chip training methods. It realizes fast and low-power deep neural network training, improves calculation accuracy, and is suitable for large-scale applications. Neural network deployment.

CN118821884AActive Publication Date: 2024-10-22TSINGHUA UNIVERSITY
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410871181.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-10-22
Estimated Expiration
2044-07-01

AI Technical Summary

Technical Problem

Existing on-chip training methods suffer from excessive time and power consumption costs, poor scalability, and large accuracy loss after training when deploying deep neural networks.

Method used

An on-chip training method for memristor storage and computing based on matrix low-rank decomposition is adopted. By substituting the target training network model into the preset non-ideal factor model for offline training, a pre-trained model is obtained, and the pre-trained model is obtained by low-rank decomposition to obtain the main model. The intervention training network and bypass network are deployed in the memristor array and digital unit of the storage and computing integrated chip for on-chip training, and the gradient reverse update of the bypass network is used to improve calculation accuracy.

Benefits of technology

It achieves a fast convergence and low power consumption training process, which can be applied to large-scale deep neural networks. The accuracy is close to the calculation results of all-digital chips. It avoids the large-scale impact on memristor programming during the training process and improves the calculation of the system. Accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118821884A_ABST
    Figure CN118821884A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of on-chip training, in particular to a memristor memory and calculation integrated on-chip training method and device based on matrix low-rank decomposition, and the method comprises the steps: substituting a target training network model into a preset non-ideal factor model for offline training, obtaining a pre-training model with tolerance to actual non-ideal factors of the target storage and calculation integrated chip; performing low-rank decomposition on the pre-training model by using a matrix low-rank decomposition network to obtain a main intervention training network and a bypass network; and deploying the main intervention training network to the memristor array of the target storage and calculation integrated chip, and deploying the bypass network to the digital unit of the target storage and calculation integrated chip to perform on-chip training on the memristor array and the digital unit to obtain the trained memristor array. Therefore, the problems that an existing on-chip training method is too high in time and power consumption cost, low in expandability, not suitable for a large-scale deep neural network, still large in precision loss after training and the like are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of on-chip training technology, and in particular to a memristor storage-computation integrated on-chip training method and device based on matrix low-rank decomposition. Background Art

[0002] In the past decade, the field of artificial intelligence has experienced significant technological innovation, especially deep learning algorithms have made great progress in many areas such as computer vision, natural language processing and reinforcement learning. These algorithms usually rely on large-scale neural network models, and the number of parameters and data of these models have increased dramatically, so the demand for computing resources has also increased. Traditional CMOS-based von Neumann architecture chips, such as CPUs, have low energy efficiency and low computing power when performing deep learning tasks due to the separation of their storage and processing units. Although GPUs have high computing power, they are still insufficient in terms of energy efficiency. Therefore, in edge computing scenarios, high-computing and high-efficiency chips based on non-von architectures are a key research direction.

[0003] The storage-computing integrated computing chip based on non-volatile storage array breaks through the limitations of the von Neumann architecture, integrates the storage unit and the computing unit, and reduces the delay and energy consumption of data moving between the storage unit and the computing unit. When facing computationally intensive tasks such as neural networks, the high energy efficiency brought by the fusion of storage units and computing units is more prominent. In the storage-computing integrated computing chip, the core computing unit is composed of a non-volatile storage array and peripheral circuits (such as analog-to-digital converters, digital-to-analog converters, etc.), which can accelerate the calculation of the core operator in computationally intensive tasks such as neural networks-matrix vector multiplication (MVM) through analog computing. Although this solution has the characteristics of high energy efficiency and scalability of computing power, when the non-volatile storage array and peripheral circuit use analog computing to realize matrix vector multiplication calculation, it will face the superposition of multi-level non-ideal factors such as memristor units, memristor arrays, and peripheral analog circuits, which will cause the calculation process to lose precision, making the calculation result lower than the calculation result of digital chips. Especially when facing multi-layer deep networks, the precision loss caused by non-ideal factors is more serious.

[0004] There are currently two solutions to the problem of precision loss in storage and computing integration: offline training and on-chip training.

[0005] The idea of ​​offline training is to model the non-ideal factors of the memristor array and peripheral circuits in the calculation process, obtain compact models, such as the relaxation model of the device, the finite state of the device (quantization model), the read and write noise model of the device, the IR-drop model of the circuit, etc., and bring these models into the network training, and use the redundancy characteristics of the neural network to obtain a model that can tolerate these non-ideal factors, and then deploy it to the chip. However, this method has two problems: 1) Difficult modeling: Most of the non-ideal factors of the device array and the circuit are strongly coupled, which makes the model of the chip state have many influencing factors, and it is difficult to use these compact models to fully match the actual working behavior of the chip. Therefore, the trained network cannot fully adapt to the non-ideal factors on the chip, so that the trained network often has reduced accuracy after being deployed on the chip; 2) Difficult to adapt to chip changes: The trained network will have write errors when deployed to the memristor array. And after writing, due to the characteristics of the device such as retention, the weight value will drift over time, and offline learning cannot adapt to these changes inside the chip.

[0006] The idea of ​​on-chip training is to incorporate the chip into the training process, that is, first deploy the network model obtained by offline training on the chip, and then perform further adaptive training. During the adaptive training process, the inference process is actually completed on the chip, and then the calculated gradient is updated on the chip to obtain higher calculation accuracy. This solution does not require a perfect compact model to represent the chip behavior, and can also adapt to changes in the chip. Currently, there are mainly hybrid training, layer-by-layer training and other methods. However, these methods have the following problems: 1) Hybrid training can only adjust the last few layers on chip, and this method is not scalable. When facing the on-chip deployment of deep large-scale neural networks, the redundancy of the last layer cannot completely solve the accuracy loss of the previous layers; 2) Layer-by-layer training is a layer-wise greedy algorithm. It can train deep neural networks that adapt to non-ideal factors of the chip. However, the cost of its training is extremely high, including time cost and power cost, which makes this method not possible for practical application.

[0007] At the same time, whether it is offline training or on-chip training, when deploying deep neural networks, compared with the calculation results of digital chips, although most of the non-ideal factors can be compensated, there will still be a relatively large loss of accuracy. This is determined by the characteristics of analog memristor arrays. Summary of the invention

[0008] The present invention provides a memristor storage-computation integrated on-chip training method and device based on matrix low-rank decomposition, so as to solve the problems of existing on-chip training methods having high time and power consumption, low scalability, inapplicability to large-scale deep neural networks, and still having large accuracy loss after training.

[0009] The first aspect of the present invention provides an on-chip training method for a memristor storage and computing integrated device based on matrix low-rank decomposition, comprising the following steps: substituting a target training network model into a preset non-ideal factor model for offline training to obtain a pre-trained model that has tolerance for the actual non-ideal factors of the target storage and computing integrated chip; performing low-rank decomposition of the pre-trained model using a matrix low-rank decomposition network to obtain a main intervention training network and a bypass network; deploying the main intervention training network to the memristor array of the target storage and computing integrated chip, and deploying the bypass network to the digital unit of the target storage and computing integrated chip to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array.

[0010] Optionally, the method further includes: before performing offline training, quantizing and noise-adding the target training network model, so as to substitute the quantized and noise-adding target training network model into the preset non-ideal factor model for offline training.

[0011] Optionally, the method of using a matrix low-rank decomposition network to perform low-rank decomposition on the pre-trained model to obtain a main intervention training network and a bypass network includes: obtaining a main network layer of the pre-trained model, and using the main network layer as the main intervention training network; and using a matrix low-rank decomposition network to perform low-rank decomposition on the main network layer to obtain multiple two-layer small networks, and using the multiple two-layer small networks as the bypass network.

[0012] Optionally, each two-layer small network is a two-layer fully connected layer network or a two-layer convolutional layer network.

[0013] Optionally, the main intervention training network is deployed into the memristor array of the target storage-computing integrated chip, and the bypass network is deployed into the digital unit of the target storage-computing integrated chip to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array, including: deploying the main intervention training network into the memristor array of the target storage-computing integrated chip to perform forward reasoning to obtain a first output; deploying the bypass network into the digital unit of the target storage-computing integrated chip to perform forward reasoning to obtain a second output; comparing the first output and the second output with preset theoretical values, and obtaining residuals based on the comparison results; and using the residuals to reversely update the gradient of the bypass network to obtain the trained memristor array.

[0014] The second aspect of the present invention provides an on-chip training device for memristor storage and computing based on matrix low-rank decomposition, including: an offline training module, used to substitute a target training network model into a preset non-ideal factor model for offline training, so as to obtain a pre-trained model that has tolerance for the actual non-ideal factors of the target storage and computing chip; a low-rank decomposition module, used to perform low-rank decomposition on the pre-trained model using a matrix low-rank decomposition network, so as to obtain a main intervention training network and a bypass network; an on-chip training module, used to deploy the main intervention training network into the memristor array of the target storage and computing chip, and deploy the bypass network into the digital unit of the target storage and computing chip, so as to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array.

[0015] Optionally, the on-chip training module includes a digital matrix multiplication calculation unit, a first analog storage and calculation integrated calculation subunit, a second analog storage and calculation integrated calculation subunit and a special function calculation unit, wherein:

[0016] A simulation storage-computation integrated computing unit is used to deploy the main intervention training network into the memristor array of the target storage-computation integrated chip for forward reasoning to obtain a first output;

[0017] A first digital matrix multiplication calculation unit, used for deploying the bypass network into a digital unit of the target storage-computation integrated chip for forward reasoning to obtain a second output;

[0018] A special function calculation unit, used for comparing the first output and the second output with a preset theoretical value to obtain a residual;

[0019] The second digital matrix multiplication calculation unit is used to use the residual to reversely update the gradient of the bypass network to obtain a trained memristor array.

[0020] A third aspect of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the on-chip training method for memristor storage and computing based on matrix low-rank decomposition as described in the above embodiments.

[0021] A fourth aspect of the present invention provides a computer program product, which, when executed by a processor, implements the above-mentioned on-chip training method for memristor storage and computing based on low-rank matrix decomposition.

[0022] A fifth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned on-chip training method for memristor storage and computing based on low-rank matrix decomposition.

[0023] The on-chip training method and device for memristor storage and computing based on low-rank matrix decomposition proposed in the embodiment of the present invention deploy the network model after offline training on the memristor array, and then deploy the bypass networks corresponding to several layers in the digital unit and perform on-chip training. During the on-chip training process, the parameter quantity and calculation amount of the bypass network are much smaller than those of the corresponding layer of the original network, and the weight update only occurs in the bypass network. Therefore, there is no need to repeatedly program the memristor, the convergence is fast, and the power consumption cost is very small. It can be expanded to large-scale deep neural networks, and the calculation accuracy of the entire system can also be improved. The upper limit of accuracy is closer to the calculation result of the all-digital chip.

[0024] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0026] Figure 1 A flow chart of an on-chip training method for memristor storage and computing based on low-rank matrix decomposition provided by an embodiment of the present invention;

[0027] Figure 2 A schematic diagram of a storage-computation-in-one computing array and its implementation of matrix-vector multiplication provided by an embodiment of the present invention;

[0028] Figure 3 A schematic diagram of a core computing unit of a storage-computing integrated computing chip provided in an embodiment of the present invention;

[0029] Figure 4 A schematic diagram of the decomposition process of a matrix low-rank decomposition network provided in an embodiment of the present invention;

[0030] Figure 5 A schematic diagram of a complete deployment process of online training based on low-rank decomposition provided by an embodiment of the present invention;

[0031] Figure 6 A schematic diagram of the specific structure of the backbone network and the bypass network provided in an embodiment of the present invention;

[0032] Figure 7 A schematic diagram of a bypass network structure of a fully connected layer provided in an embodiment of the present invention;

[0033] Figure 8 A schematic diagram of a bypass network structure of a convolutional layer provided in an embodiment of the present invention;

[0034] Fig. 9A block diagram of an on-chip training device for memristor storage and computing based on low-rank matrix decomposition provided by an embodiment of the present invention;

[0035] Fig.10 A schematic diagram of the specific architecture of the on-chip training module provided in an embodiment of the present invention;

[0036] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0037] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0038] The following describes the on-chip training and device of memristor storage and computing based on low-rank matrix decomposition according to an embodiment of the present invention with reference to the accompanying drawings.

[0039] Specifically, Figure 1 A flowchart of an on-chip training method for memristor storage and computing based on low-rank matrix decomposition provided in an embodiment of the present invention.

[0040] like Figure 1 As shown, the on-chip training method of memristor storage and computing based on low-rank matrix decomposition includes the following steps:

[0041] In step S101, the target training network model is substituted into a preset non-ideal factor model for offline training to obtain a pre-trained model that is tolerant to the actual non-ideal factors of the target storage-computing integrated chip.

[0042] In some embodiments, the method further includes: before performing offline training, quantizing and noise-adding the target training network model, and substituting the quantized and noise-adding target training network model into a preset non-ideal factor model for offline training.

[0043] During the actual execution process, the target training network model is first quantized and noisy, and the quantized and noisy target training model is brought into the preset non-ideal factor model such as the circuit for offline training, so as to obtain a pre-trained model that has a certain tolerance for the actual non-ideal factors of the target storage and computing integrated chip.

[0044] It should be noted that the non-volatile memory array storage and computing integrated chip selected in the embodiment of the present invention includes, but is not limited to, new non-volatile memory devices such as Resistive Random Access Memory (RRAM), Phase Change Memory (PCM), Magnetic Random Access Memory (MRAM), and Ferroelectric Memory (FeRAM), as well as traditional non-volatile memory devices such as Floating Gate Transistor (Flash) and Dynamic Random Access Memory (DRAM). In addition, the structure of the non-volatile memory array should include the two structures of 1T1R (1Transistor 1RRAM) and 2T2R (2Transistor 2RRAM).

[0045] like Figure 2 As shown, the target storage and computing integrated chip in the embodiment of the present invention realizes matrix-vector multiplication in an analog manner for computing tasks such as neural networks. Specifically, the element values ​​of the matrix are mapped to the conductance values ​​of the array units, and the element values ​​in the vector are input into the encoding module and encoded as voltage pulses. The analog calculation is performed using Ohm's law and Kirchhoff's law. The calculation result is output in the form of current in each column. The output current is quantized into a digital quantity through an output quantization circuit such as an ADC to obtain the calculation result of the matrix-vector multiplication.

[0046] Furthermore, if Figure 3 As shown, the core computing unit of the target storage-computing integrated chip in the embodiment of the present invention includes modules such as an input-output buffer unit, a digital-to-analog conversion unit, an analog-to-digital conversion unit, a programming unit, a state control and selection unit, an input-output module, and a non-volatile storage array. In the process of reasoning calculation, the weight data is first mapped to the non-volatile storage array through the programming unit. For input data such as pictures, it first enters the input buffer unit through the input and output module, is converted into a voltage signal by the digital-to-analog conversion unit, and then inputs the non-volatile storage array. The output result, that is, the current signal, is converted into a digital signal by the analog-to-digital conversion unit and the shift accumulator, and then cached in the output buffer unit, and output through the input and output module. The state control and selection unit can control the core computing unit to perform forward calculation, weight mapping, and reverse update. The embodiment of the present invention refers to the core computing unit as XB (CrossBar).

[0047] In step S102, the pre-trained model is low-rank decomposed using a matrix low-rank decomposition network to obtain a main intervention training network and a bypass network.

[0048] In some embodiments, a pre-trained model is low-rank decomposed using a matrix low-rank decomposition network to obtain a main intervention training network and a bypass network, including:

[0049] Get the main network layer of the pre-trained model and use the main network layer as the main intervention training network;

[0050] The main network layer is decomposed into low rank using a matrix low rank decomposition network to obtain multiple two-layer small networks, so that the multiple two-layer small networks can be used as bypass networks.

[0051] It should be noted that the matrix low-rank decomposition network can transform the weight matrix W of the neural network into the multiplication of several small matrices through low-rank decomposition, thereby reducing the number of parameters and computational complexity of the model, and can achieve training of downstream tasks when the computational complexity and storage requirements are much smaller than full network fine-tuning. Compared with full network fine-tuning, it also has the advantages of reducing overfitting, improving model generalization ability, and quickly adapting to new task areas. Therefore, the over-parameterized model obtained by pre-training in the embodiment of the present invention actually exists in a lower intrinsic dimension. Assuming that the change in weights during the model adaptation process also has a lower "intrinsic rank", the network layer in a pre-trained model can be approximated by two small network layers after low-rank decomposition. Figure 4 As shown in the figure, the number of parameters of the original pre-trained network layer W is m*n, and the network can be decomposed into two layers of small networks A and B using matrix low-rank decomposition, with the number of parameters m*r and r*n respectively, where r is much smaller than min(m,n). Here A*B is used to approximate W, and the number of parameters of the two layers of small networks A and B is (m+n)*r. The number of parameters of W is m*n, which is m*n / ((m+n)*r) times the number of parameters of the small networks A and B.

[0052] Therefore, in the actual execution process, the embodiment of the present invention first obtains the main network layer of the pre-trained model, and uses the main network layer as the main intervention training network, and then uses the matrix low-rank decomposition network to perform low-rank decomposition on the main network layer to obtain multiple two-layer small networks, and uses the multiple two-layer small networks as bypass networks, wherein each two-layer small network can be a two-layer fully connected layer network or a two-layer convolutional layer network.

[0053] In step S103, the main intervention training network is deployed to the memristor array of the target storage-computing integrated chip, and the bypass network is deployed to the digital unit of the target storage-computing integrated chip to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array.

[0054] In some embodiments, the main intervention training network is deployed in the memristor array of the target storage-computing integrated chip, and the bypass network is deployed in the digital unit of the target storage-computing integrated chip to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array, including:

[0055] Deploy the main intervention training network to the memristor array of the target storage-computing integrated chip for forward reasoning to obtain the first output;

[0056] Deploy the bypass network to the digital unit of the target storage-computing integrated chip to perform forward reasoning and obtain the second output;

[0057] Comparing the first output and the second output with a preset theoretical value, and obtaining a residual according to the comparison result;

[0058] The residual is used to reversely update the gradient of the bypass network to obtain the trained memristor array.

[0059] In the actual implementation process, Figure 5 and 6 As shown, the main intervention training network is deployed in the memristor array of the target storage-computing integrated chip, the bypass network is deployed in the digital unit part layer of the target storage-computing integrated chip, multiple two-layer fully connected layer networks and multiple two-layer convolutional layer networks are respectively deployed on the part layer of the digital unit, and the main intervention training network deployed in the memristor array and the bypass network deployed in the digital unit jointly complete the forward reasoning. For any layer of the network layer with the bypass network, the output of this layer is obtained by adding the result of the main intervention training network and the result of the bypass network. In this process, the output with errors caused by the real non-ideal factors of the target storage-computing integrated chip will be reflected in the final calculation result. Therefore, the main intervention training network deployed on the memristor array will be frozen and does not need to be updated. Only the bypass network deployed in the digital unit needs to be updated according to the gradient. The update process is to subtract the output after addition from the preset theoretical value, take the difference as the residual, and reversely update the gradient of the bypass network according to the residual to complete the back propagation process (i.e., reverse update), thereby obtaining the trained memristor array.

[0060] It should be noted that the gradient update algorithm of the bypass network can be performed using algorithms such as BP.

[0061] Furthermore, if Figure 7 As shown, when the two-layer fully connected network is deployed at a certain layer of the digital unit, the matrix multiplication calculation is performed directly, and its weight is W. The two-layer fully connected network is A and B. Assume W∈R d×k , then, A∈R d×r ,B∈R r×k , and r<<min(d,k), where r is a hyperparameter representing the intrinsic rank size of the setting.

[0062] Furthermore, if Figure 8 As shown, when a two-layer convolutional network is deployed in a certain layer of a digital unit, it is assumed that the parameter of its weight W is cin ,k,k,c out , the two convolutional layers are A and B. The weight parameter information of the first layer A is c in ,k,k,r, the weight parameter of the second layer B is r,1,1,c out The overall reduction in the number of parameters is: Where r is a hyperparameter, representing the intrinsic rank size of the setting.

[0063] It should be noted that r is a hyperparameter that can be selected based on the specific training effect. Typical values ​​that can be provided are 1, 2, 4, 8, 6, etc. It is related to the complexity of the computing task, the size of the pre-trained model, etc. This value affects the number of trainable parameters, which in turn affects the overall power consumption during the training process and the final training effect.

[0064] Regarding which layers to set the bypass network, it is also a hyperparameter. Those skilled in the art can set it for each layer, or for every other layer, or more sparsely. It is related to the complexity of the computing task, the size of the pre-trained model, etc. This value affects the number of trainable parameters, and thus affects the overall power consumption during the training process, as well as the final training effect.

[0065] In summary, the on-chip training method for memristor storage and computing based on low-rank matrix decomposition proposed in an embodiment of the present invention has the following beneficial effects:

[0066] (1) Since the training is performed by digital units, compared with previous on-chip training schemes, the large-scale programming process of memristors during training is avoided, and the influence of the read and write noise of memristors on the training convergence is avoided. At the same time, the number of parameters that need to be trained is small, so the convergence speed is fast and the time cost is small.

[0067] (2) Since the large-scale programming process of memristors is avoided during training, the power consumption of training is low;

[0068] (3) It can support on-chip training of networks of arbitrary depth and compensate for the accuracy loss caused by deploying the corresponding layer on the memristor array. Therefore, it has strong scalability and can be applied to large-scale deep neural networks.

[0069] (4) Due to the introduction of digital units without precision loss, the network branches of the calculation bypass can provide more information, thereby reducing the precision loss of the analog part due to non-ideal factors.

[0070] Next, a memristor storage-computation integrated on-chip training device based on matrix low-rank decomposition proposed in accordance with an embodiment of the present invention will be described with reference to the accompanying drawings.

[0071] Fig. 9It is a block diagram of an on-chip training device for memristor storage and computing based on low-rank matrix decomposition according to an embodiment of the present invention.

[0072] like Fig. 9 As shown, the memristor storage and computing integrated on-chip training device 90 based on matrix low-rank decomposition includes: an offline training module 901, a low-rank decomposition module 902 and an on-chip training module 903.

[0073] Among them, the offline training module 901 is used to substitute the target training network model into the preset non-ideal factor model for offline training, so as to obtain a pre-trained model that is tolerant to the actual non-ideal factors of the target storage and computing integrated chip. The low-rank decomposition module 902 is used to perform low-rank decomposition on the pre-trained model using a matrix low-rank decomposition network to obtain a main intervention training network and a bypass network. The on-chip training module 903 is used to deploy the main intervention training network into the memristor array of the target storage and computing integrated chip, and deploy the bypass network into the digital unit of the target storage and computing integrated chip, so as to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array.

[0074] In some embodiments, the on-chip training module includes a digital matrix multiplication calculation unit, a first analog storage and calculation integrated calculation subunit, a second analog storage and calculation integrated calculation subunit and a special function calculation unit, wherein:

[0075] The simulation storage-computing integrated computing unit is used to deploy the main intervention training network to the memristor array of the target storage-computing integrated chip for forward reasoning to obtain a first output;

[0076] A first digital matrix multiplication calculation unit is used to deploy the bypass network to the digital unit of the target storage and computing integrated chip to perform forward reasoning to obtain a second output;

[0077] A special function calculation unit, used for comparing the first output and the second output with a preset theoretical value to obtain a residual;

[0078] The second digital matrix multiplication calculation unit is used to use the residual to reversely update the gradient of the bypass network to obtain a trained memristor array.

[0079] In the actual implementation process, Fig.10As shown, the memristor storage-computation integrated on-chip training method based on matrix low-rank decomposition proposed in the embodiment of the present invention requires an analog storage-computation integrated computing unit based on a memristor array, and also requires a digital computing unit for deploying a bypass network to support training tasks. Therefore, in addition to constructing an offline training module 901, a low-rank decomposition module 902 and an on-chip training module 903, the embodiment of the present invention also constructs a heterogeneous hardware architecture to assist in implementing the on-chip training module 903. The heterogeneous hardware architecture includes a digital matrix multiplication computing unit, a first analog storage-computation integrated computing sub-unit, a second analog storage-computation integrated computing sub-unit and a special function computing unit, an instruction cache unit, an intermediate activation cache unit, a weight cache unit, etc.

[0080] The first analog storage and computing integrated computing sub-unit and the second analog storage and computing integrated computing sub-unit constitute an analog storage and computing integrated computing unit, which is used to deploy the main intervention training neural network to realize the matrix multiplication calculation in the analog domain, and can provide energy-efficient network computing; the digital matrix multiplication computing unit is deployed with a bypass network, which can realize high-precision matrix multiplication calculation and support the back propagation algorithm; the instruction cache unit includes a digital unit instruction cache and an analog unit instruction cache, which respectively store instructions for controlling the analog storage and computing integrated computing unit and the digital matrix multiplication computing unit; the intermediate activation cache unit is used to store the input and output data of each layer, and the cache unit is shared by the digital unit and the analog unit; the input data is sent to the two parts at the same time for calculation, and the calculated output result is temporarily stored in the intermediate activation cache unit after the special function calculation unit performs proportional adjustment, addition, activation and other operations for the calculation of the next layer.

[0081] In addition, the heterogeneous hardware architecture may also include a controller, a storage unit and an I / O unit, wherein the controller is responsible for scheduling tasks, usually a CPU; the storage unit is responsible for storing basic information such as weights and input data, and its capacity is larger than the cache unit; the I / O unit is responsible for communication.

[0082] It should be noted that the aforementioned explanation of the embodiment of the on-chip training method for memristor storage and computing based on low-rank decomposition of matrices is also applicable to the on-chip training device for memristor storage and computing based on low-rank decomposition of matrices of this embodiment, and will not be repeated here.

[0083] The memristor storage-computation integrated on-chip training device based on matrix low-rank decomposition proposed in an embodiment of the present invention has the following beneficial effects:

[0084] (1) Since the training is performed by digital units, compared with previous on-chip training schemes, the large-scale programming process of memristors during training is avoided, and the influence of the read and write noise of memristors on the training convergence is avoided. At the same time, the number of parameters that need to be trained is small, so the convergence speed is fast and the time cost is small.

[0085] (2) Since the large-scale programming process of memristors is avoided during training, the power consumption of training is low;

[0086] (3) It can support on-chip training of networks of arbitrary depth and compensate for the accuracy loss caused by deploying the corresponding layer on the memristor array. Therefore, it has strong scalability and can be applied to large-scale deep neural networks.

[0087] (4) Due to the introduction of digital units without precision loss, the network branches of the calculation bypass can provide more information, thereby reducing the precision loss of the analog part due to non-ideal factors.

[0088] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device may include:

[0089] A memory 1101 , a processor 1102 , and a computer program stored in the memory 1101 and executable on the processor 1102 .

[0090] When the processor 1102 executes the program, the on-chip training method for memristor storage and computing based on matrix low-rank decomposition provided in the above-mentioned embodiment is implemented.

[0091] Furthermore, the electronic device further comprises:

[0092] The communication interface 1103 is used for communication between the memory 1101 and the processor 1102 .

[0093] The memory 1101 is used to store computer programs that can be executed on the processor 1102 .

[0094] The memory 1101 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0095] If the memory 1101, the processor 1102 and the communication interface 1103 are implemented independently, the communication interface 1103, the memory 1101 and the processor 1102 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0096] Optionally, in a specific implementation, if the memory 1101, the processor 1102 and the communication interface 1103 are integrated on a chip, the memory 1101, the processor 1102 and the communication interface 1103 can communicate with each other through an internal interface.

[0097] The processor 1102 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.

[0098] An embodiment of the present invention also provides a computer program product, which, when executed by a processor, implements the above-mentioned on-chip training method for memristor storage and computing based on low-rank matrix decomposition.

[0099] An embodiment of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned on-chip training method for memristor storage and computing based on low-rank matrix decomposition.

[0100] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0101] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "N" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0102] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.

[0103] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways as necessary and then storing it in a computer memory.

[0104] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. If implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0105] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0106] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0107] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A memristor storage-computation integrated on-chip training method based on matrix low-rank decomposition, characterized in that: The following steps are involved: Substitute the target training network model into the preset non-ideal factor model for offline training to obtain a pre-trained model that is tolerant to the actual non-ideal factors of the target storage-computing integrated chip; Performing low-rank decomposition on the pre-trained model using a matrix low-rank decomposition network to obtain a main intervention training network and a bypass network; The main intervention training network is deployed in the memristor array of the target storage-computing integrated chip, and the bypass network is deployed in the digital unit of the target storage-computing integrated chip to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array.

2. The on-chip training method for memristor storage and computing based on matrix low-rank decomposition according to claim 1 is characterized in that: Also includes: Before offline training, the target training network model is quantized and noised, so that the quantized and noised target training network model is substituted into the preset non-ideal factor model for offline training.

3. The on-chip training method for memristor storage and computing based on matrix low-rank decomposition according to claim 1 is characterized in that: The method of using a matrix low-rank decomposition network to perform low-rank decomposition on the pre-trained model to obtain a main intervention training network and a bypass network includes: Obtaining a main network layer of the pre-trained model, and using the main network layer as the main intervention training network; The main network layer is subjected to low-rank decomposition using a matrix low-rank decomposition network to obtain a plurality of two-layer small networks, so as to use the plurality of two-layer small networks as the bypass network.

4. The on-chip training method for memristor storage and computing based on matrix low-rank decomposition according to claim 3 is characterized in that: Each two-layer small network is a two-layer fully connected layer network or a two-layer convolutional layer network.

5. The on-chip training method for memristor storage and computing based on matrix low-rank decomposition according to claim 1 is characterized in that: The main intervention training network is deployed in the memristor array of the target storage-computing integrated chip, and the bypass network is deployed in the digital unit of the target storage-computing integrated chip to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array, including: Deploy the main intervention training network to the memristor array of the target storage-computation integrated chip to perform forward reasoning to obtain a first output; Deploying the bypass network into the digital unit of the target storage-computation integrated chip to perform forward reasoning to obtain a second output; Compare the first output and the second output with a preset theoretical value, and obtain a residual according to the comparison result; The gradient of the bypass network is reversely updated using the residual to obtain the trained memristor array.

6. A memristor storage and computing integrated on-chip training device based on matrix low-rank decomposition, characterized in that: include: An offline training module is used to substitute the target training network model into a preset non-ideal factor model for offline training, so as to obtain a pre-trained model that has tolerance for the actual non-ideal factors of the target storage-computing integrated chip; A low-rank decomposition module, used for performing low-rank decomposition on the pre-trained model using a matrix low-rank decomposition network to obtain a main intervention training network and a bypass network; An on-chip training module is used to deploy the main intervention training network into the memristor array of the target integrated storage and computing chip, and to deploy the bypass network into the digital unit of the target integrated storage and computing chip, so as to perform on-chip training on the memristor array and the digital unit to obtain a trained memristor array.

7. The memristor storage-computation integrated on-chip training device based on matrix low-rank decomposition according to claim 6 is characterized in that: The on-chip training module includes a digital matrix multiplication calculation unit, a first analog storage and calculation integrated calculation subunit, a second analog storage and calculation integrated calculation subunit and a special function calculation unit, wherein: A simulation storage-computation integrated computing unit is used to deploy the main intervention training network into the memristor array of the target storage-computation integrated chip to perform forward reasoning and obtain a first output; A first digital matrix multiplication calculation unit, used for deploying the bypass network into a digital unit of the target storage-computing integrated chip for forward reasoning to obtain a second output; A special function calculation unit, used for comparing the first output and the second output with a preset theoretical value to obtain a residual; The second digital matrix multiplication calculation unit is used to use the residual to reversely update the gradient of the bypass network to obtain a trained memristor array.

8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the on-chip training method for memristor storage and computing based on matrix low-rank decomposition as described in any one of claims 1 to 5.

9. A computer program product, characterized in that When the computer program / instruction is executed by a processor, the on-chip training method for memristor storage and computing based on matrix low-rank decomposition as described in any one of claims 1 to 5 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the on-chip training method for memristor storage and computing based on matrix low-rank decomposition as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Safety flow analysis system based on brain-like calculation

    CN113225359A

  • Storage and calculation integrated chip and method based on neural network weight matrix scaling control

    CN114723027A

  • Method and device for mapping neural network weight to memristor storage and calculation integrated chip

    CN118095378A

  • Data storage system, electronic device and storage medium

    CN118210446A

  • Neural network and its information processing method, information processing system

    US20210049448A1