arXiv:2610.12571cs.LGOct 2026

Manuscript Offprint

arXiv:2610.12571

An all-transistor physical-learning transformer can be trained to perform in-context learning

Michael C. Abbott, Benjamin B. Machta

Abstract

Most systems trained by equilibrium propagation or coupled learning are in the same class as multi-layer perceptrons: while they may be universal function approximators, they struggle to learn associative tasks which are easy for transformers. Equilibrium propagation relies on a bidirectional flow of information through the physical system between input and output. The reverse flow is broken by more complex nonlinear systems, such as those performing multiplication which is needed to express dot-product attention. Here we explicitly restore this bidirectional flow by introducing extra circuit elements for this purpose into a double or dyadic circuit. We then use these ideas to construct an attention mechanism exploiting the exponential current law of sub-threshold MOSFET devices. We show that in simulations this circuit can be trained to perform a simple in-context learning task, despite using realistic reverse components which transmit only an approximate gradient. For this training to succeed we need cross-entropy loss (not mean squared error). We generate nudges appropriate for this loss using a novel floating circuit element, based on the same MOSFET sub-circuit used for softmax. We train the resistors in this circuit using the Lion optimiser, which can be implemented using one capacitor per parameter to store local memory of past gradient estimates.

1 Introduction

Physical learning is a machine-learning paradigm in which an analogue physical system performs both the forward computation (say from input to classification) and also the back-propagation of an error signal to allow training. In the simplest equilibrium propagation case [1], an electrical circuit supplied with some input voltages settles to a free steady state, and some of the resulting node voltages are the output. During training, the error signal is current injected into the output nodes, causing the system to find a new nudged steady state. At each resistor, the contrast between free and nudged currents allows us to precisely reconstruct the gradient of the loss function with respect to this one conductance, and hence to adjust the resistor so as to perform gradient descent. This scheme works because the circuit's equilibrium states minimise an energy function, namely the power dissipated, subject to boundary conditions at the input and, during training, at the output. Reducing the difference in energy between these two states performs gradient descent.

This simple setup works for systems of reciprocal interactions, including for instance networks of resistors and diodes. Such networks can easily be constructed to mimic a multi-layer perceptron (MLP) with relu nonlinearities, and thus, like MLPs, they are universal function approximators [2]. However, the ability to represent any function does not imply the ability to learn any task. This is why artificial neural networks moved beyond MLPs and related architectures, and are now dominated by transformer architectures [3]. In a transformer, different parts of the input are compared, most naturally implemented with transistors, not resistors. In the simplest cases different inputs, voltages, are eventually multiplied by each other to perform dot-product attention. By contrast, an MLP only multiplies inputs by weights, which is what Ohm's law can implement. An ideal voltage multiplier is a perfect bilinear voltage-controlled current source (VCCS), which is perfectly non-reciprocal, in the sense that it completely blocks error signal from propagating back to earlier circuit elements.

Here, we first explore how to construct modified circuits which allow the physical back-propagation of error signal through arbitrary nonlinear elements. We do this with a double or dyadic circuit based on [4, 5], in which the steady state is in general a saddle point of some dyadic potential, rather than a minimum of energy. Instead of using one circuit for the free case and one for the nudged [6], here the mean of each pair of node voltages is the forward computation, while the difference is the error signal. Extra circuit elements are added to explicitly pass the error signal backwards, when necessary. There is an analogy to how automatic differentiation works on the computer, in which the forward computation is a chain of functions, and the pullback of each function is the appropriate backward operation for the error signal.

And second, we show explicitly one possible architecture with transformer-like behaviour. Rather than precisely implementing the familiar dot-product attention mechanism, we construct here a version which exploits the exponential nonlinearity of MOSFET devices in a natural way, replacing the dot product with a bump circuit [7] analogous to Bahdanau attention [8]. We implement softmax by sharing a fixed tail current among outputs controlled by input gate voltages [9]. While the exact dyadic double of an individual MOSFET is complicated, we show that quite crude approximations to these larger circuit blocks (using other realistic components) still allow the double circuit to learn. The learned parameters are all adjustable resistors, as in the earlier MLP circuits.

Along the way, we show that some other ideas from digital neural networks can be copied to this analogue world. We implement loss functions as floating circuit elements connected to the doubled circuit. Mean squared error is simple, but cross-entropy can also be implemented using the same MOSFET sub-circuits. And we show how to implement local optimisation rules smarter than gradient descent. Adam [10] and Lion [11] store some memory of past updates, always for just one parameter, hence they obey the locality of physical learning.

Finally, to test this model we use a simple in-context learning (ICL) task, whose input is a string of characters [12, 13]. The task, learned from examples, is to take the last character in the input and compare it to all earlier ones, retrieve part of the input near to that match, and return this as the output. This is fundamentally what the learned induction heads in a transformer do [14]. The input characters are encoded as embedding vectors, columns of an input matrix. The input matrices for this task are smaller than those of the classic MNIST learning task, of classifying handwritten digits from 28×2828 \times 28 pixel images [15]. Yet this ICL task is very difficult for an MLP to learn, so it serves as a test that the model truly has new capabilities.

Physical learning is one aspect of a broader revival of interest in analogue computing, aiming at many-variable machine-learning tasks. We briefly comment on the relation to other approaches in the conclusion. And we introduce a conjecture that no physical learning system with pairwise reciprocal interactions (i.e. one where the state minimises an energy function) can efficiently learn ICL tasks.