23 Recurrence, Recursion, and Reasoning
Can neural networks reason? This question, deceptively simple to state, lies at the very heart of modern artificial intelligence. Generating fluent text is not the same as reasoning about it: a language model may produce a convincing paragraph about prime numbers without being able to check whether is prime. Generating an image of a chess board is not the same as reasoning about the game: the model may paint every piece in photographic detail yet be unable to determine whether white is in check. The gap between production and reasoning is one of the central intellectual challenges of generative modelling, and it is the subject of this chapter.
We will approach the question mathematically. Rather than debating whether machines “truly” understand, we will ask: what are the computational mechanisms that enable generative models to solve problems requiring multi-step inference, and what are the fundamental mathematical limits of those mechanisms?
Key Idea.
What computational mechanisms enable generative models to reason? And what are the fundamental mathematical limits of these mechanisms? This chapter develops the mathematical framework to answer both questions.
The chapter follows a deliberate arc. We begin with recurrent foundations (Recurrent Foundations for Iterative Computation), revisiting RNNs, LSTMs, and GRUs as iterated maps and connecting them to the theory of dynamical systems and fixed points. We then confront the computational limits of Transformers (Computational Limits of Transformers), showing that a single forward pass through a fixed-depth Transformer computes a function in the circuit complexity class : powerful, but unable to solve certain polynomial-time problems unless the long-standing conjecture fails. This motivates chain-of-thought reasoning (Chain-of-Thought Reasoning), where the model generates intermediate tokens that turn a bounded-depth computation into an unbounded one and carry the model's reach all the way up to . We then study how reinforcement learning can train models to discover reasoning strategies on their own (Reinforcement Learning for Reasoning), culminating in the GRPO algorithm behind DeepSeek-R1. The later sections address self-reflection (Self-Reflection and Iterative Refinement), recursive architectures (Recursive Reasoning Architectures), and a synthesis of the entire reasoning landscape (Connections and Synthesis).
Historical Note.
The question of machine reasoning has a long pedigree. Alan Turing asked “Can machines think?” in 1950 [1], proposing the imitation game as a test. Jeffrey Elman introduced the Simple Recurrent Network in 1990 [2], showing that recurrence enables networks to process sequential structure. Hochreiter and Schmidhuber's Long Short-Term Memory (1997) [3] solved the vanishing gradient problem and enabled learning over hundreds of time steps. The Transformer (2017) [4] replaced recurrence with attention, unlocking massive parallelism and scaling to billions of parameters. Chain-of-thought prompting (2022) [5] revealed that large language models could solve complex problems by “thinking aloud.” DeepSeek-R1 (2025) [6] demonstrated that reinforcement learning could elicit sophisticated reasoning behaviours, including spontaneous self-correction, without any explicit supervision of the reasoning process.
Recurrent Foundations for Iterative Computation
Before we can understand the reasoning capabilities of modern language models, we must understand the mathematical structure of recurrence, the idea that a computation proceeds by repeatedly applying a function to its own output. Recurrence is the oldest and most natural mechanism for iterative computation in neural networks, and its mathematical properties illuminate both the power and the limitations of sequential reasoning.
Recurrence as Iterative Computation
Recall the recurrent neural network defined in Definition 10: given an input sequence , the RNN updates a hidden state via (RNN Recall) The key observation is that, for a fixed input token , the update rule defines a map (RNN MAP) Computing is then precisely the iterated application of a sequence of maps: . This viewpoint (recurrence as iterated function application) is the foundation upon which the entire chapter rests.
Remark 1 (Autoregressive Generation is Recurrent).
Even the Transformer, which replaces recurrence in its architecture, is recurrent in its generation process. When an autoregressive model generates tokens one at a time, each forward pass takes the concatenation of all previous tokens and produces the next. If we let denote the state (the sequence generated so far), then the generation step where is an iterated stochastic map. The theory of recurrence therefore applies to reasoning in all autoregressive models, not only RNNs.
The Gated Recurrent Unit (GRU)
The LSTM (Definition 11) solved the vanishing gradient problem with three gates and a separate cell state. The Gated Recurrent Unit (GRU), introduced by Cho et al. [21], achieves a similar effect with a simpler architecture using only two gates.
Definition 1 (Gated Recurrent Unit (GRU)).
The GRU processes a sequence by updating a hidden state via two gates (the update gate and the reset gate ) and a candidate activation : (GRU Update) where is the element-wise sigmoid, denotes the Hadamard (element-wise) product, and denotes concatenation. The weight matrices are with bias vectors .
The crucial design choice is (GRU Update): the new hidden state is a convex interpolation between the old state and the candidate , controlled by the update gate . When , the hidden state is copied unchanged; when , the hidden state is overwritten with the candidate.
Remark 2 (GRU vs. LSTM).
The GRU has two gates; the LSTM (Definition 11) has three (forget, input, output) plus a separate cell state . Despite having fewer parameters, the GRU often matches the LSTM in practice on tasks such as language modelling and speech recognition. The key shared idea is the linear interpolation pathway: the LSTM has , while the GRU has . In both cases, when the “copy” gate is close to identity, information flows through unattenuated.
Proposition 1 (GRU Gradient Through the Copy Pathway).
Consider the GRU update . The Jacobian of with respect to contains the term (GRU Jacobian) When the update gate satisfies , the dominant term is , so the gradient is close to the identity matrix. This provides a gradient highway: gradients flow from back to without exponential attenuation, as long as the update gates remain small along the path.
Proof.
By the product and chain rules applied to (GRU Update), (GRU Jacobian FULL) When , the second term is scaled by (bounded) times , whose sigmoid factor evaluated at the gate's own output is , and the third term is scaled by directly. Both corrections are therefore : they vanish at the same rate as the gate itself, not merely below the sigmoid's global maximum slope of . (At the factor is , and the maximum is attained at , the opposite regime.) Hence the dominant contribution is . Over time steps, the product remains close to the identity rather than decaying exponentially, establishing the gradient highway property.
Fixed-Point Perspective
The iterated-map viewpoint of Recurrence as Iterative Computation leads naturally to a fundamental question: when the same input is presented repeatedly (or when the input is held constant), does the hidden state converge? And if so, to what? The answers come from the theory of fixed points, one of the most beautiful and useful areas of analysis.
Definition 2 (Fixed Point).
Let be a set and a map. A point is a fixed point of if .
Definition 3 (Contraction Mapping).
Let be a metric space. A map is a contraction (or contraction mapping) if there exists a constant such that (Contraction) The smallest such is called the Lipschitz constant (or contraction ratio) of .
The following classical theorem, due to Stefan Banach [22], guarantees both the existence and the computability of the fixed point.
Theorem 1 (Banach Contraction Mapping Theorem).
Let be a nonempty complete metric space and let be a contraction mapping with Lipschitz constant . Then:
has a unique fixed point .
For any initial point , the iterates converge to .
The rate of convergence satisfies (Banach RATE)
Proof.
We proceed in three steps.
Step 1: The iterates form a Cauchy sequence. For any , (Banach STEP) For , the triangle inequality gives (Banach Cauchy) where the last inequality uses the geometric series . Since , the right-hand side tends to zero as , so is a Cauchy sequence.
Step 2: Convergence and existence. Since is complete, the Cauchy sequence converges to some . We verify that is a fixed point: Both terms on the right tend to zero as , so , i.e., .
Step 3: Uniqueness. Suppose is another fixed point. Then Since , this implies , so and .
Rate bound. Taking in (Banach Cauchy) gives .
Key Idea.
Every RNN computing can be viewed as iterating the map . If is a contraction (for instance because the spectral norm of is constrained to be less than ), then the hidden state converges to a unique fixed point regardless of the initialisation . This is the mathematical basis for equilibrium models such as Deep Equilibrium Models [7].
Example 1 (A Simple 1D Recurrence).
Consider the scalar recurrence . The map has Lipschitz constant , so it is a contraction on . The unique fixed point satisfies , giving . Starting from any , the iterates converge: The error decreases geometrically from wherever it starts: , which is for the run above and from .
Vanishing Gradients Revisited
The book already noted the vanishing/exploding gradient problem for vanilla RNNs (see the Remark following Definition 10). Here we make the analysis precise and show how gated architectures resolve it.
Proposition 2 (Gradient of RNN Hidden State).
For the vanilla RNN , the gradient of with respect to for is the matrix product (RNN Gradient Product) where is the pre-activation at step . Consequently:
If , then each factor has operator norm strictly less than , and the product vanishes exponentially: .
If , gradients can explode exponentially.
Proof.
By the chain rule, Each factor is , yielding (RNN Gradient Product). The norm bound follows from submultiplicativity: .
Proposition 3 (LSTM Gradient Highway).
The LSTM cell state (Definition 11) satisfies . The Jacobian of the cell state is (LSTM Gradient) When the forget gate satisfies and the gate derivative terms are small, . Over many time steps, (LSTM Gradient Product) which remains close to the identity when all forget gates are near one. This is the “gradient highway” that allows LSTMs to learn dependencies spanning hundreds of time steps.
Proof.
Differentiating the cell update with respect to , we obtain In the LSTM, the gates and depend on , which itself depends on via . The three correction terms are controlled as follows.
The second term carries , whose sigmoid factor evaluated at the gate's own output is . In the copy regime this is : it vanishes at the same rate as the gate saturates. (At the factor is . The familiar bound is attained at , the opposite regime, and a factor of compounded over steps is not small.)
The third and fourth terms are governed by the input gate , which in the LSTM is a separate gate and is not tied to . Forget-gate saturation alone therefore says nothing about them: the third term carries and the fourth carries directly, so both are only when the cell is additionally not writing.
Hence the honest hypothesis is and , under which all three corrections are and the dominant contribution is . That is exactly the regime in which a cell is carrying information rather than overwriting it, which is the regime the gradient highway describes. The product formula (LSTM Gradient Product) then follows by induction. (In the coupled-gate variant the second condition is implied by the first, which is one reason that variant is easier to analyse; see Exercise 5.)
Exercise 1.
For a vanilla RNN with sigmoid activation , show that . Conclude that the gradient vanishes whenever . Why does this make training difficult in practice?
Connection to Dynamical Systems
The hidden-state sequence produced by an RNN is the orbit of the initial condition under the discrete dynamical system . This connection to dynamical systems theory offers rich insights:
A fixed point with is an equilibrium. If is a contraction, the equilibrium is a globally stable attractor: all orbits converge to it (Theorem 1).
If the spectral radius of the Jacobian at is less than one, the equilibrium is locally stable even if is not a global contraction.
If the spectral radius exceeds one, the system can exhibit complex behaviour, including limit cycles and chaos.
Remark 3 (Chaos in Recurrent Networks).
When the weight matrix has large spectral norm, the RNN map can become expansive rather than contractive. In this regime, small changes to the input or initialisation can lead to exponentially diverging hidden-state trajectories, the hallmark of deterministic chaos. This “edge of chaos” regime is both a curse (it causes exploding gradients) and a blessing (it allows the network to exhibit rich, input-sensitive dynamics necessary for complex computation).
Computational Limits of Transformers
We have seen that recurrence provides a mechanism for iterative computation. But the dominant architecture of modern generative modelling, the Transformer, deliberately avoids recurrence in favour of parallel self-attention. What are the consequences of this design choice for reasoning? In this section, we develop the circuit complexity framework needed to answer this question precisely.
Circuit Complexity Classes
A Boolean circuit is a directed acyclic graph whose internal nodes are logic gates (AND, OR, NOT, etc.) and whose leaves are input bits. The size of a circuit is the number of gates; the depth is the length of the longest path from an input to an output. We are interested in families of circuits , one for each input length .
Definition 4 (Boolean Circuit Complexity Classes).
The following classes of circuit families are central to our discussion:
: constant-depth, polynomial-size circuits with unbounded fan-in AND and OR gates, and NOT gates.
: constant-depth, polynomial-size circuits with unbounded fan-in AND, OR and NOT gates together with threshold (majority) gates. A threshold gate outputs if and only if at least half of its inputs are . Negation is essential: without it none of these classes would contain parity, since every function computed by a monotone circuit is monotone.
: -depth, polynomial-size circuits with bounded fan-in AND and OR gates (each with at most inputs) and NOT gates.
: polynomial-size circuit families (no depth restriction, not necessarily uniform).
The known inclusion chain is (Circuit Inclusions) The first inclusion is strict: . The other inclusions are not known to be strict, but are widely conjectured to be so.
Example 2 (Parity is not in ).
The parity function (the XOR of bits) lies in : a constant-depth, polynomial-size circuit of threshold gates computes it, for instance by forming the sum with a depth-2 threshold network and reading off its low-order bit. It is worth noting that no single threshold gate can do this. A threshold gate outputs and therefore computes only linearly separable functions, and parity is the textbook example of one that is not: already at , XOR would require , , and , which is inconsistent since . However, the celebrated result of Furst, Saxe, and Sipser (1984), later sharpened by Hastad (1987), shows that any circuit computing parity requires exponential size: . This demonstrates that the strict inclusion is well established.
Caution.
Circuit complexity measures what can be computed in bounded depth. A standard Transformer with layers has depth , independent of the input length , so it computes a constant-depth circuit for every input length. This is the key connection: Transformers are fundamentally bounded-depth computing devices.
Transformers as Bounded-Depth Computation
We now state the central complexity-theoretic result about Transformers.
Theorem 2 (Transformers are in [8]).
A Transformer with a fixed number of layers , attention heads , and embedding dimension , operating on inputs of length with -bit precision, can be simulated by a uniform circuit family. Specifically, for any fixed architecture, there exists a family of threshold circuits of constant depth and polynomial size (in ) that computes the same function.
Proof sketch.
The proof proceeds layer by layer.
Attention. Each attention head computes inner products between query and key vectors (polynomial-time arithmetic, implementable in given -precision), followed by a softmax (exponentiation and division, also in ), followed by a weighted sum of value vectors. Each of these operations can be computed by a constant-depth threshold circuit of polynomial size.
Feed-forward layers. Each position independently undergoes an affine transformation followed by an activation function (typically ReLU or GELU). These are piecewise-polynomial operations on -bit numbers, computable in .
Layer normalisation. Computing the mean and variance across a vector of entries (where is a constant) is a fixed-size arithmetic operation, hence trivially in .
Composition. Since is a constant, composing layers of circuits yields a circuit (constant times a constant is still constant depth).
The “uniform” qualifier means that the circuit description can itself be computed in logarithmic space from , which follows from the regular structure of the Transformer architecture.
Corollary 1 (Inherent Limitations of Fixed-Depth Transformers).
A fixed-depth Transformer cannot solve any problem that lies outside in a single forward pass. This includes problems believed to require super-constant depth, such as:
Boolean formula evaluation: evaluating an arbitrary Boolean formula on given inputs (complete for ).
Graph connectivity: determining whether two nodes in a graph are connected (in ).
Iterated matrix product: computing the product of matrices of constant dimension (complete for ). Note the contrast with iterated multiplication of integers, which is in DLOGTIME-uniform , along with integer division and powering (Hesse, 2001).
Insight.
This result does not mean that Transformers are weak. is a powerful class that includes integer multiplication, sorting, and many practical tasks. But it does mean there are mathematical limits to what a single forward pass can compute, regardless of model size. Scaling up parameters (making the circuit wider) does not help; the depth constraint is the binding one.
Chain-of-Thought Reasoning
The central lesson of Computational Limits of Transformers is stark: a single forward pass through a fixed-depth Transformer is limited to . But what if the model is allowed to perform multiple forward passes, writing intermediate results to a “scratchpad” that it can read back on subsequent passes? This simple idea, generating intermediate tokens before the final answer, turns out to fundamentally change the computational power of the model.
Scratchpads and Intermediate Computation
The idea of augmenting a neural network with a scratchpad for intermediate computation was explored by Nye et al. [23], who trained Transformers to solve multi-step arithmetic problems. Rather than mapping directly from input to output, the model was trained to produce the full sequence of intermediate computation steps (carries, partial sums, etc.) before writing the final answer.
Definition 5 (Scratchpad Augmentation).
Given an input , a scratchpad-augmented model generates a sequence of intermediate tokens before producing the final output . The joint distribution factorises as (Scratchpad) where ranges over all possible scratchpad sequences of length up to . In practice, since the sum is intractable, the model generates a single scratchpad sequence autoregressively and conditions the answer on it.
The critical observation is that each token generation is a separate forward pass. If the model generates intermediate tokens, it effectively performs sequential forward passes, each of which is a computation that can read the results of all previous passes. This sequential composition is far more powerful than a single pass.
Chain-of-Thought Prompting
The scratchpad idea was implicit in the training procedure of Nye et al. Wei et al. [5] made it explicit at inference time through chain-of-thought (CoT) prompting: by including step-by-step reasoning exemplars in the prompt, they showed that large language models could be induced to generate intermediate reasoning steps for novel problems.
Definition 6 (Chain-of-Thought Prompting).
Given a question , chain-of-thought prompting [5] induces the model to generate a reasoning chain of intermediate tokens followed by a final answer . The model's probability of the correct answer factorises as (COT) where ranges over all possible reasoning chains. In practice, the model generates a single chain autoregressively: (COT Autoregressive)
Remarkably, Kojima et al. [24] showed that the simple prompt suffix “Let's think step by step” is sufficient to elicit chain-of-thought reasoning in large language models, even without any exemplars. This is known as zero-shot CoT.
Example 3 (Standard vs. Chain-of-Thought Prompting).
Consider the arithmetic word problem:
Q: Roger has 5 tennis balls. He buys 2 more cans of 3 tennis balls each. How many tennis balls does he have now?
Standard prompting: A: 11.
Chain-of-thought prompting: A: Roger started with 5 balls. He bought 2 cans of 3 balls each, so he bought balls. Now he has balls. The answer is .
In the CoT version, every token of the worked solution is a separate forward pass, so the two intermediate results (, then ) cost as many passes as they take tokens to write, and each pass can condition on everything written before it. The steps are the useful unit for a reader; the tokens are the unit of computation, and it is the token count that buys the sequential depth.
Theoretical Foundations: The Power of Intermediate Steps
We now present the theoretical results that explain why chain-of-thought is so powerful. The key insight is that CoT changes the model's computational class.
Theorem 3 (Impossibility Without CoT [9]).
Assume . Then there are problems solvable in polynomial time that no fixed-depth Transformer solves in a single forward pass at logarithmic precision. More precisely: for any Transformer with a fixed number of layers , fixed number of heads , fixed embedding dimension , and -bit precision, there exists a function (indeed ) and infinitely many input lengths at which the Transformer fails to compute correctly on at least one input of length .
Proof sketch.
By Theorem 2, any fixed-depth log-precision Transformer computes a function in uniform . Take to be iterated composition of permutations on five elements, which is -complete under reductions (Barrington's theorem). If a fixed-depth Transformer computed on all inputs of every sufficiently large length, then , and with the inclusion from Definition 4 the two classes would coincide, contradicting the hypothesis.
Remark 4.
The conditional form is not a technicality to be waved away: no unconditional separation of uniform from is known, and proving one would be a major result in complexity theory. Definition 4 already records that is not known to be strict, and the theorem above is exactly the statement that becomes available once it is. What the theorem does deliver unconditionally is the shape of the argument: a bounded-depth device cannot escape its own circuit class, so any escape must come from outside the forward pass. That is what the next section supplies.
This impossibility result motivates chain-of-thought: if a single pass is insufficient, perhaps multiple passes suffice?
Theorem 4 (Sufficiency of CoT [10]).
A polynomial-size autoregressive Transformer with chain-of-thought, that is, allowed to generate polynomially many intermediate tokens before producing the final answer, can solve any problem in . Formally: for any language , there exists a constant-depth Transformer and a polynomial such that, given input of length , the Transformer generates at most intermediate tokens and then outputs the correct answer (accept/reject) for .
Proof sketch.
The proof constructs a Transformer that simulates a Turing machine. The key steps are:
Encoding. The scratchpad at each step encodes the current configuration of a Turing machine (tape contents, head position, state).
One-step simulation. A single forward pass of the Transformer reads the current configuration and writes the next configuration. This requires reading the symbol under the head, looking up the transition function, and updating the tape, head, and state. Each of these operations is a bounded look-up, which is computable in (in fact, even in , since the transition table is constant-size).
Iteration. By generating intermediate tokens (one per Turing machine step), the Transformer simulates steps of the Turing machine. Since , there exists a polynomial-time Turing machine deciding , and steps suffice.
The construction yields a Transformer with a number of layers, heads, and embedding dimension that depend on the Turing machine (but not on ), and a scratchpad of length at most .
Corollary 2 (From to with Chain-of-Thought).
A single forward pass of a fixed-depth, -precision Transformer computes a function in uniform , and the same Transformer allowed a polynomial-length chain of thought decides every language in . If, as is widely believed, , then chain-of-thought strictly enlarges what the model can compute.
Remark 5.
Both halves of the corollary are unconditional; only the word “strictly” is not. Since uniform , a collapse would force as well, which is open. Nobody expects that, but it has not been ruled out, and the honest statement is worth keeping in view: what is proved is the pair of containments, not the gap between them.
Key Idea.
Chain-of-thought is not merely a prompting trick; it changes the computational class the model can reach. A single forward pass computes a function in ; a polynomial chain of forward passes computes any function in . The intermediate tokens serve as the working memory that a bounded-depth circuit otherwise lacks.
Self-Consistency
A single chain of thought may contain errors. Wang et al. [25] proposed self-consistency decoding, which samples multiple reasoning chains and takes a majority vote over the final answers.
Definition 7 (Self-Consistency Decoding).
Given a question , self-consistency decoding proceeds as follows:
Sample independent reasoning chains .
Extract the final answer from each chain: for .
Return the majority vote: (SELF Consistency)
The following proposition makes precise the sense in which self-consistency reduces errors.
Proposition 4 (Error Reduction via Self-Consistency).
Suppose the model produces the correct answer for a binary question independently with probability on each sampled chain. Then the probability that the majority vote over chains yields the correct answer satisfies (SELF Consistency Bound) which converges exponentially fast to as .
Proof.
Let be the number of correct answers among the chains. The majority vote is correct if and only if . Since each chain is independent with , we have . By the Hoeffding bound applied to the random variables , where we used the Hoeffding inequality with . Therefore, .
Tree of Thoughts
Chain-of-thought generates a single linear chain of reasoning steps. But many problems have a combinatorial structure that is better explored with tree search: at each step, multiple continuations are possible, and some may lead to dead ends. Yao et al. [11] proposed Tree of Thoughts (ToT), which organises the reasoning process as a search over a tree.
Definition 8 (Tree of Thoughts (ToT)).
The Tree of Thoughts framework [11] organises reasoning as a search over a tree where:
Each node represents a partial reasoning state (a prefix of a reasoning chain).
The children of are generated by prompting the language model to propose “next thoughts,” candidate continuations of the reasoning chain.
A value function , implemented by prompting the same language model, evaluates how promising each partial state is (e.g., “sure/maybe/impossible”).
A search algorithm (breadth-first search or depth-first search) explores the tree, using to prioritise or prune branches.
Algorithm 1 (Tree of Thoughts – BFS Variant).
Input: Problem ; branching factor ; beam width ; maximum depth ; LM-based thought generator and evaluator . Output: Best reasoning chain .
Initialise the frontier where encodes the problem .
For depth : enumerate
Expand: For each , generate candidate next thoughts using : .
Evaluate: For each candidate , compute .
Select: Keep the top- states by value: . enumerate
Return .
Remark 6 (CoT vs. ToT: Depth vs. Breadth).
Standard CoT explores a single path through the reasoning space. Self-consistency samples multiple independent paths (no interaction between them). ToT explores a tree, where the evaluation at each node can guide the search toward more promising regions. This is analogous to the distinction between greedy search, random restarts, and beam search in classical optimisation. The cost is higher: ToT requires forward passes compared to for a single CoT chain of length .
Reinforcement Learning for Reasoning
Chain-of-thought provides the mechanism for multi-step reasoning, but where do the reasoning chains come from? The approaches in Chain-of-Thought Reasoning relied on either human-written demonstrations (few-shot CoT) or the model's pre-existing ability (zero-shot CoT). A natural question is: can models discover effective reasoning strategies on their own, through trial and error? This is the domain of reinforcement learning (RL), and its application to reasoning has produced some of the most striking results in recent AI research.
From Supervised CoT to Self-Discovery
The bridge between supervised chain-of-thought and RL-based discovery is the Self-Taught Reasoner (STaR) algorithm of Zelikman et al. [26]. The key idea is to bootstrap reasoning ability from a small set of examples by iteratively generating, filtering, and learning from the model's own reasoning chains.
Algorithm 2 (Self-Taught Reasoner (STaR)).
Input: Dataset of question–answer pairs; a few seed CoT demonstrations; initial model . Output: Improved model .
Generate: For each question , sample a reasoning chain and extract the predicted answer .
Filter: Keep only chains that produced the correct answer: .
Rationalise: For questions where the model failed, provide the correct answer as a hint and generate a new chain conditioned on it. Add successful rationalisations to .
Fine-tune: Update by supervised fine-tuning on (maximise ).
Iterate: Return to Step 1 with the updated model. Repeat until convergence.
Remark 7 (STaR as Approximate RL).
STaR can be viewed as a simplified form of policy gradient RL. The “reward” is binary (correct or incorrect answer), and the policy update (Step 4) plays the role of a REINFORCE update with a reward of for correct chains and for incorrect ones, except that it uses the maximum-likelihood objective rather than the policy gradient estimator. The correspondence is exact only for the filtered on-policy chains: also holds the rationalised chains from Step 3, which were sampled from with the answer in hand and are carried with no importance weight, so they are off-policy. That step (Step 3) is a form of hindsight experience replay.
Policy Optimisation Background
To understand the more sophisticated RL methods used for reasoning, we need the basic tools of policy optimisation. We present them here in the context of language generation, where the “environment” is the problem to be solved and the “trajectory” is the generated reasoning chain.
Definition 9 (REINFORCE Estimator).
Let be a policy (language model) parameterised by that generates a trajectory (token sequence) with probability . Let be a scalar reward for the complete trajectory. The REINFORCE estimator [12] of the policy gradient is (Reinforce) which can be estimated by sampling trajectories and computing (Reinforce Estimator)
Remark 8 (Variance Reduction).
The REINFORCE estimator has notoriously high variance. A standard remedy is to subtract a baseline from the reward: replace by in (Reinforce). Provided does not depend on the sampled trajectory , this leaves the expected gradient unchanged: (Baseline Unbiased) while the variance can drop dramatically. The independence hypothesis is the load-bearing one, and it is worth marking now: a baseline computed from the same samples it is applied to does not satisfy it, which is exactly the situation in Proposition 5. Common baselines that do satisfy it include a running mean of rewards over past questions and a learned value function .
Definition 10 (Proximal Policy Optimisation (PPO)).
PPO [13] prevents destructively large policy updates by clipping the importance sampling ratio. Let be the ratio of the new policy to the old policy for action in state . The PPO-Clip objective is (PPO) where is the estimated advantage (how much better action is compared to the baseline), and (typically –) is the clipping threshold.
The clipping mechanism in (PPO) works as follows: if an action is better than expected (), the objective increases with but is capped at , preventing the new policy from becoming too different from the old one. Conversely, if , the objective does not allow to decrease below . This creates a “trust region” around the old policy.
Group Relative Policy Optimisation (GRPO)
The methods above (REINFORCE, PPO) require either high-variance gradient estimates or a learned value function (critic) to compute advantages. Training a value function on long reasoning chains is itself a difficult problem: the state space is enormous (the space of all partial token sequences), and the reward is sparse (typically only available at the end of the chain). Group Relative Policy Optimisation (GRPO), introduced in the DeepSeek-Math [27] and DeepSeek-R1 [6] papers, solves this problem elegantly by eliminating the critic entirely.
Definition 11 (Group Relative Policy Optimisation (GRPO)).
Given a question , GRPO samples a group of outputs from the current policy: . The reward for each output is . The advantages are estimated by group normalisation: (GRPO Advantage) where and are computed over the group, with taken as the population standard deviation over the samples. (The choice matters at small : for the group the population value gives advantages of exactly , while the sample value gives .) When every reward in the group is equal the denominator is zero and the group contributes no gradient. The policy is updated by maximising (GRPO Objective) where is the clipping threshold, is a KL penalty coefficient, and is a reference policy (typically the initial supervised fine-tuned model). The importance ratio is taken per token and averaged over the output, exactly as in (PPO): (GRPO Ratio) with the same advantage shared by every token of output . Clipping at the sequence level would be vacuous: a whole-sequence ratio is a product of hundreds of per-token ratios, and it leaves after a single token moves slightly.
Key Idea.
GRPO eliminates the need for a separate value/critic network (which PPO requires). Instead, it estimates the baseline from the group statistics, a form of self-referential normalisation. This is especially important for reasoning tasks: training a value function on long reasoning chains with sparse, delayed rewards is extremely difficult. GRPO sidesteps this problem entirely by comparing each output only to its siblings in the same group.
Remark 9 (GRPO vs. PPO).
Both GRPO and PPO use clipped importance ratios to stabilise training. The critical difference is in how they compute the advantage:
PPO uses a learned value function to compute the advantage: , where is trained by regression on observed returns. This requires maintaining and training a second network of comparable size to the policy.
GRPO uses the group mean reward as the baseline: . No additional network is needed. The cost is that outputs must be sampled per question, but this is naturally parallelisable on modern hardware.
For large language models with billions of parameters, eliminating the critic saves substantial compute and memory.
Proposition 5 (Zero-Sum Property of the GRPO Advantage).
The group-normalised advantage defined in (GRPO Advantage) satisfies, for any fixed question , . The group mean therefore acts as a baseline: outputs scoring above the group average push the policy toward themselves and outputs scoring below it push away, at a scale set by the spread within the group rather than by the absolute scale of rewards.
Proof.
By definition, .
Caution.
The estimator is not unbiased. Zero-sum is not the same as unbiased, and GRPO's gradient estimator is not unbiased. The baseline argument of Definition 9 needs , which requires to be independent of the sampled action. The group mean is computed from including itself, so that independence fails; the division by the sample standard deviation , also computed from the same samples, adds a second source of bias, and is undefined when every reward in the group is equal. Several later variants drop the division for exactly this reason. In practice the bias is small at moderate and is accepted in exchange for removing the critic network entirely.
DeepSeek-R1: A Case Study
The DeepSeek-R1 model [6] provides a compelling case study of how reinforcement learning can elicit sophisticated reasoning behaviour from a large language model. Its training pipeline comprises four stages, each building on the previous.
Algorithm 3 (DeepSeek-R1 Training Pipeline).
Input: Base language model ; question–answer datasets for mathematics, coding, and science; rule-based reward functions. Output: Reasoning-capable model .
Stage 1: Cold Start. Fine-tune on a small, curated dataset of high-quality chain-of-thought examples (thousands of examples, not millions). This “cold start” provides the model with the basic format of step-by-step reasoning, yielding .
Stage 2: Reasoning RL. Apply GRPO (Definition 11) to using rule-based rewards:
Accuracy reward: for correct final answer, otherwise. For mathematics, this is exact-match comparison after normalisation. For coding, this is determined by executing the generated code against test cases.
Format reward: small bonus for placing the reasoning inside designated tags and the answer inside tags.
This stage runs for thousands of RL steps, progressively increasing the model's reasoning capability.
Stage 3: Rejection Sampling and SFT. Use the RL-trained model to generate many candidate solutions for each question. Filter for correct solutions and select the highest-quality ones (by length, clarity, and diversity). Perform supervised fine-tuning (SFT) on this curated dataset, yielding a model that combines the reasoning ability from RL with the fluency and format of SFT.
Stage 4: Full RL. Apply a second round of GRPO with an expanded reward signal that includes both reasoning accuracy and general helpfulness, harmlessness, and format adherence. This final stage aligns the model with broader user preferences while preserving reasoning capability.
Historical Note.
Before the four-stage pipeline above, DeepSeek trained DeepSeek-R1-Zero: the base model with reinforcement learning applied directly, and no supervised fine-tuning of any kind. It is in that run that researchers observed the phenomenon they termed the “aha moment.” After several hundred RL steps, the model spontaneously began re-examining its reasoning when it encountered inconsistencies, generating phrases like “Wait, let me reconsider” and “Hmm, I think I made an error above. Let me try again.” The absence of any supervised stage is precisely what makes this striking: no example of self-correction existed anywhere in that pipeline. The RL objective rewarded correct final answers, and the model discovered on its own that pausing to check and revise its work increased the probability of arriving at one.
R1-Zero's weakness was readability, with mixed languages and unstructured output, and that is what motivated the cold-start supervised stage of the full R1 pipeline. The reasoning behaviour itself was not taught there; it was inherited.
Remark 10 (Rule-Based vs. Learned Rewards).
A distinguishing feature of the DeepSeek-R1 approach is its reliance on rule-based rewards rather than a learned reward model. For mathematics, correctness is determined by exact-match comparison of the final numerical answer. For coding, correctness is determined by executing the generated code against a test suite. This design choice avoids the well-known problem of reward hacking, where the model exploits weaknesses in a learned reward model rather than genuinely improving its reasoning. The downside is that rule-based rewards are only available for domains with verifiable answers (math, code, formal logic), not for open-ended reasoning tasks. This is why the reliance is partial rather than total: Stage 2 is driven entirely by rules, while Stage 4 brings in preference reward models for the general, non-verifiable data, where no rule exists to check against.
Exercise 2.
(a) Show that GRPO degenerates at group size : substituting into , the group mean is the single sample itself, so the numerator is identically zero and the update vanishes before the undefined is even reached. (b) Now replace the group statistics by a running mean of rewards maintained across questions. Show that with no clipping this recovers the REINFORCE estimator with a moving-average baseline, and explain why that baseline is legitimate while the group mean is not: the running mean is independent of the sample it is applied to, which is exactly the hypothesis the baseline argument of Definition 9 needs.
Exercise 3.
Suppose a fixed-depth Transformer with layers attempts to solve the problem of composing permutations on . Assuming and using Theorem 2, argue that a single forward pass cannot solve this problem for all sufficiently large . Identify precisely where the assumption is used. Then show that a chain-of-thought approach, generating intermediate tokens, can solve it by composing permutations one at a time.
Self-Reflection and Iterative Refinement
The “aha moment” observed during the pure-RL training of DeepSeek-R1-Zero, the run that preceded the pipeline of Algorithm 3, hinted at a striking capability: large language models can learn to recognise their own mistakes and correct them. In this section we formalise self-reflection as a species of iterative refinement and connect it, once again, to the fixed-point theory that recurs throughout this chapter. The core message is simple: if we view a model's output as a point in some space of solutions, then self-correction is nothing more than applying an operator repeatedly until we reach a fixed point.
Reflexion
Definition 12 (Reflexion).
Reflexion [14] is an agent framework in which experience is stored as verbal feedback rather than gradient updates. Given a task with input , the agent proceeds as follows:
Attempt. Produce an initial output .
Evaluate. An evaluator (which may be the model itself, a unit-test harness, or an external reward signal) scores the current attempt , starting at .
Reflect. If the evaluation fails, the agent generates a natural-language reflection on that attempt, , summarising the failure mode.
Retry. The reflection is appended to a persistent memory buffer, which now holds , and the task is re-attempted with the whole buffer in context:
Increment and repeat from step 2 until passes or a budget is exhausted. Note that each pass reflects on the latest attempt, so the buffer grows by one reflection per round; the weights never change, only the context does.
Remark 11 (Verbal Reinforcement Learning).
Reflexion can be understood as “verbal reinforcement learning”: rather than updating model weights in response to reward, the agent updates a textual memory. The reflections play the role of a value function: they encode information about which strategies failed and why, guiding future attempts away from repeated mistakes.
Self-Refine
Reflexion relies on an external evaluator. Self-Refine [28] closes the loop entirely: the same language model serves as generator, critic, and refiner.
Definition 13 (Self-Refine).
Given an input and a language model , the Self-Refine procedure iterates between three roles:
Generate. .
Critique. .
Refine. .
The process terminates when the critique is vacuous (“no further improvements needed”) or when a maximum number of iterations is reached.
Let us cast this in the language of fixed-point iteration. Define the refine–critique operator (SELF Refine Operator) The Self-Refine loop is then simply . Convergence occurs when : the critique finds nothing to improve and the refiner reproduces the input unchanged.
Proposition 6 (Self-Refine as Fixed-Point Iteration).
Suppose the combined refine–critique operator of (SELF Refine Operator) is a contraction mapping on a complete metric space of outputs with Lipschitz constant : Then by Theorem 1 (Banach Contraction Mapping Theorem):
There exists a unique fixed point .
For any initialisation , the iterates satisfy both i.e. convergence is geometric with rate . The first bound is computable from the first step actually taken; the second, immediate from contractivity applied times to the pair , is the one to use when the distance to the answer is what is known.
Proof.
This is a direct application of Theorem 1. Two hypotheses have to be checked rather than assumed. First, must map into itself, which holds by construction since and both produce elements of . Second, must be complete, so that the Cauchy sequence of iterates has a limit in ; for the discrete and integer-valued metrics on text used in practice this is automatic, but for a metric on a continuous embedding space it is a real condition. The contraction hypothesis is the substantive assumption of the proposition and is not established here: it is what a self-refinement loop has to earn empirically.
Insight.
Self-Refine, Reflexion, and even the iterative denoising in diffusion models (sec:diffusion_language) all share the same mathematical backbone: iterative application of an operator converging toward a fixed point. This is the recurring (pun intended) theme of the chapter.
Deep Equilibrium Models
We now turn to the mathematical centrepiece of this section: a neural architecture whose output is defined as a fixed point.
Definition 14 (Deep Equilibrium Model).
A Deep Equilibrium Model (DEQ) [7] defines its output as the fixed point of a single parametric layer. Given input , the model computes (DEQ FP) where is a neural network layer (e.g. a Transformer block). The forward pass finds by applying a root-finding algorithm, such as Broyden's method or Anderson acceleration, to the residual
Conceptually, a DEQ is an infinitely deep, weight-tied network: the same layer is applied over and over until the representation converges. The remarkable insight is that we can differentiate through this infinite process using only the fixed point itself.
Theorem 5 (Implicit Differentiation for DEQ).
Proof.
Define the residual map . At the equilibrium we have .
Step 1 (Implicit Function Theorem). The Jacobian of with respect to is If is invertible (which is guaranteed when the spectral radius , i.e. when is contractive), then the Implicit Function Theorem asserts that is a smooth function of in a neighbourhood, with total derivative (Dzstar Dtheta)
Step 2 (Chain rule). Applying the chain rule to :
Step 3 (Adjoint formulation). Define the row vector . Transposing both sides gives , which is the linear system . Substituting back: Crucially, the linear system can be solved iteratively: , which converges when (the same condition that guarantees the forward pass converges). This avoids ever forming or inverting explicitly.
Key Idea.
The DEQ insight is profound: an infinitely deep network (weight-tied) converges to a fixed point, and we can backpropagate through this infinite depth using only the fixed point itself, with no need to store intermediate activations. This makes the memory cost independent of “depth.”
Caution.
The DEQ forward pass requires convergence of the root-finding algorithm, which is only guaranteed when is contractive (spectral radius ). In practice, spectral normalisation or other regularisation techniques are employed to enforce contractivity during training.
Example 4 (DEQ on a 2D Problem).
Consider a two-dimensional DEQ with where is a scalar input. The weight matrix has spectral norm (its singular values are and ; the spectral radius is , the eigenvalues being complex), so the composition is contractive and the iteration converges for any starting point.
For and , the first few iterates are: Convergence is rapid: the successive step sizes are , , and , so by iteration 4 the step is already below . The observed ratio between consecutive steps is about to , far better than the global guarantee , because the rate that governs convergence near the fixed point is the local Jacobian , whose spectral norm here is : the is well into its flat region at , and its derivative shrinks every direction further. (Note that is the step size; Definition 14 calls the residual, and the two coincide only up to a shift of the index.)
Recursive Reasoning Architectures
We have seen that Chain-of-Thought adds computational depth by generating tokens sequentially (Theorem 4), and that Deep Equilibrium Models add depth by iterating a single layer to a fixed point (Definition 14). In this section we survey a family of recent architectures that take the idea of explicit recursion even further, achieving remarkable reasoning performance, sometimes with surprisingly few parameters.
Universal Transformers
Definition 15 (Universal Transformer).
The Universal Transformer [15] applies the same Transformer block repeatedly to the sequence representation: (UT INIT) where is a per-step coordinate encoding that informs the shared block of the current iteration count, and the block is shared (weight-tied) across all steps . Note that the encoding enters the block's input: added to the output instead, the block at step would only ever see and could not know which iteration it was on.
Remark 12 (Turing Completeness).
Equipped with Adaptive Computation Time (see below), the Universal Transformer is Turing-complete: it can simulate any Turing machine given sufficient iterations and precision. This stands in stark contrast to the standard (fixed-depth) Transformer, which is limited to the circuit complexity class per Theorem 2. The additional computational power comes entirely from the ability to repeat the same block an unbounded number of times.
Adaptive Computation Time
Definition 16 (Adaptive Computation Time).
Adaptive Computation Time (ACT) [16] allows a recurrent model to choose, for each input, how many computation steps to perform. At each step , the model produces a halting probability via a learned sigmoid unit. The model halts at step defined by (ACT HALT) for a small threshold . The remainder is assigned to the final step so the weights sum to one. The output is the weighted combination (ACT Output) where is the hidden state at step . A ponder cost is added to the loss to encourage the model to halt early when additional computation is unnecessary.
Remark 13.
ACT provides a differentiable (if approximate) mechanism for the model to learn “how hard to think.” Easy inputs trigger early halting; hard inputs receive more computation steps. This mirrors human cognition, where difficult problems naturally require more deliberation.
Hierarchical Reasoning Model
Definition 17 (Hierarchical Reasoning Model).
The Hierarchical Reasoning Model (HRM) [17] is a single recurrent network of 27 million parameters, trained from scratch on roughly a thousand examples, with no pre-training and no chain-of-thought data. Its two interdependent modules are recurrent modules running at different timescales, not separate models exchanging tokens:
H-module (slow): performs abstract planning, updating once per macro-step on a latent state .
L-module (fast): performs rapid detailed computation, running inner updates on for each H-update, conditioned on the current .
Formally, for macro-step and inner step : with . The entire nested loop runs inside a single forward pass: there is no token-level interface between the two modules, and nothing is emitted until the loop terminates.
Remark 14 (Two Timescales, One Network).
The pattern is reminiscent of the manager–worker decomposition in hierarchical reinforcement learning, with the slow module setting the direction and the fast module filling in the detail. The resemblance is structural rather than architectural: both modules here are small recurrent blocks inside one 27M-parameter network, and the depth that does the reasoning comes from the nesting of the two loops, not from the size of either module.
Tiny Recursive Models
Perhaps the most surprising recent result in reasoning comes from a model with only 7 million parameters.
Definition 18 (Tiny Recursive Model).
A Tiny Recursive Model (TRM) [18] defines reasoning as a fixed-point iteration with a compact neural network: (TRM Iteration) where is the input encoding, is the (partial) output encoding, is a recurrent latent state, and is a small neural network; in the original work, as few as 7 million parameters.
Training uses Truncated Backpropagation Through Loops (TBPTL): during training, the iteration is unrolled for steps and the gradient is propagated through all steps. At test time, however, the model is free to iterate for many more than steps, exploiting the convergent nature of the iteration to “think longer” without retraining.
The headline result is remarkable: a 7M-parameter TRM (the attention variant) reaches 44.6% on ARC-AGI-1 under the two-attempt protocol, against DeepSeek-R1's 15.8% at 671B parameters on the same benchmark.
Key Idea.
TRM demonstrates that recursive computation, not parameter count, is the key ingredient for certain types of reasoning. A 7,M-parameter model with enough iterations can outperform a 671,B-parameter model without recursion on abstract reasoning tasks, across a parameter ratio of about . The ratio measures storage, not total work: TRM spends many iterations on each answer, so it buys with sequential depth what the larger model would have to buy with width.
Proposition 7 (TRM Convergence).
If is Lipschitz continuous in its third argument with constant for all fixed , that is, then by Theorem 1 the iteration converges to a unique fixed point for any initialisation .
net takes the
input , partial output , and the current latent state ,
producing the next state . The loop continues until convergence.
During training the loop is unrolled for a fixed number of steps (TBPTL); at
test time the model may iterate longer.Universal Reasoning Model
Definition 19 (Universal Reasoning Model).
The Universal Reasoning Model (URM) [19] is a production-scale recursive reasoning architecture built on three design principles:
ConvSwiGLU block. The recursive module combines a short depthwise 1-D convolution (kernel size ) with the SwiGLU activation. SwiGLU puts the swish on the gate branch and leaves the value branch linear: (URM GATE) where , also written . The full block is .
TBPTL training. Like TRM, URM trains with Truncated Backpropagation Through Loops, unrolling for steps during training.
Adaptive halting. URM uses ACT-style adaptive computation time (Definition 16): a learned halting head accumulates halting probabilities over an outer loop and stops when they cross the threshold, with the loop capped at 16 steps.
URM achieves strong performance on both mathematical reasoning and common-sense benchmarks, demonstrating that recursive architectures scale beyond toy problems.
Remark 15 (URM vs. TRM).
Both models share the core principle of recursive computation through a weight-shared module. URM differs in its use of convolution-based blocks (which capture local structure efficiently), a more sophisticated gating mechanism (SwiGLU), and a learned ACT halting head over its outer loop. URM scales to larger model sizes and more diverse tasks, while TRM emphasises minimality, showing that even 7M parameters suffice for abstract reasoning when coupled with enough iterations.
Comparison and Analysis
Table 1 summarises the key properties of the architectures discussed in this section.
| Model | Params | Recursion Type | ARC-AGI-1 | Key Innovation |
| Direct pred (Transformer) | 27.3M | None | 21.0% | Attention mechanism |
| DeepSeek-R1 [6] | 671B | CoT (token-level) | 15.8% | GRPO training |
| o3-mini-high | undisclosed | CoT (token-level) | 34.5% | Test-time scaling |
| Gemini 2.5 Pro | undisclosed | CoT (token-level) | 37.0% | Test-time scaling |
| HRM [17] | 27M | Hierarchical | 40.3% | Two timescales, one pass |
| TRM-MLP [18] | 19M | Fixed-point (latent) | 29.6% | Tiny net + iteration |
| TRM-Att [18] | 7M | Fixed-point (latent) | 44.6% | Tiny net + iteration |
The most striking entry in Table 1 is TRM's performance: 44.6% on ARC-AGI-1 with only 7M parameters, against DeepSeek-R1's 15.8% with 671B, a parameter ratio of . Two qualifications keep the comparison honest. First, the gain over HRM (40.3% at 27M) is four points, not a revolution: most of the effect comes from the recurrent-fixed-point family rather than from TRM specifically. Second, on the harder ARC-AGI-2 every model in this family is still near the floor: TRM-Att 7.8%, TRM-MLP 2.4%, HRM 5.0%, DeepSeek-R1 1.3%. URM [19] reports the strongest figures in this line of work, 53.8% pass@1 on ARC-AGI-1 and 16.0% pass@1 on ARC-AGI-2, using a 4-layer model of hidden size 512 with 8 heads; its pass@1 protocol is not directly comparable with the two-attempt column above. With those caveats the pattern is unmistakable, and it is strong evidence for a principle that runs through the entire chapter:
Insight.
The ability to reason is determined not by the size of a model's single forward pass but by the depth of its iterated computation. A small model that “thinks” for many steps can outperform a massive model that “thinks” only once. In the language of computational complexity: increasing sequential depth (from toward ) matters more than increasing parallel width.
Connections and Synthesis
Having surveyed recurrence (Recurrent Foundations for Iterative Computation), prompting strategies, reinforcement learning for reasoning, self-reflection, and recursive architectures, we now step back and identify the common mathematical thread that unites them all.
The Unifying Framework: Reasoning as Fixed-Point Computation
Definition 20 (Iterative Reasoning Operator).
An iterative reasoning system is a triple consisting of:
A state space (which may be discrete, continuous, or a hybrid of both).
An operator .
An initial state encoding the input.
The system iterates and extracts the output from the convergence point (or from after a fixed budget ).
Table 2 shows how every method in this chapter instantiates this framework.
| Method | State Space | Operator |
| RNN (Definition 10) | Hidden state | |
| Chain-of-Thought (Definition 6) | Token sequence | LM next-token prediction |
| Self-Refine (Definition 13) | Output text | Critique Refine |
| DEQ (Definition 14) | Latent | |
| TRM (Definition 18) | Latent | |
| Diffusion LM (sec:diffusion_language) | Masked tokens | Unmask remask |
Connection to Diffusion Language Models
Recall from sec:diffusion_language that diffusion language models, such as MDLM and LLaDA, iteratively denoise a sequence: This is structurally identical to the recursive reasoning systems of this chapter:
The state is the partially denoised (partially unmasked) sequence.
The operator is the denoising step: predict masked positions conditioned on the current unmasked context.
The fixed point is the fully clean sequence .
Insight.
Masked diffusion language models perform a form of implicit reasoning: each denoising step considers the full context of unmasked tokens to predict masked positions, effectively “deliberating” over multiple passes. This is precisely the multi-pass computation that elevates the model beyond (Theorem 2). From the perspective of this chapter, a diffusion language model is a reasoning system whose “chain of thought” lives in token-masking space rather than in token-generation space.
The Parallelism–Depth Trade-off
Proposition 8 (Parallelism–Depth Trade-off).
For any computational task, there is a fundamental trade-off between sequential depth and parallel work [8]:
A single forward pass through a Transformer computes in sequential depth1 but parallel work (self-attention over tokens).
Chain-of-Thought with reasoning tokens adds sequential depth with total work.
Recursive models (TRM/URM) with iterations add sequential depth. One iteration of a -dimensional block costs per token for its dense maps plus for attention over tokens, so the total is per token, where is the latent dimension.
More sequential depth enables the solution of harder problems (moving from toward ), but reduces the opportunities for parallelism and increases latency.
This trade-off is central to the practical deployment of reasoning systems: how much time should a model spend “thinking”? ACT (Definition 16), used both by the Universal Transformer and by URM (Definition 19), is the standard mechanism for navigating this trade-off adaptively.
Open Problems
The study of reasoning in neural networks is young and rich with open questions. We highlight several that we believe are particularly important.
Problem 1 (Open Problems in Neural Reasoning).
Optimal depth allocation. How should a model decide how many reasoning steps to use for a given input? Learned halting heads such as ACT are heuristics; is there a principled, information-theoretic criterion?
Verifiable reasoning. Can we verify that a chain of thought is logically sound, rather than merely checking that it produces the correct final answer? Current models can arrive at the right answer for wrong reasons.
Compositionality. Can recursive models compose learned subroutines into novel reasoning chains? For example, can a model that has learned “sort” and “search” compose them into “sort then search”?
Theoretical limits of bounded recursion. What is the computational complexity class of a TRM whose operator has fixed size, independent of the input length, run for iterations with polynomial in the input size? Is it exactly , or some proper subclass? (The size restriction matters: allow the operator to grow with and the answer is immediate, since one iteration can then implement a Turing-machine transition step.)
Reasoning in continuous spaces. Can latent-space reasoning (as in TRM and DEQ) be connected to continuous optimisation? Is finding a fixed point equivalent to minimising some implicit loss?
Self-improvement. Can a recursive reasoning model improve its own operator during inference, rather than relying on a fixed, trained operator?
Connection to consciousness. Is iterative self-monitoring (Reflexion, self-consistency checking) related to computational models of consciousness such as Global Workspace Theory?
Scaling laws for depth vs. width. What are the scaling laws when we increase reasoning depth (number of iterations or CoT tokens) vs. model size (number of parameters)? Existing scaling laws [20] focus on parameters, data and training compute; extending them to “thinking time” is an open frontier.
We close this section with a conjecture that, if true, would place recursive reasoning on firm computational-theoretic foundations.
Conjecture 1 (Latent Reasoning Hypothesis).
There is a fixed operator , of size independent of the input length , and a polynomial , such that for every decision problem in the recursive iteration run for steps, solves the problem for all inputs of length , and such an operator is learnable from a polynomial number of examples.
Remark 16.
The size restriction is what makes the statement a conjecture. Drop it, and the result follows immediately from the construction already given for Theorem 4: let encode the configuration of a polynomial-time Turing machine, let be the polynomial-size circuit implementing one transition step, and run iterations. The same construction answers open problem 4 above under the same non-uniform reading, which is why that problem too should be read with a fixed-size operator. The interesting content is that models such as TRM hold their operator fixed at 7,M parameters across every problem instance and learn it, which is a far stronger claim than mere existence.
Historical Timeline
The ideas in this chapter span over three decades, from the earliest recurrent networks to the latest recursive reasoning architectures. fig:reasoning-timeline presents a chronological overview, colour-coded by category: defblueblue for architectures, thmgreengreen for prompting and inference methods, exorangeorange for reinforcement learning approaches, and lempurplepurple for theoretical results.
Exercises
Exercise 4 (Fixed-Point Iteration).
Consider the map on the interval .
Show that is a contraction on . Hint: use the Mean Value Theorem and the bound for .
Starting from , compute .
Estimate the fixed point (the Dottie number) and verify that to three decimal places.
Exercise 5 (GRU vs. LSTM).
Couple the LSTM's gates (Definition 11) by setting and , and hold the output gate open, . The result is the coupled input-forget gate (CIFG) LSTM.
Write out the LSTM equations under these constraints and simplify.
Show that CIFG is close to, but not identical with, the GRU (Definition 1), and identify exactly two remaining differences. Hint: the book's LSTM has , so leaves rather than ; and the GRU's reset gate , which gates inside the candidate, has no LSTM counterpart.
What is the advantage of coupling the gates in this way? Discuss in terms of parameter count and gradient flow.
Exercise 6 (Vanishing Gradients in Vanilla RNNs).
For the vanilla RNN :
Show that the Jacobian satisfies .
Conclude that where is the spectral norm of .
Discuss the implications for learning long-range dependencies when versus .
Exercise 7 ( and Parity).
Prove that the parity function on bits cannot be computed by an circuit. You may use H stad's Switching Lemma without proof.
Explain why this does not exclude parity from . Hint: What additional gate type does allow?
Construct an explicit circuit (constant depth, polynomial size, with threshold gates) that computes parity.
Exercise 8 (CoT Depth).
A computational problem requires sequential computation steps (it is in but not in ).
Using Theorem 4, how many CoT tokens must a Transformer generate to solve this problem?
If the cost of generating each token is (due to attention), what is the total cost? Compare to the cost of a direct algorithm.
Discuss the implications for the efficiency of CoT-based reasoning.
Exercise 9 (Self-Consistency Error Bound).
Generalise the self-consistency result to the case where there are possible answers. Let the correct answer have probability and let the strongest competitor have probability , with margin .
If we draw independent samples and take a plurality vote, express the error probability as a sum involving the multinomial distribution.
Show that a margin over is not enough to control the error. Take with , , and , and compute exactly by conditioning on and using . You should find an error probability of about , which does not shrink with in the way a bound in would predict. Explain why: a plurality vote fails when some other answer outpolls the correct one, so the controlling quantity is the margin over the runner-up, not over .
Apply Hoeffding to each pairwise difference and a union bound over the wrong answers to prove .
How many samples does that bound require for error probability ?
Exercise 10 (GRPO vs. PPO).
Consider a simple one-step bandit problem with reward drawn from a distribution with mean and variance .
Write the GRPO advantage estimator (Definition 11) for a group of samples: where and are the sample mean and standard deviation.
Write the PPO advantage for the same setting: where is a learned value baseline.
Compute for both estimators. Under what conditions does GRPO have lower variance?
Discuss the trade-off: GRPO avoids learning a value function but requires multiple samples per prompt.
Exercise 11 (DEQ Forward Pass).
Consider a DEQ with where , , .
Implement (in pseudocode) the forward pass: iterate from until .
Under what condition on does the iteration converge for any ? Hint: consider and the Lipschitz constant of .
If , estimate the number of iterations needed to reach accuracy.
Exercise 12 (DEQ Backward Pass).
Continuing from the previous exercise:
Compute the Jacobian for the given .
Write the linear system from Theorem 5.
Show that this system can be solved by the fixed-point iteration . Under what condition does this iteration converge?
Compare the memory cost of this approach to standard backpropagation through unrolled iterations.
Exercise 13 (TRM Convergence).
A TRM uses the network where .
Show that is Lipschitz with constant 1.
Conclude that is Lipschitz in with constant .
If , apply Theorem 1 to prove convergence of the TRM iteration to a unique fixed point.
What happens if ? Give a concrete 1D example where the iteration does not converge.
Exercise 14 (Recursion vs. Parameters).
A standard Transformer with parameters performs a single forward pass at cost . A TRM with parameters iterates times, each iteration costing .
What is the total compute of the TRM?
For what ratio does the TRM have lower total compute than the Transformer?
DeepSeek-R1 has parameters. TRM has . If TRM uses iterations, compute the ratio . Discuss the implications for “thinking time” vs. “model size.”
Is compute the right metric? Discuss latency implications.
Exercise 15 (Diffusion as Recursion).
Consider a masked diffusion language model that iterates for denoising steps, unmasking tokens at each step.
Define the state space and operator for this model in the framework of Definition 20.
Under what conditions can the denoising operator be viewed as a contraction mapping? Hint: think about the number of masked tokens decreasing monotonically.
Relate the number of diffusion steps to the “reasoning depth” concept developed in this chapter. How does this compare to the number of CoT tokens?
Exercise 16 (Self-Refine Convergence).
Model Self-Refine as the iteration where represents the critique-then-refine step.
In what metric space might be contractive? Propose a concrete metric on the space of text outputs (e.g. edit distance, BLEU-based distance, or embedding distance).
If is contractive with constant , how many iterations are needed to reduce the “error” below , starting from ?
What happens if ? Give an informal example of a critique-refine loop that diverges.
Is the contractivity assumption realistic for language models? Discuss.
Exercise 17 (Tree of Thoughts Complexity).
In Tree of Thoughts (ToT) with branching factor and maximum depth :
If each node evaluation costs (one LM call), what is the total cost of a full BFS?
If we keep only the top- nodes at each depth (beam search), how does the cost change? Express in terms of , , , and .
Compare the cost of beam-search ToT ( beams, depth ) with Self-Consistency using samples of a CoT of length .
Under what conditions does ToT outperform Self-Consistency despite higher cost?
Exercise 18 (Open Problem: Universal Recursive Reasoning).
This is a research-level exercise. Conjecture 1 states that small recursive networks can solve any problem in .
Prove the conjecture for the special case of problems in . Hint: problems have -depth circuits of polynomial size. Show that a recursive network can simulate one circuit layer per iteration, using iterations total.
Explain why the general case (arbitrary ) is significantly harder. What is the gap between and , and what does it imply for the number of iterations?
Discuss whether the conjecture might be false. What would a counterexample look like?
Notes
- Here “depth” means the number of serial computation steps, not the number of layers; from a circuit perspective the layers execute in constant serial depth.
References
-
Computing Machinery and Intelligence
BibTeX
@article{turing1950computing, title={Computing Machinery and Intelligence}, author={Turing, Alan M.}, journal={Mind}, volume={59}, number={236}, pages={433--460}, year={1950} }Journal article
-
Finding Structure in Time
BibTeX
@article{elman1990finding, title={Finding Structure in Time}, author={Elman, Jeffrey L.}, journal={Cognitive Science}, volume={14}, number={2}, pages={179--211}, year={1990}, publisher={Wiley Online Library} }Journal article
-
Long Short-Term Memory
BibTeX
@article{hochreiter1997long, title={Long Short-Term Memory}, author={Hochreiter, Sepp and Schmidhuber, J{\"u}rgen}, journal={Neural Computation}, volume={9}, number={8}, pages={1735--1780}, year={1997} }Journal article
-
Attention is all you need
BibTeX
@inproceedings{vaswani2017attention, title={Attention is all you need}, author={Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N and Kaiser, {\L}ukasz and Polosukhin, Illia}, booktitle={Advances in neural information processing systems}, pages={5998--6008}, year={2017} }Conference paper
-
Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
BibTeX
@article{wei2022chain, title={Chain-of-Thought Prompting Elicits Reasoning in Large Language Models}, author={Wei, Jason and Wang, Xuezhi and Schuurmans, Dale and Bosma, Maarten and Ichter, Brian and Xia, Fei and Chi, Ed and Le, Quoc and Zhou, Denny}, journal={Advances in Neural Information Processing Systems}, volume={35}, pages={24824--24837}, year={2022} }Journal article
-
DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
BibTeX
@article{deepseekr1, title={{DeepSeek-R1}: Incentivizing Reasoning Capability in {LLMs} via Reinforcement Learning}, author={{DeepSeek-AI}}, journal={arXiv preprint arXiv:2501.12948}, year={2025} }Journal article
-
Deep Equilibrium Models
BibTeX
@article{bai2019deep, title={Deep Equilibrium Models}, author={Bai, Shaojie and Kolter, J. Zico and Koltun, Vladlen}, journal={Advances in Neural Information Processing Systems}, volume={32}, year={2019} }Journal article
-
The Parallelism Tradeoff: Limitations of Log-Precision Transformers
BibTeX
@article{merrill2023parallelism, title={The Parallelism Tradeoff: Limitations of Log-Precision Transformers}, author={Merrill, William and Sabharwal, Ashish}, journal={Transactions of the Association for Computational Linguistics}, volume={11}, pages={531--545}, year={2023} }Journal article
-
Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective
BibTeX
@article{feng2023towards, title={Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective}, author={Feng, Guhao and Zhang, Bohang and Gu, Yuntian and Ye, Haotian and He, Di and Wang, Liwei}, journal={Advances in Neural Information Processing Systems}, volume={36}, year={2023} }Journal article
-
Chain of Thought Empowers Transformers to Solve Inherently Serial Problems
BibTeX
@article{li2024chain, title={Chain of Thought Empowers Transformers to Solve Inherently Serial Problems}, author={Li, Zhiyuan and Liu, Hong and Zhou, Denny and Ma, Tengyu}, journal={arXiv preprint arXiv:2402.12875}, year={2024} }Journal article
-
Tree of Thoughts: Deliberate Problem Solving with Large Language Models
BibTeX
@article{yao2023tree, title={Tree of Thoughts: Deliberate Problem Solving with Large Language Models}, author={Yao, Shunyu and Yu, Dian and Zhao, Jeffrey and Shafran, Izhak and Griffiths, Thomas L. and Cao, Yuan and Narasimhan, Karthik}, journal={Advances in Neural Information Processing Systems}, volume={36}, year={2023} }Journal article
-
Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning
BibTeX
@article{williams1992simple, title={Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning}, author={Williams, Ronald J.}, journal={Machine Learning}, volume={8}, number={3--4}, pages={229--256}, year={1992} }Journal article
-
Proximal Policy Optimization Algorithms
BibTeX
@inproceedings{schulman2017proximal, title={Proximal Policy Optimization Algorithms}, author={Schulman, John and Wolski, Filip and Dhariwal, Prafulla and Radford, Alec and Klimov, Oleg}, booktitle={arXiv preprint arXiv:1707.06347}, year={2017} }Conference paper
-
Reflexion: Language Agents with Verbal Reinforcement Learning
BibTeX
@article{shinn2023reflexion, title={Reflexion: Language Agents with Verbal Reinforcement Learning}, author={Shinn, Noah and Cassano, Federico and Gopinath, Ashwin and Narasimhan, Karthik and Yao, Shunyu}, journal={Advances in Neural Information Processing Systems}, volume={36}, year={2023} }Journal article
-
Universal Transformers
BibTeX
@inproceedings{dehghani2018universal, title={Universal Transformers}, author={Dehghani, Mostafa and Gouws, Stephan and Vinyals, Oriol and Uszkoreit, Jakob and Kaiser, {\L}ukasz}, booktitle={International Conference on Learning Representations}, year={2019} }Conference paper
-
Adaptive Computation Time for Recurrent Neural Networks
BibTeX
@article{graves2016adaptive, title={Adaptive Computation Time for Recurrent Neural Networks}, author={Graves, Alex}, journal={arXiv preprint arXiv:1603.08983}, year={2016} }Journal article
-
Hierarchical Reasoning Model
BibTeX
@article{wang2025hrm, title={Hierarchical Reasoning Model}, author={Wang, Guan and Li, Jin and Sun, Yuhao and Chen, Xing and Liu, Changling and Wu, Yue and Lu, Meng and Song, Sen and Abbasi Yadkori, Yasin}, journal={arXiv preprint arXiv:2506.21734}, year={2025} }Journal article
-
Less is More: Recursive Reasoning with Tiny Networks
BibTeX
@article{jolicoeur2025trm, title={Less is More: Recursive Reasoning with Tiny Networks}, author={Jolicoeur-Martineau, Alexia}, journal={arXiv preprint arXiv:2510.04871}, year={2025} }Journal article
-
Universal Reasoning Model
BibTeX
@article{gao2025urm, title={Universal Reasoning Model}, author={Gao, Zitian and Chen, Lynx and Xiao, Yihao and Xing, He and Tao, Ran and Luo, Haoming and Zhou, Joey and Dai, Bryan}, journal={arXiv preprint arXiv:2512.14693}, year={2025} }Journal article
-
Scaling Laws for Neural Language Models
BibTeX
@article{kaplan2020scaling, title={Scaling Laws for Neural Language Models}, author={Kaplan, Jared and McCandlish, Sam and Henighan, Tom and Brown, Tom B. and Chess, Benjamin and Child, Rewon and Gray, Scott and Radford, Alec and Wu, Jeffrey and Amodei, Dario}, journal={arXiv preprint arXiv:2001.08361}, year={2020} }Journal article
-
Learning Phrase Representations using RNN Encoder--Decoder for Statistical Machine Translation
BibTeX
@inproceedings{cho2014learning, title={Learning Phrase Representations using {RNN} Encoder--Decoder for Statistical Machine Translation}, author={Cho, Kyunghyun and van Merrienboer, Bart and Gulcehre, Caglar and Bahdanau, Dzmitry and Bougares, Fethi and Schwenk, Holger and Bengio, Yoshua}, booktitle={Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)}, pages={1724--1734}, year={2014} }Conference paper
-
Sur les operations dans les ensembles abstraits et leur application aux equations integrales
BibTeX
@article{banach1922operations, title={Sur les op{\'e}rations dans les ensembles abstraits et leur application aux {\'e}quations int{\'e}grales}, author={Banach, Stefan}, journal={Fundamenta Mathematicae}, volume={3}, number={1}, pages={133--181}, year={1922} }Journal article
-
Show Your Work: Scratchpads for Intermediate Computation with Language Models
BibTeX
@article{nye2021show, title={Show Your Work: Scratchpads for Intermediate Computation with Language Models}, author={Nye, Maxwell and Andreassen, Anders Johan and Gur-Ari, Guy and Michalewski, Henryk and Austin, Jacob and Biber, David and Dohan, David and Lewkowycz, Aitor and Bosma, Maarten and Luan, David and others}, journal={arXiv preprint arXiv:2112.00114}, year={2021} }Journal article
-
Large Language Models are Zero-Shot Reasoners
BibTeX
@article{kojima2022large, title={Large Language Models are Zero-Shot Reasoners}, author={Kojima, Takeshi and Gu, Shixiang Shane and Reid, Machel and Matsuo, Yutaka and Iwasawa, Yusuke}, journal={Advances in Neural Information Processing Systems}, volume={35}, pages={22199--22213}, year={2022} }Journal article
-
Self-Consistency Improves Chain of Thought Reasoning in Language Models
BibTeX
@article{wang2023selfconsistency, title={Self-Consistency Improves Chain of Thought Reasoning in Language Models}, author={Wang, Xuezhi and Wei, Jason and Schuurmans, Dale and Le, Quoc and Chi, Ed and Narang, Sharan and Chowdhery, Aakanksha and Zhou, Denny}, journal={International Conference on Learning Representations}, year={2023} }Journal article
-
STaR: Bootstrapping Reasoning With Reasoning
BibTeX
@article{zelikman2022star, title={{STaR}: Bootstrapping Reasoning With Reasoning}, author={Zelikman, Eric and Wu, Yuhuai and Mu, Jesse and Goodman, Noah D.}, journal={Advances in Neural Information Processing Systems}, volume={35}, pages={15476--15488}, year={2022} }Journal article
-
DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
BibTeX
@article{shao2024deepseekmath, title={{DeepSeekMath}: Pushing the Limits of Mathematical Reasoning in Open Language Models}, author={Shao, Zhihong and Wang, Peiyi and Zhu, Qihao and Xu, Runxin and Song, Junxiao and Zhang, Mingchuan and Li, Y.K. and Wu, Y. and Guo, Daya}, journal={arXiv preprint arXiv:2402.03300}, year={2024} }Journal article
-
Self-Refine: Iterative Refinement with Self-Feedback
BibTeX
@article{madaan2023self, title={Self-Refine: Iterative Refinement with Self-Feedback}, author={Madaan, Aman and Tandon, Niket and Gupta, Prakhar and Hallinan, Skyler and Gao, Luyu and Wiegreffe, Sarah and Alon, Uri and Dziri, Nouha and Prabhumoye, Shrimai and Yang, Yiming and others}, journal={Advances in Neural Information Processing Systems}, volume={36}, year={2023} }Journal article