cs.AINov 7, 2026

The Lagrangian Brain: A Constraint Mechanics of Mind and Machine

Authors: Yuhang He, Si Wu

Organizations: School of Psychological and Cognitive Sciences, Peking University · IDG/McGovern Institute for Brain Research, Peking University · Peking-Tsinghua Center for Life Sciences, Academy for Advanced Interdisciplinary Studies, Peking University · Center of Quantitative Biology, Peking University · 

Abstract

A brain is in one state at a time, yet most of what decides its next state is absent from it: the patterns its world never produces, the statistics of a lifetime, a goal that lies ahead. In mechanics a wire acts on a bead only through a force that appears when the bead presses on it, and Lagrange computed such forces with one multiplier for each constraint. We propose that a brain follows the same mechanics. Everything a circuit knows, is told or wants is a constraint on its single state and acts through its own multiplier, which accumulates the violation and pushes the state back. Neurons and synapses carry the multipliers, each with its own time constant: inhibitory interneurons carry what never happens, adaptation the cost of staying in one state, synapses the statistics of experience, and feedback to apical dendrites the future. From this hypothesis follow Dale's law, the reciprocal wiring and balance of excitation and inhibition, the paradoxical responses of cortex and the frequencies of brain rhythms. Belief becomes the time one trajectory spends in each state, learning becomes sleep proposing laws and waking refuting the false ones, and planning becomes a wave from the goal meeting a wave from the present. Connectionism and symbolism are the limits of frozen and of instantaneous multipliers, and between them the time a circuit runs becomes the depth of its computation. A machine built on these principles, trained without gradients on 1000 solved puzzles, solves all 422,786 Sudoku-Extreme test puzzles with one trajectory each. It rediscovers the rules of Sudoku by sleeping and waking, plans shortest paths in mazes of 64 times the training area, and tracks permutations exactly on strings 25 times longer than in training, where Transformers fail. A mind, on this view, is life that learns its own constraints.

Figures & tables

Appendix figures & tables15 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

Nov 5, 2026

How Finite Brains Generalize Without Bound: Spatial Memory as a Universal Computer

A child who learns to add small numbers adds numbers of any length. LSTMs and Transformers trained on short sequences fail on longer ones. We trace the difference to what a learner reads when it decides. A position, a count or a time keeps taking new values as the input grows: it is a coordinate, and a learner that reads one meets in every long input values its experience never covered. Whether two things are the same has the same two answers at every size: it is a coincidence, and a learner that reads only coincidences finds in a long input nothing that short inputs lacked, so finite experience fixes its rule for every size. The memory carries the size of the input and the rule stays finite, and this determines the memory a generalizing brain can have: a memory that grows while what the learner reads of it stays finite has to look the same from every place, so it is made of cycles, and the past is reached by asking what happened when the cycles last stood where they stand now. The cycles are the grid modules, the cells that detect their return the place cells, the records the hippocampal index; a prefrontal controller moves the cycles and never sees them. Reading only coincidences costs no power: what finite experience fixes in such a learner is what Turing machines compute in step with their input, which is why a circuit that evolved to find the way home can learn arithmetic and grammar. In a network of neurons this machine of cycles is the dynamics seen through its symmetry, and symbols are its invariants. Trained on strings up to 40 symbols, the machine is at least 99% correct, on average over lengths 41 to 500, on nine of fifteen benchmark tasks, five of them tasks that no LSTM or Transformer solves; given new cycles after training it reverses strings of 15,015 symbols without error and fails beyond that on the curve the theory predicts; and its controllers run unchanged on neurons.
Mar 10, 2026

A Variational Latent Equilibrium for Learning in Neuronal Circuits

Brains remain unrivaled in their ability to recognize and generate complex spatiotemporal patterns. While AI is able to reproduce some of these capabilities, deep learning algorithms remain largely at odds with our current understanding of brain circuitry and dynamics. This is prominently the case for backpropagation through time (BPTT), the go-to algorithm for learning complex temporal dependencies. In this work we propose a general formalism to approximate BPTT in a controlled, biologically plausible manner. Our approach builds on, unifies and extends several previous approaches to local, time-continuous, phase-free spatiotemporal credit assignment based on principles of energy conservation and extremal action. Our starting point is a prospective energy function of neuronal states, from which we calculate real-time error dynamics for time-continuous neuronal networks. With this, as a first contribution we provide a simple and straightforward derivation of the adjoint method dynamical equations, the time-continuous equivalent to BPTT. Importantly, additional approximations are necessary to avoid unphysical temporal non-localities. One such approximation was recently proposed in Generalized Latent Equilibrium (GLE), but enforcing temporal locality of the backpropagating dynamics induces an error in the gain that becomes problematic when processing complex signals. Thus, our second contribution is to design a learning rule for the backward weights to find a fully local (in space and time) set of equations for neuron and synapse dynamics that corrects for this gain difference. With this inclusion of backward weight learning, our theory provides a rigorous framework for spatiotemporal deep learning in the brain, while simultaneously advancing a blueprint for physical circuits capable of carrying out these computations.
Oct 27, 2026

Every route counts, but some count more: a max-plus view of the C. elegans brain

Brains do not simply add up every signal they receive: they select which routes dominate. Yet connectomes are usually analyzed with tools that sum over all paths and place neural states in Euclidean spaces, blurring the feedback circuits that may sustain internal states. Here we treat neural signaling as routing instead of diffusion and describe it with max-plus algebra, in which signals accumulate along a path and the strongest route prevails. We propose a model in which the functional connectome of Caenorhabditis elegans emerges from the time-varying combination of electrical, synaptic, monoaminergic, neuropeptidergic and hormonal layers, and analyze five networks within this framework. Each collapses onto a handful of dominant feedback loops, which recover well-characterized circuits and point to new candidates for experimental study. Unlike linear spectra, these structures keep the biological meaning of the data, and their order-based description suggests that brain states live in lattices rather than Euclidean spaces.