Contrastive local learning in large nonlinear analog circuits
Authors: Pragyan Pandey, Peter Wu, Deema Alyahya, Eric Y. Ma
Organizations: Department of Physics, University of California, Berkeley, California 94720, USA · Department of Electrical Engineering and Computer Sciences, University of California, Berkeley, California 94720, USA · Lawrence Berkeley National Laboratory, Berkeley, California 94720, USA
Machine learning in physical hardware promises to reduce training cost by colocating computation, memory and adaptation within device physics. Contrastive local learning networks (CLLNs) offer a compelling route: an electrical circuit relaxes to equilibrium in free and weakly clamped states, and each adaptive element updates from local voltage contrasts rather than backpropagated error signals. Yet whether nonlinear transistor implementations can scale beyond proof-of-concept circuits, and what design principles control that scaling, have remained unknown. Here we show that nonlinear analog circuits trained by contrastive local rules can learn larger machine-learning tasks and remain robust under hardware nonidealities. Using device-level circuit simulations, we systematically explore initialization, operating regime, loss-dependent clamping and training parameters, and scale CLLNs beyond ten thousand adaptive edges. The same local rule trains classifiers that reach the accuracy regime of conventional digital methods on Ionosphere and handwritten-digit benchmarks, and a network that autoregressively generates language over a 122-token vocabulary. These results establish the feasibility of local learning in large nonlinear analog circuits.
Figures & tables
Figure 1: Contrastive local learning in adaptive electrical networks. a , Free phase: the input voltages VI are imposed and the free output voltages VOF are measured. Orange squares, grey hexagons and green circles denote input, hidden and output nodes. b , Clamped phase: the same inputs are imposed while the outputs are nudged towards their targets, giving the clamped voltages VOC . c , Adaptive edges in linear and nonlinear contrastive local learning networks (CLLNs): a trainable resistance implements a linear edge; the trainable gate voltage VG of an nMOS transistor implements a nonlinear edge. Curves show current–voltage characteristics at the indicated parameter values. d , Example nonlinear CLLN with an nMOS transistor at every edge and VG as the trainable parameter. e , Simulation workflow: after the edge model and network are defined and initialized, free- and clamped-state solves and local updates repeat until convergence.
Figure 2: Ionosphere classification with a transistor CLLN. a , Each radar return is processed with an autocorrelation function at 17 pulse lags; the real and imaginary parts of the resulting 17 complex values give 34 input voltages. A 147-nMOS CLLN classifies each return as ionospheric structure (P) or no structure (N). Bars compare the final transistor-CLLN test accuracy and precision with published values for the indicated classifiers [ 37 ] . b,c , Gate-voltage states at initialization ( b ) and after training ( c ). Squares, hexagons and circles denote input, hidden and output nodes; edge colour encodes VG . d,e , Corresponding VG distributions on the same colour scale. f , Training and test accuracy (top) and hinge loss (bottom) versus training step. g,h , Test samples and interpolated decision boundaries in a two-dimensional principal-component projection at initialization ( g ) and after training ( h ).
Figure 3: Handwritten-digit classification with a transistor CLLN. a , An 8×8 -pixel image from the handwritten Digits dataset is converted to 64 input voltages and applied to a 1,247-nMOS CLLN with an output-node pair, Oc+ and Oc− , per class c=0,…,9 . Edges connected to the class-3 pair are coloured by gate voltage VG ; all other edges are grey. The bar above each pair shows its free-phase voltage difference, which is largest for class 3 for the input digit 3 shown, giving the correct prediction. b,c , Gate-voltage states at initialization ( b ) and after training ( c ); edge colour encodes VG . d,e , Corresponding VG distributions on the same colour scale. f,g , Row-normalized test-set confusion matrices at initialization ( f ) and after training ( g ). h , Training and test accuracy (top) and hinge loss (bottom) versus training step. i , Input-weighted mean signed sensitivity of each differential readout to each input pixel over the test set: for output c and pixel p , Sc,p=Etest[xp∂Dc/∂xp] , with xp the input voltage at pixel p . j , Representative misclassified test digits with true class y , predicted class c^ and output-margin error Δ=Dc^−Dy .
Figure 4: Autoregressive language generation with a transistor CLLN. a , A seven-token context window, encoded at 16 channels per token into 112 input voltages, connects through a 13,664-nMOS CLLN to 122 output nodes whose voltages define next-token logits over the 122-token vocabulary; edge colour encodes the trained VG . A token sampled from the resulting distribution is appended to the context for autoregressive generation. b , Example training sentences from the scientific-language corpus. c , Example grammar-valid generated sentences absent from the training corpus. d , Training and test QMass, the mean probability mass assigned to grammar-valid next tokens, versus training epoch. e , Training and test next-token cross-entropy versus training epoch. f , Validity (fraction of grammar-valid sentences), novelty (fraction absent from the training corpus) and uniqueness (fraction of distinct sentences) of generated sentences versus readout temperature Tread . Each point is the mean of five batches of 1,000 sentences. Solid and dashed lines mark Tread=0.6 mV and the training temperature T=2.5 mV.
Figure 5: Robustness and design sweeps for transistor CLLNs. a , Digits test accuracy and hinge loss versus the standard deviation σ of Gaussian voltage-read noise applied to every measurement during training and evaluation; each point is the mean ± s.d. of five independently trained networks. b , Test accuracy and hinge loss of the trained clean network under device mismatch at inference, each point the mean ± s.d. of five independent mismatch realizations. Threshold-voltage and strength variations scale together; the dashed line marks the ALD1106-based reference ( σVth=10mV , σβ/β=0.5% ). c , Test accuracy on Ionosphere and Digits for mean-squared-error (MSE), cross-entropy (CE) and hinge objectives. d , Digits test accuracy across nMOS operating modes (body connection × gate-voltage reference); two example modes are shown below. e , Digits test accuracy versus the mean μ and half-width h of the initial gate-voltage distribution VG∼U(μ−h,μ+h) . f , Digits test accuracy versus learning rate γ and clamp amplitude δ . Panels a and c–f report the final test accuracy at the end of each run, using the fixed budgets specified in Methods; panel b evaluates the final trained network of the main clean run (Methods).
Supplementary Figure 1: Computational acceleration from persistent circuit simulation. Wall-clock time per training-sample update versus the number of adaptive edges for the persistent-instance PyCLLN workflow and a naive workflow that constructs a new netlist and launches a fresh ngspice process for every solve; both use the KLU solver. Benchmarks use XOR-style N×N grid networks with 2N2 adaptive edges ( N=3 – 100 ); each point is the mean per-sample update time over 50 epochs of the four-sample XOR truth table, measured on the workstation described in Methods (logarithmic axes).
Supplementary Figure 2: Validation on canonical nonlinear CLLN benchmarks. a , Mean-squared error (MSE) during 10,000 epochs of XOR training. b , Corresponding XOR classification accuracy. c , MSE during 25,000 epochs of nonlinear-regression training. d , Regression output versus input voltage at the indicated epochs; open circles mark the target mapping. Both tasks use the canonical 4×4 periodic circuit of 16 nodes and 32 adaptive nMOS edges.
Supplementary Figure 3: Ionosphere training under device mismatch and voltage-read noise. a–c , Training and test accuracy (top) and hinge loss (bottom) for three independent noisy realizations. Each network combines independently sampled static mismatch ( σVth=10mV , σβ/β=0.5% ) with Gaussian read noise ( σread=4.0mV ) on every voltage measurement during training and evaluation, over a fixed 50-epoch budget. The reported accuracy is the final network state at the end of the budget; at that state the three realizations reached 95.8%, 95.8% and 94.4% (68/71, 68/71 and 67/71).
Supplementary Figure 4: Unweighted input sensitivities of the trained Digits CLLN. For each digit-class output and input pixel, the map shows the test-set mean derivative of the differential class score (positive-rail minus negative-rail voltage) with respect to the input-pixel voltage, arranged in the 8×8 input-pixel layout. Positive values (purple) indicate that increasing the input voltage raises the class score; negative values (green) indicate that it lowers the score. Unlike the input-weighted sensitivities in Fig. 3 i, these values are not multiplied by the input voltage. Signed sensitivities arise from the differential rail pairs: each individual rail responds monotonically to the inputs because all transistor conductances are positive.
Supplementary Figure 5: Digits training under device mismatch and voltage-read noise. a–c , Training and test accuracy (top) and hinge loss (bottom) for three independent noisy realizations. Each network combines independently sampled static mismatch ( σVth=10mV , σβ/β=0.5% ) with Gaussian read noise ( σread=5mV ) on every voltage measurement during training and evaluation, over a fixed 30-epoch budget. At the end of the budget each of the three realizations reached a test accuracy of 96.9%.
Supplementary Figure 6: Language-model training under device mismatch and voltage-read noise. a–c , Training and test QMass (top; the probability mass assigned to grammar-valid next tokens) and cross-entropy loss (bottom) for three independent noisy realizations. Each network combines independently sampled static mismatch ( σVth=10mV , σβ/β=0.5% ) with Gaussian read noise ( σread=2.25mV ) on every voltage measurement during training, evaluation and generation. The trajectories are nearly indistinguishable (final test QMass 0.6847, 0.6847 and 0.6846), although the trained gate states differ between realizations; the final epoch-12 state of each realization was used for generation. d–f , Validity, novelty and uniqueness of generated sentences versus readout temperature Tread for the corresponding realizations; each point is the mean of five batches of 1,000 sentences. Solid and dashed lines mark Tread=0.6 mV and the training temperature T=2.5 mV. At Tread=0.6 mV, validity was 99.86%, 99.7% and 99.82% (mean 99.79%).
Physical learning methods train physical networks to perform computational tasks using only local update rules, exploiting the physics of the system to handle the global transfer of information. We provide the first local convergence analysis of three such methods -- Equilibrium Propagation (EP), Coupled Learning (CL), and a new method we call Adjoint Coupled Learning (AL) -- for linear circuits, in the limit of small-nudging for both discrete and continuous time. EP and AL perform gradient descent on a natural loss function, while CL follows modified dynamics with an additional cubic correction. Assuming the existence of a solution, we identify a coercivity condition, expressed as a rank condition on a matrix built from the network's incidence structure, under which the training loss decays exponentially and the parameters converge to the solution manifold. We show that coercivity can fail by exhibiting a kite circuit in which a symmetry causes the coercivity constant to degenerate on the solution manifold, but prove using Sard's theorem that such degeneracies are non-generic: coercivity holds at every point of the solution manifold for almost every choice of desired output.
Joshua A. McGinnis, Xinbo Li, Yoichiro Mori
Department of Mathematics, University of Pennsylvania, Philadelphia.
Analog hardware platforms offer the potential to reduce energy consumption over digital architectures, but in order to succeed, large-scale analog systems must also be able to operate with or recover from the variability of their components. Towards this goal, we derive and demonstrate the lock-in equilibrium propagation (LIEP) training method. LIEP provides local gradient information for each component in an oscillatory network without separate forward and backward sweeps, potentially allowing for in-situ learning capabilities on analog oscillatory hardware platforms. We demonstrate that LIEP can be used both for ab-initio training as well as recovering performance when pre-trained parameters are perturbed. We show that LIEP can be formulated as a three-factor update rule, and suggest that although the method is currently only validated on shallow networks, alternate architectures may allow it to extend to deep and large-scale networks addressing complex tasks.
Sowjanya Tammali, Wilkie Olin-Ammentorp
Computer Science, Missouri University of Science and Technology, 500 West 15th Street, Rolla, 65409, MO, USA. · Mathematics & Computer Science Division, Argonne National Laboratory, 9700 S. Cass Avenue, Lemont, 60439, IL, USA.
Digital circuits representation learning has made remarkable progress in the electronic design automation domain, effectively supporting critical tasks such as testability analysis and logic reasoning. However, representation learning for analog circuits remains challenging due to their continuous electrical characteristics compared to the discrete states of digital circuits. This paper presents a direct current (DC) electrically equivalent-oriented analog representation learning framework, named KCLNet. It comprises an asynchronous graph neural network structure with electrically-simulated message passing and a representation learning method inspired by Kirchhoff's Current Law (KCL). This method maintains the orderliness of the circuit embedding space by enforcing the equality of the sum of outgoing and incoming current embeddings at each depth, which significantly enhances the generalization ability of circuit embeddings. KCLNet offers a novel and effective solution for analog circuit representation learning with electrical constraints preserved. Experimental results demonstrate that our method achieves significant performance in a variety of downstream tasks, e.g., analog circuit classification, subcircuit detection, and circuit edit distance prediction.
Peng Xu, Yapeng Li, Tinghuan Chen +2
Department of Computer Science & Engineering, The Chinese University of Hong Kong · School of Science and Engineering, The Chinese University of Hong Kong (Shenzhen)