Simulating neural networks
By employing a simulated neural network on analog hardware and utilizing the relationship between voltage and current for calculations, combined with in-situ learning methods, the problems of computationally intensive and difficult training of neural networks are solved, achieving efficient and low-power neural network training and prediction.
Patent Information
- Application Number
- CN202380088987.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-12-29
- Filing Date
- 2023-11-08
- Publication Date
- 2025-08-01
AI Technical Summary
Existing neural networks are computationally intensive and time-consuming, and training on analog hardware is difficult, making it hard to effectively utilize the backpropagation algorithm for credit allocation and training.
By employing an analog neural network, the voltage and current relationship is implemented in hardware, and calculations are performed using analog circuit components. Combined with in-situ learning methods, the neural network is trained directly on the analog hardware, avoiding backpropagation. Error elements and measurement elements are used for signal measurement and updating.
It improves the speed and efficiency of neural network training, reduces power requirements, achieves stability and accuracy on analog hardware, and significantly enhances computational efficiency and energy efficiency.
Smart Images

Figure CN120418809A_ABST
Abstract
Description
[0001] The present disclosure relates to hardware neural networks, which are neural networks implemented using electronic circuits. BACKGROUND OF THE INVENTION
[0002] Currently, neural networks are widely used in many fields, including but not limited to: autonomous vehicles, robots, medical image analysis, object recognition, face recognition, manufacturing plant control, telecommunications network security, etc. Generally, during the training of neural networks and / or during the operation of neural networks to compute predictions, neural network computations are resource-intensive and time-consuming.
[0003] To accelerate neural network computations and improve their efficiency, computing hardware such as graphics processing units and multi-tile processing units can be used.
[0004] The examples described herein are not limited to examples that solve the problems mentioned in this background section. SUMMARY OF THE INVENTION
[0005] Preferred aspects and examples of the invention are set forth in the appended independent and dependent claims.
[0006] This summary is intended to introduce some concepts that will be further described in the detailed description below. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
[0007] A first aspect of the disclosed technology is an analog neural network, the analog neural network comprising:
[0008] a plurality of layers interconnected to form an electrical circuit having an input end and an output end, the input end being adapted to receive an electrical signal corresponding to an input example, and the output end corresponding to the output of the neural network;
[0009] each layer comprising interconnected elements, wherein the elements comprise:
[0010] at least one programmable electronic element representing a weight of the neural network;
[0011] at least one non-linear element;
[0012] at least one amplifier module;
[0013] an error element;
[0014] and wherein each layer further comprises: a first measurement element for measuring an electrical signal V of the error element; and
[0015] A second measurement element for measuring the weighted input U of the programmable electronic element.
[0016] By interconnecting the elements and using amplifier modules and measurement elements, the analog neural network enables predictive coding, thereby performing credit assignment without using backpropagation. Predictive coding is a neural network computation for training a neural network, where the error signal exists throughout the neural network due to the neural network being in an electrical steady state, rather than being passed between the layers of the neural network by using backpropagation. Credit assignment is the problem of determining how changes in the neural network weights will affect the output of the neural network.
[0017] Preferably, the analog neural network includes:
[0018] A first clamping circuit for clamping the input terminal to the electrical signal corresponding to the input example;
[0019] A second clamping circuit for clamping the output terminal to an electrical value; and
[0020] A measurement and update element having the following functions: receiving inputs from the first measurement element and the second measurement element in response to the first clamping circuit and the second clamping circuit being activated and the electrical circuit being in a steady state; and updating the programmable electronic element using the inputs from the first measurement element and the second measurement element.
[0021] By using the measurement and update element, signals can be obtained from the measurement element at an appropriate time to enable predictive coding and efficient credit assignment. The signals are obtained in an extremely efficient manner, so the training speed of the resulting analog neural network may be faster than that of the corresponding neural network implemented using a graphics processing unit (GPU).
[0022] The inventors have noticed that the stability of a simulated neural network trained in this way on simulated hardware is superior to that of a software neural network trained in the digital space (e.g., on a central processing unit (CPU) or GPU) and then transferred to simulated hardware. The inventors have also recognized that it remains extremely difficult to implement the latter at any reasonable scale. Given the very high efficiency of simulated neural network hardware, there are significant advantages to building a stable network on it (through in-situ learning). Preferably, the electrical value represents the ground truth label of the input example, and the input example is a training example. Preferably, the electrical value is the ground truth label of the input value, rather than a small nudge from the current predicted value towards the ground truth label value as in an alternative approach. Thus, the magnitude of the second clamping circuit is relatively large and not just a small perturbation to the target electrical value. By using a relatively large second clamping circuit instead of a small perturbation, the measurement signal is greater than the electrical noise inherently present in many instances of the simulated hardware, enabling accurate machine learning.
[0023] Preferably, the measurement and update element is arranged to update the programmable electronic element using at least the input V from the first measurement element and the input U from the second measurement element, so as to train the neural network. In this way, the simulated neural network is trained extremely efficiently.
[0024] Preferably, the error element comprises any one or more of the following: a capacitor, a resistor. In this way, the signal measured on the error element (such as voltage or current) is related to the effect of the entire electrical circuit on the error element. By using a capacitor, the value associated with the measured signal is locally stored in the error element. Since the error element is physically located in each layer, the signal measured (and possibly stored) in the error element is immediately available in the corresponding layer and does not have to be calculated and propagated using backpropagation.
[0025] Preferably, the measurement and update element includes an analog combiner. An analog combiner is an analog element that takes two analog signals as inputs and produces an analog output signal that combines the two signals. In one example, the analog combiner produces an output signal that is related to a function of the two analog signals. A non-exhaustive list of examples of suitable functions is: addition, multiplication, weighted multiplication, or any other aggregation function. Using an analog combiner is an efficient and effective way to implement the measurement and update element in analog form. Since the conversion between analog and digital signals is avoided, the ability to perform measurements and updates in the analog domain can improve efficiency and accuracy. Using an analog process consistently in this way is extremely efficient. Since the analog-to-digital conversion and digital-to-analog conversion are reduced, the noise is reduced. By applying updates using an analog process, the variability of the device can be taken into account because the analog circuit itself performs the calculations. Implementing a fully end-to-end analog neural network using the programmable electronic element can provide a significant improvement (i.e., an order-of-magnitude gain in energy and / or speed) for these types of hardware neural networks compared to software neural networks deployed using GPUs. Preferably, the analog combiner produces one or more voltage pulses input to the programmable electronic element, thereby providing an efficient way to update the programmable electronic element.
[0026] Preferably, the measurement and update element is digital and uses a memory to store the calculated updates to be applied to the neurons of the analog neural network. Using a memory enables the updates to be applied after measuring U and V so as not to affect the measurements of U and V.
[0027] Preferably, the programmable electronic element, the non-linear element, the amplifier module, and the error element are connected in series in any order. Since any order is available, the topology can be customized to accommodate manufacturing or space constraints.
[0028] Preferably, the measurement and update element is configured to update the programmable electronic element only after measuring U and V of the neurons of the analog neural network to be updated. Doing so enables the measurements of U and V to be independent of the update.
[0029] Preferably, the plurality of programmable electronic elements includes a cross-bar array of electronic elements, which can be implemented as programmable resistive elements such as memristors or another form of programmable resistive element. Using such a cross-bar array can provide an efficient and accurate compact form factor. Using a cross-bar array of such resistive elements directly replicates the mathematical operation of matrix-vector multiplication, which is a core operation in deep learning.
[0030] In another aspect of the present technology, there is a data center that includes at least one analog neural network as described in any of the examples above and herein. However, the present technology is not limited to use in a data center. In some cases, the analog neural networks described herein are used in Internet of Things devices and other edge computing devices.
[0031] In another aspect of the present technology, there is a method for training an analog neural network according to any of the examples herein, the method comprising:
[0032] clamping the electrical signal at the input terminal to an electrical signal representing the training example;
[0033] further clamping the output terminal to the electrical value representing the label of the training example, and
[0034] measuring electrical signals V and U in response to the electrical circuit being in a steady state; and using V and U to update the programmable electronic component.
[0035] This is an extremely efficient training method because no backpropagation is involved due to the use of the error component.
[0036] Preferably, using the measurement to update the programmable electronic component includes: applying the measurement to the programmable electronic component in analog form. In this way, the use of an analog process is always extremely efficient. Noise is reduced due to the reduction of analog-to-digital conversion and digital-to-analog conversion.
[0037] Preferably, the training method includes: in response to clamping the electrical signal at the input terminal to an electrical signal representing the training example while the output terminal is not clamped,
[0038] using the first measurement element to measure the electrical signal Error_f; and
[0039] using V and U and Error_f to update the programmable electronic component.
[0040] Practice has shown that this learning rule is very effective in training analog neural networks and involves seeking to keep the error the same as the error in the forward pass of the neural network, rather than seeking to reduce the error to zero.
[0041] In another aspect, there is a method for operating an analog neural network according to any of the preceding examples to compute a prediction, the method comprising:
[0042] clamping the electrical signal at the input terminal to an electrical signal corresponding to the input example; and
[0043] Output an analog signal at the output terminal in response to the electrical circuit being in a steady state. In some cases, the analog signal at the output terminal is converted to digital form.
[0044] The method makes predictions through end-to-end full simulation of the network (no digital calculations occur, and no digital-to-analog or analog-to-digital conversions occur between the layers of the analog neural network). The end-to-end simulation method provides a very efficient and low-power method for calculating the predictions of the neural network.
[0045] On the other hand, there is a method performed by an analog neural network, the method comprising:
[0046] Receive an electrical signal corresponding to an input example at an input terminal of an electrical circuit including a plurality of layers;
[0047] Within each layer, process the electrical signal by passing the electrical signal through a plurality of interconnected elements, where the elements include:
[0048] At least one programmable electronic element, the at least one programmable electronic element representing a weight of the neural network;
[0049] At least one non-linear element;
[0050] At least one amplifier module;
[0051] Error element;
[0052] First measurement element;
[0053] Second measurement element; and
[0054] where the method includes:
[0055] Use a first clamping circuit to clamp the electrical signal at the input terminal to the electrical signal corresponding to the input example;
[0056] Use a second clamping circuit to clamp the output terminal of the electrical circuit to an electrical value representing the ground truth label of the input example; and
[0057] In response to the first clamping circuit and the second clamping circuit being in an active state and the analog neural network being in a balanced state, use the first measurement element to obtain the electrical signal V of the error element, and use the second measurement element to obtain the weight input U of the programmable electronic element.
[0058] The method is an efficient method for implementing a predictive coding process. Predictive coding is a successful model for information processing in the cerebral cortex. The basic principle of predictive coding is that each neural network layer attempts to predict the activity of the next neural network layer. Define the error between the prediction of the activity of the next neural network layer and the current actual activity of the next neural network layer. Predictive coding assumes that learning (i.e., neural network training) occurs through the dynamic change of two quantities. The first dynamic change is that the neuron activity reduces the energy of half of the square of the error. The second dynamic change is that the weights of the neurons reduce the energy of half of the square of the error. In this way, if the energy of the error is reduced to zero, the neuron activity and the neuron weights remain unchanged and are considered to be at rest, such that the model makes a satisfactory prediction. When an error is introduced at a specific layer (such as the output layer), the neuron activity changes throughout the network, thereby spreading or distributing the error throughout the network. Therefore, the weights also change to reduce the error of the entire neural network.
[0059] Preferably, the method includes:
[0060] Using U and V to update the programmable electronic component using analog updates.
[0061] In this way, in-situ training of the analog neural network can be efficiently and accurately implemented.
[0062] Preferably, in response to clamping the electrical signal at the input terminal to an electrical signal representing the training example while the output terminal is not clamped, using the first measuring element to measure the electrical signal Error_f; and using V and U and Error_f to update the programmable electronic component. In this way, a learning rule can be implemented that attempts to keep the error observed during the forward pass constant (i.e., the learning rule attempts to keep V close to Error_f rather than attempting to reduce V to zero). This type of learning rule performs well in practical applications.
[0063] Preferably, using V and U and Error_f to update the programmable electronic component includes: updating the programmable electronic component through a weight change that is approximately equal to the negative difference between the error V observed when the analog neural network is in equilibrium with both the first clamping circuit and the second clamping circuit in place and the error Error_f observed when the analog neural network is in equilibrium with only the first clamping circuit in place, multiplied by the weight input U.
[0064] It will also be obvious to any person of ordinary skill in the art that, in the context of one aspect of the disclosed technology, some of the preferred features noted above may replace one or more of the preferred features of other preferred aspects of the disclosed technology. For the sake of brevity, such obvious combinations have not been explicitly listed in each such possible additional aspect above.
[0065] Other examples will become apparent from the following detailed description, which illustrates, by way of example, the principles of the disclosed technology in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 is a schematic diagram of a computing node with an analog neural network deployed at a data center or other computing entity;
[0067] Figure 2 is a schematic diagram of an analog neural network with multiple layers, showing a breakdown diagram of one of these layers;
[0068] Figure 3 is a circuit diagram of an analog neural network with two layers;
[0069] Figure 3A shows a part of a circuit for implementing a learning rule that seeks to keep the error constant;
[0070] Figure 4 is a circuit diagram of an example of a layer of an analog neural network;
[0071] Figure 5 is a circuit diagram of an analog neural network with two layers, suitable for training the analog neural network;
[0072] Figure 6 is a circuit diagram of an analog neural network with two layers and suitable for computing predictions;
[0073] Figure 7 is a circuit diagram of multiple programmable electronic components in a layer of an analog neural network;
[0074] Figure 8 is a circuit diagram of other multiple programmable electronic components in a layer of an analog neural network, showing a crossbar switch array;
[0075] Figure 9 is a flowchart of a method for training an analog neural network;
[0076] Figure 10 is a flowchart of a method for using an analog neural network to compute inferences;
[0077] Figure 11Schematic diagram of a host computing device hosting an analog neural network.
[0078] The accompanying drawings illustrate various examples. Those skilled in the art should understand that the element boundaries shown in the accompanying drawings (e.g., boxes, groups of boxes, or other shapes) represent one example of such boundaries. In some examples, one element may be designed as multiple elements, or multiple elements may be designed as one element. Where appropriate, all of the accompanying drawings use common reference numerals to denote similar features. Detailed Description
[0079] The following description is intended to illustrate the general principles of the technology and is not intended to limit the inventive concepts claimed herein. It will be apparent to any ordinary person skilled in the art that one or more or all of the specific features described herein in the context of one embodiment also exist in some other embodiments and / or can be used in combination with other described features in various possible combinations and permutations in some other embodiments.
[0080] Neural networks are typically deployed in software on a GPU or CPU. In some cases, dedicated neural network accelerators such as multi-tile processors, field-programmable gate arrays (FPGAs), or custom application-specific integrated circuits (ASICs) can be used. However, there is still a need to improve efficiency and reduce the power requirements of neural network computations without sacrificing accuracy.
[0081] The inventors have recognized that the bottleneck in neural network processing is the credit assignment problem, whereby it must be determined how a hypothesized change in the neural network weight values will affect the final output of the neural network. In neural network computations, the error backpropagation algorithm is used to perform credit assignment, which explicitly calculates the derivative of the output of the neural network with respect to each parameter (neural network weight).
[0082] The inventors have recognized that by implementing the neural network as an analog neural network in hardware, efficiency can be significantly improved and power requirements can be reduced without sacrificing accuracy. This is achieved by using analog hardware with voltage and current relationships (such as Ohm's law and Kirchhoff's current law) to compute the same or similar mathematical functions as a software neural network, but using analog circuit components instead of a digital computer. There is sound theoretical basis to suggest that using such analog neural networks can accelerate by several orders of magnitude compared to existing software neural networks (deployed on a GPU or multi-tile processor).
[0083] However, training an analog neural network is not as straightforward as traditional software-based methods. The inventors have recognized that the variability of the hardware makes backpropagation extremely difficult and also makes it very challenging to transfer a neural network that has been trained in software form to an analog neural network architecture. Therefore, the inventors have developed a method for in-situ learning by integrating the hardware with a novel learning algorithm.
[0084] Training an analog circuit in the same way as a neural network in software is challenging. This is because (among other factors) analog circuits introduce significant device variability during the manufacturing process, which is not modeled by software neural networks. This variability is caused by defects during the manufacturing process (such as in etching or cleaning) and results in differences between components within a wafer and differences between wafers. While many of these errors are random, some are systematic and thus cannot "cancel each other out". Attempting to use a hardware-aware model to train a neural network in software to simulate the variability does not scale well because it is impossible to exhaustively characterize the defects present in any given analog circuit capable of running neural network computations. Therefore, even such maximum efforts cannot transfer the network to analog hardware without degrading performance. In contrast, "in-situ training" refers to attempting to directly train a neural network on the target analog hardware. However, again, hardware defects can cause the backpropagation to compute incorrect gradients (since the computations involved rely on characterizing the hardware), which typically disrupts the stability of the training or leads to a degradation in performance. To ameliorate such issues, the inventors have developed a method for in-situ training an analog neural network on the hardware itself, which has more favorable characteristics than the backpropagation algorithm.
[0085] Figure 1 is a schematic diagram of a computing node having an analog neural network 106 deployed at a data center 100. In Figure 1 three computing nodes are shown in the data center 100, although in reality there are dozens or hundreds of computing nodes. One or more of the computing nodes in the data center 100 host an analog neural network, such as the analog neural network in the examples described herein. Client devices (such as end-user computing devices or other computing entities that do not have an analog neural network) are able to access the data center and utilize the computing capabilities, including analog neural network capabilities.
[0086] In some examples, such as Figure 1 the client device shown has analog neural network hardware. Thus, Figure 1The analog neural network 106 is shown as an option within a desktop computer 118, a smart phone 116, and a smart watch 120. The client device can use the analog neural network service provided by the data center and / or use its own internal analog neural network resources.
[0087] Figure 2 is a schematic diagram of an analog neural network 220 having multiple layers 200, 201, 202, 204, 206, in which a decomposition diagram of one of these layers 201 is shown. In Figure 2 the example, four neural network layers are shown, although there may actually be more layers, as indicated by the dots in this figure. As Figure 2 schematically shown, these layers are interconnected and together form an electrical circuit.
[0088] The electrical signal input to the input layer 200 (after digital-to-analog conversion if appropriate) is processed by the input layer 200 and enters layer 1, 201, is processed by layer 1, 201 and enters layer 2, 200, is processed by layer 2 and enters layer 3, is processed by layer 3, and so on until the electrical signal has been processed by all layers and reaches the output layer, from which the electrical signal is output. The electrical signal is a representation of an example, which is a data item, such as an image, a video frame, a numerical value, a classification value, an embedding vector, or other data item.
[0089] Each layer includes a plurality of nodes (also referred to as neurons), and each node has at least one associated weight. In some cases, each node has multiple input signals, each input signal is weighted, and then combined at that node, as described later in Figure 7 shown. Figure 2 Layer 1201 in is shown in a decomposition diagram to show the electrical components in this layer, including: at least one programmable element 208, at least one amplifier module 210, at least one error element 212, at least one non-linear element 214, and at least one measurement and update element. Each layer of the analog neural network 220 has at least one programmable element 208, at least one amplifier module 210, at least one error element 212, and at least one non-linear element 214; however, the order in which these elements are interconnected may vary between layers. The neural network also has a measurement and update element 216. In some cases, there is a measurement and update element for each neuron. In some cases, there is only one measurement and update element for each layer, such that a single measurement and update element is shared among the neurons in that layer. Other numbers of measurement and update elements 216 are possible depending on the available space and resources.
[0090] The programmable element 208 stores the weights of the nodes of the neural network layer. In one example, the programmable element 208 is a memristor; however, the use of a memristor is not required. A memristor stores information about the amount of electric charge passing through it and belongs to a type of electrical component. The programmable element 208 is bidirectional, that is, it can direct an electrical signal in the forward direction from the input end of the neural network to the output end of the neural network or in the reverse direction towards the input end of the neural network. A non-exhaustive list of examples of the programmable element 208 is memristors, resistor ladders, phase change memories, and certain other non-volatile memories.
[0091] The amplifier module 210 is bidirectional and is any electrical component capable of amplifying an electrical signal that is transmitted away from or towards the input end of the neural network. In some cases, the amplifier module is a single amplifier with a bidirectional response, or a set of at least two unidirectional amplifiers connected to each other in a "cascade" manner such that the head of one amplifier is connected to the tail of another amplifier and vice versa. Having such an amplifier module (where there are two unidirectional amplifiers connected to each other in a "cascade" manner) means that driving one end of the amplifier module will drive the other end. Having a reverse response means that driving the output end of the amplifier will drive its input end.
[0092] The error element is a resistor with digital measurement capabilities and digital storage capabilities, or a capacitor or any other electronic component on which the measurement signal is related to the impact of the entire electrical circuit on the component. The error element is bidirectional because it can direct an electrical signal away from or towards the input end of the neural network. <I
[0093] The non-linear element 214 is a diode or other electronic component capable of implementing the non-linear transfer function of the neural network.
[0094] Figure 2An example of how to construct an analog neural network to mimic a software artificial neural network is shown. The term "input" is used to refer to the electrical signal at the input nodes of the entire artificial neural network. In the case of training, the input represents a training example; in the case where the neural network is used for inference, the input represents a test example. The term "weight input" is used to refer to the electrical signal received at a neuron in a hidden layer of the neural network. Due to the hierarchical structure of the neural network, depending on the specific topology of the neural network, the weight input of the hidden layer includes the output signal from the previous layer of the neural network. Mathematically, each neural network layer implements a matrix multiplication of the weight input of that layer with a set of weights (or parameters), followed by a non-linear transformation. In a circuit, the matrix multiplication can be performed by using a crossbar switch, where each programmable element is a resistive element (e.g., a memristor). Thus, the weight parameters are implemented using programmable elements, which can be implemented as memristors. The non-linear transformation can be applied to any non-linear circuit component, such as a diode. Depending on the neural network topology, the output of one layer is input to the next layer and becomes the weight input of the next layer. To prevent signal attenuation as the signal passes through each layer, a set of amplifier modules amplify the output signal. The output of the last layer is the output of the network and represents the prediction of the network. The input of the network as a whole is provided to the first layer in a cascade of layers that make up the neural network. The analog circuit is configured such that the equilibrium voltage (or current) at the output terminal for a given input signal is related (such as typically proportional) to the result of the forward pass of an equivalent (software) artificial neural network (ANN) for an input signal related in a similar manner (such as typically proportional or otherwise related).
[0095] Figure 3 is a circuit diagram of an analog neural network having two layers 308, 318. By cascading more layers, more than two layers 308, 318 can be had. Figure 3 Each of the layers 308, 318 in shows a single neuron constituted by the four elements (i.e., programmable electronic element 1 connected in series, amplifier module 2, error element 3, and non-linear element 4) described above with reference to Figure 2 Each layer may also have one or more measurement elements 312, 314, as described in more detail below. Although only one neuron is shown for each layer, in fact there are hundreds or more neurons in each layer. For clarity, the reference numerals 1, 2, 3, 4 are omitted in the second layer 318. Figure 3 The analog neural network of has an input terminal 310 and an output terminal 316. Both the input terminal 310 and the output terminal 316 have an associated digital-to-analog converter during training, and the output terminal 316 has an associated analog-to-digital converter during prediction. The input terminal of the neural network can receive an example in digital form (which is converted to analog form) and then input at the input terminal 310. More details regarding the output terminal 316 are shown below.
[0096] In Figure 3 the example of Figure 3 , a single neuron in the first layer 308 is shown connected to a single neuron in the second layer 318. However, in reality, a single neuron from the first layer 308 is connected to each of the multiple neurons in the second layer 318 and, in a fully connected arrangement, to all the neurons in the second layer 318.
[0097] In Figure 3 the example of Figure 3 , the electronic components in each layer are connected in series in the same order, however different orders can be used in different layers.
[0098] In Figure 3 the example of Figure 3 , the programmable electronic component is a memristor represented by a variable resistor and the symbol W, as well as an amplifier module and another resistor that forms a voltage divider such that the voltage input to the diode is not grounded.
[0099] In Figure 3 the example of Figure 3 , the error element 3 is a resistor. In Figure 3 the example of Figure 3 , the non - linear element 4 is a diode. However, as described above, other types of non - linear elements or error elements can be used.
[0100] In Figure 3 the example of Figure 3 , the second layer 318 includes a measurement element 314 that measures the voltage across the error element and optionally performs analog - to - digital conversion (ADC). In some cases, the measurement element measures current instead of voltage. The measurement element reads the measurement result from the error element and sends the measurement result to the measurement and update element 320, which is an analog and / or digital processing circuit.
[0101] In Figure 3 the example of Figure 3 , the second layer 318 includes a second measurement element 312 that measures the electrical signal U (weight input) received from one or more neurons in the first layer 308 and optionally converts the measurement result to digital form using an analog - to - digital converter before sending the measurement result to the measurement and update element 320.
[0102] In some cases, the measurement and update element 320 is purely analog and receives an analog signal V from the first measurement element 314 and an analog signal U from the second measurement element 312. In this case, where the measurement and update element 320 is analog, it includes an analog combiner. The analog combiner receives the analog signals U and V and produces an output signal, which can be a voltage, a current, a voltage pulse, or multiple voltage pulses, and this output signal is input to the programmable electronic element of the neuron and updates the programmable element of the neuron. In one example, the total area (integral) of the voltage pulses produced by the analog combiner is related to the combination of U and -V, such as being proportional to the product of U and -V. By using only analog processing, efficiency and accuracy can be improved because the noise and computational cost of analog-to-digital conversion are avoided. In the case where the measurement and update element 320 is purely analog, the programmable element can be updated in a timely manner, where the update of the programmable element does not significantly affect the measurement results of U and V. That is, even if U and V have not been measured in one neuron of the analog neural network, the programmable element in another neuron can be updated. Alternatively, multiple measurement results (up to for each neuron in the analog neural network) can be stored in some analog form (e.g., as charges in different capacitors) and then used to update each neuron. In this way, the update of each neuron is based on the measurements made before any update is started (for U, V).
[0103] In some cases, the measurement and update element 320 includes an analog combiner that receives the analog signals U and V and produces an output signal that directly programs the programmable electronic element if the programmable electronic element is a device that can be programmed using an analog signal (such as a memristor), or that converts the output signal to a digital signal using an analog-to-digital converter if the programmable electronic element is a device that is programmed using a digital signal (such as a potentiometer). In the case where U is designed to be non-negative, the circuit can be simplified to improve efficiency, such as by omitting the analog combiner and programming the programmable electronic element only using V (either as itself, i.e., an analog signal or converted to a digital signal, depending on how the programmable electronic element is programmed).
[0104] In some examples, the measurement and update element 320 is digital. In this case, the electrical signals U and V are converted to digital form using an analog-to-digital converter before being sent to the measurement and update element. The measurement and update element calculates the update ΔW to be applied to the programmable element of the neuron. The update ΔW is calculated according to the following relationship, where the symbol α represents the learning rate and is a constant that is empirically determined, set by the host computing device hosting the analog neural network, or configured during manufacturing:
[0105] ΔW = -α(U * V)
[0106] In some examples, when the measurement and update element 320 is digital, a memory is used to store the calculated update ΔW to be applied to the neuron. The same operation is performed on other neurons in the neural network to calculate and store the value of ΔW for each neuron to be updated. Then, after measuring U and V of the neurons to be updated in the neural network, the update ΔW is applied. In this way, the measurement results of U and V obtained before the update ΔW to be applied are not affected by the subsequent update ΔW to the programmable element.
[0107] In some cases, the measurement and update element 320 includes an analog multiplexer that receives the analog signals U and V and produces an output signal. Then, after measuring U and V of the neurons to be updated in the neural network, the update ΔW (such as via a pulse programmable element) is applied. In this way, the measurement results of U and V are not affected by the update ΔW to the programmable element.
[0108] In various examples, U and V are used to perform certain calculations to generate a target / change for programming the programmable electronic element. The calculations can be performed in the digital space or the analog space: In the digital space, this means converting U and V to digital signals through analog-to-digital conversion and performing the calculations in the digital space; in the analog space, this means using analog operators (e.g., different operational amplifiers) to implement the same calculations, so no analog-to-digital conversion is required. For example, the change of the programmable electronic element is made proportional to -U*V. If the calculations are performed in the digital space, U and V can be converted to digital signals through analog-to-digital conversion, and then -U*V is calculated in the digital space. If the calculations are performed in the analog space, U and V are connected to an analog multiplexer to produce a combination of U and V in the analog space. After the above calculations of the target / change, for programming into the programmable electronic element, the result of the calculation is used to actually program the programmable electronic element. How the result programs the programmable electronic element depends on the type of the programmable electronic element: Some examples use digital signals for programming (e.g., a digital potentiometer requires a series of digital signals for programming), and some examples use analog signals (e.g., the memristor conductance is programmed using an analog voltage pulse). The result of the calculation is converted into the corresponding signal to program the programmable electronic element. For example, using an analog multiplier to calculate -U*V in the analog space, and the programmable electronic element is a memristor that can be programmed using -U*V generated in the analog space. In this example, training is performed in the analog space with minimal conversion, thus training the neural network extremely quickly.
[0109] In one example, "clamping" of the neural network output is performed by applying an additional voltage source directly to the output unit of the network. This voltage is calculated so as to obtain the equilibrium voltage of the unclamped balance and set it to the desired target voltage. The additional voltage provided at the output changes the equilibrium voltage of the entire network. In fact, the circuit physics causes the voltage to be "distributed" backward through the cascaded analog layers. The inventors realized that the voltage across the error element (V) or the change in voltage across the error element (V-Error_f) caused by clamping at the output is the error signal used for learning. Whenever the error signal needs to be read to update the weights, the voltage change is measured as part of the signal used for learning by using measurement elements 312, 314.
[0110] exist Figure 3 In , when the output terminal 316 is clamped to the electrical signal representing the ground truth label of the training data item used to train the neural network, the neural network is being trained. Figure 3 , input 310 is clamped to an electrical signal representing a training data item, and output 316 is clamped to an electrical signal representing a ground truth label for the training data item.
[0111] In the example where the first measuring element 314 measures the voltage difference V, the weight is represented by W and the error is represented by VU. U is the weight input of the neuron. In the case of the input layer only, U is equal to the input terminal 310.
[0112] The mathematical interpretation of V (i.e. Error) is Error = (U*W) – Target, where, for the last layer, Target is the voltage representing the ground truth label of the neural network training example used to train the simulated neural network. For other layers, Target is the target output of the relevant specific layer so that the last layer can produce the ground truth label. Therefore, the first learning rule is expressed as,
[0113] Loss=0.5*Error 2 =0.5*(U*W-Target) 2
[0114] Change of weight~-d Loss / d W=-Error*U
[0115] Thus, in one example, the measurement and update element increases the weight of the neuron by U times V, and optionally by a learning rate α. Note that U can be positive or negative.
[0116] Figure 3A A portion of a circuit for implementing a second learning rule that seeks to keep the error constant is shown. In some embodiments, by using Figure 3AThe measurement and storage modules 314A and 314B shown replace element 314 and introduce an analog differentiator 326 as shown in Figure 3A to modify the arrangement shown in Figure 3 . The measurement and storage modules 314A and 314B are analog modules. In these embodiments, the analog neural network uses a learning rule that seeks to keep the error constant or "stationary", as explained herein. Figure 3A Each of the measurement and storage modules 314A and 314B shown in Figure 3 shows an error element corresponding to a single error element of the second neural network layer 318 (i.e., each of the measurement and storage modules 314A and 314B can use the same error element of the second neural network layer). Figure 3A The error elements of the measurement and storage modules are connected in series with an amplifier and a non-linear element, although the amplifier and the non-linear element are not shown in Figure 3A . Thus, a single error element can be connected to two different measurement and storage modules 314A and 314B. Each measurement and storage module 314A, 314B records the analog electrical quantity measured on a single error element. One of the measurement and storage modules in 314A records the analog electrical quantity across the error element in the operating state where the output of the neural network is clamped. The other measurement and storage module in 314B records the analog electrical quantity across the error element in the operating state where the output of the neural network is not clamped. The stored values are all provided as inputs to the analog differentiator 326, which outputs a quantity related to the difference between the stored values, such as proportional to the difference between the stored values, as shown in Figure 3A . The measurement and storage modules 314A, 314B are capable of storing analog quantities and can be capacitors in some implementations. The output produced by the analog differentiator is generally equal to the difference between two analog inputs or is generally proportional to the difference between two analog inputs. In another implementation where these inputs are voltage levels, this can be a differential amplifier.
[0117] The inventors designed a second learning rule that is actually very effective and is used in some examples in place of the first learning rule. The first learning rule includes two equations (given above) that seek to change the weights to reduce the error. There can be a learning rule referred to herein as the second learning rule that attempts to keep the error stationary or constant rather than being aimed at reducing the error as explained herein.
[0118] During the forward pass of the training process for training an analog neural network, when the input end of the neural network is clamped but the output end of the neural network is not clamped, there is inevitably current flowing through the error element. Therefore, even during the forward pass of an analog neural network (such as those described herein), the error is not zero. Thus, a second learning rule is used as follows to seek to keep the error constant or "stationary". Representing the error in the forward pass as Error_f, the second learning rule is as follows:
[0119] Change of weight~=-d Loss / d W=-(Error-Error_f)*U
[0120] This is expressed in words as: The programmable electronic element is updated by a change in weight that is approximately equal to the negative difference between the error observed when the analog neural network is in equilibrium with both the first clamping circuit and the second clamping circuit in place and the error observed when the analog neural network is in equilibrium with only the first clamping circuit in place, multiplied by the weight input U.
[0121] The measurement element 314A is used to measure the error Error_f in the forward pass. In the equation above, Error represents the same quantity as V in this document.
[0122] Here, if Error = Error_f, the weights are not updated, i.e., the learning rule attempts to keep the error the same as the error in the forward pass. When implementing this in analog hardware, a component detects the time variation of Error from the forward pass (at the end of the first clamping circuit) to the phase when the second clamping circuit is applied simultaneously with the first clamping circuit. In some examples, as Figure 3A shown, this is done by the analog measurement and storage modules 314A, 314B; in some examples, these components are implemented as a capacitor and a differential amplifier respectively. The analog quantities Error_f and Error are measured and stored in the measurement and storage modules 314A, 314B and subsequently passed as inputs to the analog differentiator 326. In this way, the output of this analog differentiator reflects the time variation of the voltage drop across the error element, i.e., (Error–Error_f). This signal is processed either digitally or in analog form to be multiplied by U and produce the final weight change as defined in the equation above.
[0123] The weight change calculated using the second learning rule is used to update the programmable electronic element. In some examples, this update is performed in the analog domain. In some examples, this update is performed in the digital domain.
[0124] The first learning rule and the second learning rule are combinable. That is, the analog neural network can apply the first learning rule to some training examples and the second learning rule to other training examples of the same training data set.
[0125] Figure 4 is a circuit diagram of an example of layer 400 of the analog neural network. Similar to Figure 2 layer 400 includes programmable element 1, amplifier module 2, non-linear element 4, and error element 3. Figure 4 shows how the order in which the elements are connected in series to form a neuron is different from Figure 3 the order of Figure 4 In
[0126] Figure 5 is a circuit diagram of an analog neural network having two layers and adapted for training the analog neural network. Figure 5 the arrangement of Figure 3 is the same as Figure 6 and its format is similar to Figure 6 for easy comparison with
[0127] Figure 6 is a circuit diagram of an analog neural network having two layers and adapted for computing predictions. Figure 6 the electrical components and neural network architecture of Figure 5 and Figure 3 are the same. However, in Figure 6 the output terminal of neural network 600 is different because it is not clamped to a target value and includes means for reading the electrical signal at that output terminal and optionally an analog-to-digital converter for converting the electrical signal into digital form. The digital signal is then stored or passed to a downstream process, such as an application at a host computing device hosting the analog neural network.
[0128] Figure 7 is a circuit diagram of a plurality of programmable electronic components 700, 702, 704 in a layer of the analog neural network. Three programmable electronic components are shown, although in practice there are dozens or hundreds of such components. These programmable electronic components are each inputs to the same neuron, which has an amplifier module 706, an error element 708, and a non-linear element 710. Figure 7 The advantage of the arrangement of
[0129] Figure 8 is a circuit diagram of two neurons in a layer of an analog neural network. The circuit diagram is shown in a first format in the upper half of Figure 8 and in a second format using a crossbar switch array symbol in the lower half of Figure 8 . As shown in the upper half of Figure 8 , each neuron has two programmable electronic components. Both programmable electronic components W11 and W12 (in the same neuron) receive a weight input U1 from the previous layer of the analog neural network. Both programmable electronic components W21 and W22 receive a weight input U2 from the previous layer of the analog neural network.
[0130] The programmable electronic components W11 and W21 are part of the same neuron, which includes an amplifier module, a non-linear element, an error element, and a measurement element, as shown. The update of the programmable electronic component Wij is calculated as ΔW ij ~ -U i V j .
[0131] The programmable electronic components W12 and W22 are part of the same neuron, which includes an amplifier module, a non-linear element, an error element, and a measurement element, as shown.
[0132] Figure 8 The lower half of Figure 8 shows an equivalent circuit using a crossbar switch array symbol. The two neurons are shown in a crossbar switch array, and each neuron has an amplifier module and a non-linear element, as shown. In the upper half of Figure 8 , each programmable element has a resistor, while in the lower half of
[0133] Figure 9 , these programmable elements are combined into a single resistor for each neuron, as indicated by the dashed arrow. The short dashed lines represent the non-linear element and the amplifier module. Figure 3 310) of the entire neural network. The electrical signal represents the training example and is in the form of a voltage or a current or other electrical signal. Clamp the output terminal ( Figure 3 316) of the neural network to an electrical signal representing the ground truth of the training example; i.e., the label of the training example.
[0134] Electrical signals from the clamped input terminal and the clamped output terminal propagate through the analog neural network layer. The electrical signal from the clamped input terminal propagates forward to the output terminal of the neural network. The electrical signal from the clamped output terminal propagates backward to the input terminal of the neural network. Eventually, the propagated signals reach equilibrium in the analog neural network. When the analog neural network is in the double-clamped state, it is checked whether 904 has reached equilibrium. Wait for a specified time (which may be short) and assume that equilibrium has been reached to complete this check. Alternatively, in some cases, the electrical signals in the analog neural network are repeatedly measured and it is checked whether the measurement results are similar to complete this check.
[0135] Once equilibrium is reached in the double-clamped state, for each layer of the parallel analog neural network, and for each neuron within each layer, a measurement and update process is performed as shown in Figure 9 box 906. It should be noted that it is not necessary to apply all updates in parallel.
[0136] The measurement and update process of box 906 includes: for each neuron, measuring 908 the weighted input U of the neuron. The measurement and update process of box 906 includes: for each neuron, measuring 910 the error element V of the neuron.
[0137] During the transition to the equilibrium state in the double-clamped state, each error element stores information about the amount of change in the electrical signal at that error element. In one example, the error element is a capacitor or resistor that stores charge.
[0138] Obtain the measurement result 910 from the error element, such as by reading the voltage difference across a resistor or the voltage difference across a capacitor. Measure 908 the input weight by reading the voltage as shown at 312 in Figure 3 or in some other way.
[0139] The measurement results from the error elements can be used for measurement and update elements as described in reference Figure 3 The measurement results of the weighted inputs can also be used for measurement and update elements. The measurement and update elements calculate the update and apply it 912 to the programmable electronic element to update the weights of the neural network. Then, the clamping circuits are removed from the input terminal 310 and the output terminal 316.
[0140] The inventors have found that the amount of change in the electrical signal measured from the error element is related to the gradient signal used to train the neural network, where the weight update is related to the magnitude of the difference between the natural equilibrium output and the target output of the neural network under the first (input) clamp. Therefore, the neural network can be trained by updating the weights of the neural network in a way that takes into account the measurement results from the error elements.
[0141] Check 914 is performed to see if convergence has been reached, such as by checking if the updates to the programmable electronic components are below a threshold or if a predetermined number of training examples have been used. If convergence has been reached, training ends 916. Otherwise, the process is repeated for another training example. Figure 9 of the process.
[0142] Since Figure 9 's method directly uses the hardware physical characteristics to perform credit assignment, it will automatically incorporate information about the variability of the devices that make up the circuit. This means that, unlike simple backpropagation updates, the updates calculated by Figure 9 's method perfectly "correct" various types of variability / defects prevalent in analog electronic devices. Therefore, this method enables effective and robust end-to-end training of analog neural networks.
[0143] Figure 10 is a flowchart of a method for using an analog neural network to calculate inferences. In Figure 10 's method, the output of the neural network is not clamped.
[0144] Such as by clamping an electrical signal to the input of the neural network (e.g., Figure 3 's 310), the input electrical signal is applied 1000 to the input of the neural network. This input represents a test-time example (i.e., an example not used during training or validation). As a result of applying the input electrical signal, the signal propagates 1002 from the input of the neural network through the analog neural network layers to the output of the neural network. Check 1004 whether the neural network has reached equilibrium or a steady state. This check can include waiting for a specified time and assuming equilibrium has been reached. In response to reaching equilibrium, the electrical signal at the output of the neural network is read and stored or sent to a downstream process 1006. Optionally, the stored signal is converted from analog form to digital form using an analog-to-digital converter.
[0145] Compared to state-of-the-art GPUs, implementing a neural network end-to-end directly in an analog circuit can achieve a significant acceleration of several orders of magnitude in the inference time (providing an input to the network and calculating its output). This is because the inference time in an end-to-end analog network is determined by the nanosecond-level equilibrium time of the circuit and is performed in analog form according to physical characteristics, rather than being sequentially simulated on a digital computer.
[0146] Figure 11 is a schematic diagram of a host computing device 1100 hosting an analog neural network 1116.
[0147] The host computing device 1100 includes one or more processors 1102, which are microprocessors, controllers, or any other suitable type of processor, for processing computer-executable instructions to control the operation of the device in order to manage a neural network training program and / or manage a service using simulated neural network functionality. Platform software including an operating system 1110 or any other suitable platform software is provided at the host computing device 1100 to enable execution of application software such as a neural network training manager 1112 on the device.
[0148] Computer-executable instructions are provided using any computer-readable medium accessible to the host computing device 1100. Computer-readable media include, for example, computer storage media such as memory 1108 and communication media. Computer storage media such as memory 1108 include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules, etc. Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium for storing information accessible to a computing device. In contrast, communication media embody computer-readable instructions, data structures, program modules, etc. in a modulated data signal such as a carrier wave or other transmission mechanism. As defined herein, computer storage media does not include communication media. Thus, computer storage media should not be construed as propagating signals themselves. Although the computer storage media (memory 1108) is shown as being located within the host computing device 1100, it should be understood that in some examples, storage is remotely distributed or located and accessed via a network or other communication link (e.g., using a communication interface 1104). <(
[0149] The host computing device 1100 further includes an input / output controller 1106, which is arranged to output display information to a display device, which may be separate from or integrated with the host computing device 1100. The display information may provide a graphical user interface to display predictions generated using a simulated neural network. The input / output controller 1106 is also arranged to receive and process input from one or more devices such as user input devices (e.g., a mouse, keyboard, camera, microphone, or other sensors).
[0150] Any reference to "a" item means one or more of these items. As used herein, the term "comprising" means including the identified method blocks or elements, but such blocks or elements do not comprise an exclusive list, the apparatus may include additional blocks or elements, and the method may include additional operations or elements. Additionally, these blocks, elements, and operations do not implicitly constitute a closed limitation by themselves.
[0151] The steps of the methods described herein may be performed in any suitable order, or simultaneously where appropriate. The arrows between the boxes in the figures illustrate an exemplary sequence of method steps, but are not intended to exclude other sequences or the execution of multiple steps in parallel. Additionally, any individual block in any of the methods may be deleted without departing from the spirit and scope of the subject matter described herein. Without losing the sought-after effect, the aspects of any of the above examples may be combined with the aspects of any of the other examples described to form additional examples. Where elements in the figures are shown as connected by arrows, it should be understood that these arrows only illustrate an exemplary flow direction of communication (including data and control messages) between the elements. The flow between elements may be one-way or two-way.
[0152] If the specification has separately and explicitly disclosed some individual features, then any obvious combination of two or more such features is also considered to have been disclosed, in the ordinary knowledge of a person skilled in the art, such features or combinations are obvious and can be implemented based on the specification as a whole, regardless of whether such features or combinations of features can solve any of the problems disclosed herein. In view of the above description, it will be apparent to those skilled in the art that various modifications can be made within the scope of the present invention.
Claims
1. An analog neural network, the analog neural network comprising: A plurality of layers, the plurality of layers being connected to form an electrical circuit having an input end and an output end, the input end being adapted to receive an electrical signal corresponding to an input example, and the output end corresponding to the output of the neural network; Each layer includes elements connected together, wherein the elements include: At least one programmable electronic element, the at least one programmable electronic element representing the weights of the neural network; At least one non-linear element; At least one amplifier module; An error element; And wherein each layer further includes: A first measuring element for measuring the electrical signal V of the error element; and A second measuring element for measuring the weight input U of the programmable electronic element.
2. The analog neural network according to claim 1, the analog neural network comprising: A first clamping circuit for clamping the input end to the electrical signal corresponding to the input example; A second clamping circuit for clamping the output end to an electrical value; And A measuring and updating element having the following functions: in response to the first clamping circuit and the second clamping circuit being in an active state and the electrical circuit being in a steady state, receiving inputs from the first measuring element and the second measuring element; And using the inputs from the first measuring element and the second measuring element to update the programmable electronic element.
3. The analog neural network according to claim 2, wherein the electrical value represents the ground truth label of the input example, and the input example is a training example.
4. The analog neural network according to any one of claims 2 to 3, wherein the measuring and updating element is arranged to update the programmable electronic element at least using the input V from the first measuring element and the input U from the second measuring element, so as to train the neural network.
5. The analog neural network according to any one of the foregoing claims, wherein the error element includes any one or more of the following: a capacitor, a resistor.
6. The analog neural network according to any one of claims 2 to 4 or according to claim 5 which depends on any one of claims 2 to 4, wherein the measuring and updating element includes an analog multiplexer.
7. The analog neural network according to claim 6, wherein the analog multiplexer generates one or more voltage pulses input to the programmable electronic element.
8. The analog neural network according to any one of claims 2 to 7, wherein the measuring and updating element is digital and uses a digital process to calculate the update of the weights.
9. The analog neural network according to claim 8, wherein the measuring and updating element uses a memory to store the calculated update to be applied to the programmable electronic element of the analog neural network.
10. The analog neural network according to any one of the foregoing claims, wherein the programmable electronic element, the non-linear element, the amplifier module and the error element are connected in series in any order.
11. The analog neural network according to any one of claims 2 to 9 or claim 10 which depends on any one of claims 2 to 9, wherein the measurement and update element is configured to update a programmable electronic component in another neuron of the analog neural network before measuring U and V in one neuron of the analog neural network.
12. The analog neural network according to any one of claims 2 to 11, wherein the measurement and update element is configured to update the programmable electronic component only after measuring the U and V to be updated in the neurons of the analog neural network.
13. The analog neural network according to any one of the preceding claims, the analog neural network comprising a plurality of programmable electronic components, the plurality of programmable electronic components constituting a crossbar array.
14. A data center, the data center comprising at least one analog neural network according to any one of the preceding claims.
15. A method for training an analog neural network according to any one of claims 3 to 14, the method comprising: clamping the electrical signal at the input end to an electrical signal representing the training example; further clamping the output end to the electrical value representing the label of the training example, and measuring the electrical signal V and the electrical signal U in response to the electrical circuit being in a steady state; and using V and U to update the programmable electronic component.
16. The method according to claim 15, wherein using the measurement to update the programmable electronic component comprises: Applying the measurement to the programmable electronic component in analog form.
17. The method according to claim 15 or 16, the method further comprising: in response to clamping the electrical signal at the input end to an electrical signal representing the training example while the output end is not clamped, using the first measurement element to measure the electrical signal Error_f; and using V and U and Error_f to update the programmable electronic component.
18. A method for operating an analog neural network according to any one of the preceding claims to compute a prediction, the method comprising: clamping the electrical signal at the input end to an electrical signal corresponding to an input example; and outputting an analog signal at the output end in response to the electrical circuit being in a steady state.
19. A method performed by an analog neural network for training the analog neural network, the method comprising: receiving, at an input end of an electrical circuit including a plurality of layers, an electrical signal corresponding to an input example; within each layer, processing the electrical signal by passing the electrical signal through a plurality of elements connected together, wherein the elements include: at least one programmable electronic component, the at least one programmable electronic component representing a weight of the neural network; at least one non-linear element; at least one amplifier module; an error element; a first measurement element; a second measurement element; and wherein the method comprises: using a first clamping circuit to clamp the electrical signal at the input end to the electrical signal corresponding to the input example; using a second clamping circuit to clamp an output end of the electrical circuit to an electrical value representing a ground truth label of the input example; and In response to the first clamping circuit and the second clamping circuit being in an active state and the analog neural network being in a balanced state, use the first measuring element to obtain the electrical signal V of the error element, and use the second measuring element to obtain the weight input U of the programmable electronic element.
20. The method according to claim 19, the method comprising: Using U and V to update the programmable electronic element using analog update.
21. The method according to claim 20, the method comprising: Using an analog multiplexer.
22. The method according to claim 19, the method comprising: In response to clamping the electrical signal at the input end to be the electrical signal representing the training example while the output end is not clamped, Using the first measuring element to measure the electrical signal Error_f; And Using V, U, and Error_f to update the programmable electronic element.
23. The method according to claim 22, wherein updating the programmable electronic component using V and U and Error_f comprises: Updating the programmable electronic element by a weight change that is approximately equal to the negative difference between the error V observed when the analog neural network is in a balanced state with both the first clamping circuit and the second clamping circuit in place and the error Error_f observed when the analog neural network is in a balanced state with only the first clamping circuit in place, multiplied by the weight input U.