cs.AINov 5, 2026

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

Authors: Yuhang He, Si Wu

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

Abstract

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.

Figures & tables

Appendix figures & tables25 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

Oct 14, 2026

Learning to Compute Is Not Learning to Retain or Reuse in Looped Transformers

Looped transformers compute by applying one block repeatedly, so they can run for more loops than they were trained with. Recurrent reasoners are known to overthink: iterating past the trained depth can turn a correct answer into a wrong one. Such a late error can reflect failed computation, loss of retention, or a state that later computation cannot reuse. We separate these cases in in-context Mealy-machine execution, where a simulator supplies intermediate targets and exact counterfactuals for hidden-state interventions. Models trained to answer at loop 32 are fully correct there but keep only 22% of these answers at loop 64. Retention depends on what training asks for: supervising one randomly chosen position per example, instead of always the last, keeps 99.8%, and randomizing the number of training loops also helps; truncating gradients, as in progressive training against overthinking, does not. The computation itself is exact: position kk is computed at loop kk, and swapping its loop-kk hidden vector for the one from another input redirects every later position to that input's exact continuation (237/237 pairs in each of ten models). Retention, however, is not reuse. Even in models that keep nearly all answers, holding each position kk fixed from loop kk drops accuracy to 4--6%, whereas holding it from loop k+4k+4 is harmless. A released recurrent maze network trained to avoid overthinking behaves the same way. Learning to compute is thus not learning to retain, and avoiding overthinking does not make a state reusable when its answer first appears.
May 29, 2026

Chain-of-Thought and Compressed Looped Transformers: A Memory-Budget Separation

Chain-of-thought prompting and looped Transformers both give a fixed model more test-time computation, but they differ in what they remember. Chain-of-thought stores intermediate state in generated tokens that remain in the context, whereas a looped Transformer carries state through recurrent hidden activations. We argue that this persistent mutable memory is a central resource for test-time reasoning. We compare three memory regimes, the compressed latent loop, the full sequence-state loop, and the chain-of-thought scratchpad. Our main result shows that a compressed loop is limited by the size of its recurrent state. Running the loop longer adds computation but does not by itself create a growing scratchpad, so a loop with a small recurrent state remains a small-space reasoner even when run for many steps. Under a standard complexity assumption, such loops cannot decide problems that are P-complete under logspace reductions, whereas polynomial-length chain-of-thought can. The separation is specific to compressed loops, as full sequence-state loops carry state at every input position and live in a memory-rich regime closer to explicit scratchpads. Controlled pointer-chasing and associative-recall sweeps illustrate this memory-budget view, with performance sensitive to whether the persistent-state budget matches the task's working-memory demand.
Apr 26, 2026

ZenBrain: A Neuroscience-Inspired 7-Layer Memory Architecture for Autonomous AI Systems

ZenBrain is a seven-layer, neuroscience-derived architecture for agent memory in LLM agents. An open library holds the seven layers, a MemoryCoordinator and nine foundational algorithms; six Predictive Memory Architecture components run in a private production system. In the open library at version 0.5.1, decay acts only on working memory and nothing is replayed. Ablating one component at a time exposes an effect we call cooperative masking. The ablation runs in a simulation harness that switches fifteen components as stand-ins at simulated values, not as production code. Under moderate load, fourteen of the fifteen ablations look costless. Raising decay, the horizon, the corpus and the queries, with no change to the components, moves ten of the fifteen in the same direction on all ten seeds - nine losses (Delta-Q down to -93.7%) and one gain. With ten seeds this is the one p-value the normal approximation of the Wilcoxon test can reach (5.06e-3), and it does not pass the Bonferroni-corrected level for fifteen contrasts (3.33e-3). On LongMemEval_S (500 questions), the evaluated ZenBrain arm - a Python port of a scoring class from our test harness, not the seven-layer system - answers 47.7% of the questions correctly under a binary judge (95% interval [43.3, 52.1]). With the compared systems' adapters repaired, Letta reaches 48.4% and Mem0 47.2%. ZenBrain reaches 91.3% of a full-context baseline's accuracy with 1/109.7 of its input tokens in the answer step; building the memory is not counted. Of nine head-to-head comparisons of the retrieved context (3 competitors x 3 LLM judges), three hold at Bonferroni-corrected significance, all against A-Mem, and the remaining six show no significant difference. On LoCoMo, the routing results of version 8 came from placeholder embeddings; with text-embedding-3-small, the flat variant (F1 0.059) lies above the full system (0.058).