Manuscript Offprint

arXiv:2611.07920

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

Yuhang He, Si Wu

Abstract

A child who has learned 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 of up to 40 symbols, the machine is at least 99 percent 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.

1. Introduction

Language makes infinite use of finite means (von Humboldt, 1836; Chomsky, 1965). A listener who has heard only short sentences understands long ones, a child who has added small numbers adds numbers of any length, and monkeys and crows trained on short nested sequences carry the nesting to longer ones (Ferrigno et al., 2020; Liao et al., 2022). LSTMs and Transformers do not: trained on strings of up to 40 symbols they fail at lengths 41 to 500 on tasks as plain as duplicating a string (Delétang et al., 2023; Ruoss et al., 2023), and a Transformer that reverses strings of 40 symbols without error is at chance by length 50 (Section 5.1).

Hume asked why the future should resemble the past (Hume, 1748/2000); for a learner of rules the question is sharp, because every finite set of examples fits infinitely many rules. Kripke's quus agrees with plus whenever both numbers are below 57 and answers 5 otherwise (Kripke, 1982); Goodman's grue agrees with green on everything examined before a certain date (Goodman, 1955). A child who has added only numbers below 57 has no evidence against quus, and she goes on with plus. Something in her brain fixes the rule for numbers she has never met. This paper says what it is, derives from it the memory a generalizing brain has to have, and finds that memory in the hippocampal system.

What fixes the rule is what the learner reads when it decides. Two learners that reverse a string show the difference (Figure 1a). The first stores the kth symbol under the label "position k" and, when it answers, looks up the position it needs; every label beyond 40 is new to it, and nothing in its training says what to do there. The second moves a counter one step up for each symbol it hears; for each symbol it

*Corresponding author 1^{1}School of Psychological and Cognitive Sciences, Peking University, Beijing, China 2^{2}IDG/McGovern Institute for Brain Research, Peking University, Beijing, China 3^{3}Peking-Tsinghua Center for Life Sciences, Academy for Advanced Interdisciplinary Studies, Peking University, Beijing, China 4^{4}Center of Quantitative Biology, Peking University, Beijing, China 5^{5}Key Laboratory of Machine Perception (Ministry of Education), Peking University, Beijing, China. Email: Yuhang He yuhanghe@stu.pku.edu.cn, Si Wu siwu@pku.edu.cn.

Preprint. 2027.

a Two learners reverse a string

Figure

b Situations stop growing

c A clock of coprime rings

Figure

d The machine

Figure

e Programs are movements

Figure

Figure 1. A learner that reads coincidences. (a) Two learners reverse a string: one files each symbol under its position, and every position beyond its training is new to it; the other moves a counter up while it listens and down while it answers, and reads what it heard when the counter last showed its present value (arcs). (b) Situations met on inputs up to length NN: new ones at every length for a learner that reads its position, none beyond a small N∗N^* for a procedure that reads coincidences. (c) A clock of coprime rings: one move turns every ring, rings of 3 and 4 form a cycle of 12 states on a torus, and a cell tuned to one state of both fires where they agree. (d) The machine of Eq. (1) and its parts in the brain. (e) Programs are movements of clocks (dots: readings; arcs: reads): a clock that walks back reverses, a clock sent HOME copies, a clock that follows depth is a stack, and a clock that returns handles nesting.

says, it asks what it heard the last time the counter showed its present value, and then moves the counter one step down. Its counter grows with the input too, but the learner never looks at the value. We call such a counter a clock and the value it shows its reading. Everything a learner's next action depends on is its situation. The second learner has eight (whether it is listening or answering, the symbol it hears, the symbol it finds), meets them all by length 2, and at length 500 meets no others (Figure 1b). The memory carries the size of the input; the rule stays finite.

The first learner reads a coordinate: a quantity, such as a position, a count or a time, that keeps taking new values as the input grows. The second reads a coincidence: whether two things are the same, which has the same two answers at every size. Einstein met the distinction in the hole argument. Laws that keep their form under every change of coordinates seemed unable to fix the gravitational field inside a region, since relabelling the points inside turns one solution into another that agrees with it outside. The two solutions agree on every point coincidence, every meeting of two world lines; measurement records nothing else, so they describe one world (Einstein, 1916; Stachel, 1989; Norton, 1993). A coordinate is a name; a coincidence is an event. A learner that reads a coordinate has a hole of the same kind, the values beyond its experience. Einstein closed the hole by seeing that measurement records only coincidences; a learner closes its own by reading nothing else.

The principle determines the memory. The memory has to grow with the input, and the learner has to meet only finitely many situations in it; a memory that looks the same from every place does both. The learner moves through such a memory, and may read only what its moves leave unchanged near where it stands: whether two places are the same. A finite memory looks the same from every place only by closing on itself, so it is made of cycles, and a few cycles whose periods share no factor cover the most moments with the fewest neurons. These cycles are the modules of the entorhinal grid code (Hafting et al., 2005; Fiete et al., 2008). A place cell fires where the modules that drive it agree, and so detects a coincidence (O'Keefe & Dostrovsky, 1971; Solstad et al., 2006); the hippocampus keeps an index of every moment (Teyler & DiScenna, 1986), filed here under the readings the cycles had; prefrontal cortex, gated by the basal ganglia (O'Reilly & Frank, 2006), moves the cycles without seeing them. A program is a movement of the cycles, and a return from a call is the movement back; replay, in which place cells fire in sequence while the animal rests, is a clock walked over stored readings, a program running without input. Tolman's cognitive map (Tolman, 1948; O'Keefe & Nadel, 1978) is this memory read while the body moves the cycles; the theory derives it from generalization, and finding the way home is one of its uses.

Reading only coincidences costs no power. Turing's ma-chine never reads where its head is: a step depends on the state and the symbol under the head (Turing, 1937), and that is why one finite table serves tapes of every length. A tape is a clock whose cells are records, and what finite experience fixes in the machine of cycles is what multitape Turing machines compute in step with their input (Section 3): the architecture of spatial memory is a universal computer. In attractor networks of neurons the machine is the dynamics seen through its symmetry, and symbols are what the symmetry leaves unchanged (Section 4). In the experiments the memory is built from the theory and only the controller is learned: trained on strings of up to 40 symbols, it holds its rule to length 500 on nine of fifteen benchmark tasks, reverses exactly to length 15,015 when given new cycles after training, and runs unchanged on neurons (Section 5). Kant's form of intuition, given before experience, becomes the group of moves that turns the cycles (Section 6).

References (100)

Couldn't load all references. Reload the page to try again.