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 provably unable to solve certain polynomial-time problems. This motivates chain-of-thought reasoning (Chain-of-Thought Reasoning), where the model generates intermediate tokens that effectively turn a bounded-depth computation into an unbounded one, elevating the model's computational class from 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 of the chapter (covered in the companion file) address self-reflection, recursive architectures, and a synthesis of the entire reasoning landscape.
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 def:rnn: 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 (def:lstm) solved the vanishing gradient problem with three gates and a separate cell state. The Gated Recurrent Unit (GRU), introduced by Cho et al. [20], 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 (def:lstm) 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 the derivative of the sigmoid (which is at most ), and the third term is scaled by . 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 [21], guarantees both the existence and the computability of the fixed point.
Theorem 1 (Banach Contraction Mapping Theorem).
Let be a 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: .
Vanishing Gradients Revisited
The book already noted the vanishing/exploding gradient problem for vanilla RNNs (see the Remark following def:rnn). 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 (def:lstm) 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 . However, this dependence passes through tanh and sigmoid nonlinearities whose derivatives are at most and respectively, making these terms small. The dominant contribution is . The product formula (LSTM Gradient Product) follows by induction.
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.
: constant-depth, polynomial-size circuits with unbounded fan-in AND, OR, and threshold (majority) gates. A threshold gate outputs if and only if at least half of its inputs are .
: -depth, polynomial-size circuits with bounded fan-in (each gate has at most inputs).
: 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) is computable by a single threshold gate (output if the number of s is odd) and hence lies in . 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 multiplication: computing the product of matrices (complete for ).
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. [22], 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. [23] 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, each intermediate step (, then ) is a separate forward pass, and each pass can leverage the results of previous passes.
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]).
There exist problems solvable in polynomial time that no fixed-depth Transformer can solve in a single forward pass with polynomially bounded 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 such that, for all sufficiently large input length , the Transformer fails to compute correctly on a constant fraction of inputs of length .
Proof sketch.
By Theorem 2, any fixed-depth Transformer computes a function in . Standard complexity-theoretic conjectures (and, for specific problems, unconditional results) give functions in that are not in . For instance, the iterated permutation composition problem (given permutations on , compute their composition) is in but is widely believed to be outside . For any such function, the Transformer's output (a function) must disagree with the correct answer on a constant fraction of inputs for sufficiently large , since otherwise the circuit would correctly compute a non- function on almost all inputs, yielding a contradiction via standard amplification arguments.
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 (CoT Elevates to ).
Chain-of-thought generation effectively elevates the computational class of autoregressive Transformers from (single forward pass) to (polynomial-length chain of forward passes).
Key Idea.
Chain-of-thought is not merely a prompting trick; it fundamentally changes the computational class of the model. 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. [24] 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 4 (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. [25]. 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 5 (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) is equivalent to 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 “rationalisation” 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 6 (Variance Reduction).
The REINFORCE estimator has notoriously high variance. A standard remedy is to subtract a baseline from the reward: replace by in (Reinforce). This does not change the expected gradient (since ) but can dramatically reduce the variance. Common baselines include the running mean of rewards 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 [26] 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. The policy is updated by maximising (GRPO Objective) where is the importance ratio, is the clipping threshold, is a KL penalty coefficient, and is a reference policy (typically the initial supervised fine-tuned model).
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 7 (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 (Unbiasedness of GRPO Advantage).
The group-normalised advantage defined in (GRPO Advantage) has the property that, for any fixed question , . Consequently, the GRPO gradient automatically has zero-baseline structure: the gradient from outputs with above-average reward is positive, and from below-average outputs is negative, regardless of the absolute scale of rewards.
Proof.
By definition, . The zero-sum property means the gradient automatically subtracts the (implicit) baseline from each reward, reducing variance compared to the raw REINFORCE gradient.
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.
During Stage 2 of DeepSeek-R1 training, researchers observed a remarkable phenomenon that 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.” This emergent self-reflection arose purely from the RL reward signal; the model was never explicitly trained on examples of self-correction. The RL objective rewarded correct final answers, and the model discovered that pausing to check and revise its work increased the probability of arriving at the correct answer.
Remark 8 (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.
Exercise 2.
Show that GRPO with group size (a single sample per question) and no clipping reduces to the REINFORCE estimator with a constant baseline equal to the running mean reward. What goes wrong in practice with ? (Hint: the group standard deviation is undefined for a single sample.)
Exercise 3.
Suppose a fixed-depth Transformer with layers attempts to solve the problem of composing permutations on . Using Theorem 2, argue that a single forward pass cannot solve this problem for sufficiently large . 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 training of DeepSeek-R1 (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 .
Reflect. If the evaluation fails, the agent generates a natural-language reflection summarising the failure mode.
Retry. The reflection is appended to a persistent memory buffer and the task is re-attempted:
Repeat from step 2 until passes or a budget is exhausted.
Remark 9 (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 [27] 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 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 , i.e. convergence is geometric with rate .
Proof.
This is a direct application of Theorem 1. The only non-trivial step is to verify that maps into itself, which holds by construction since and both produce elements of .
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) [15] 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: The sign convention in follows from absorbing the minus sign from .
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 , so the composition is contractive and the iteration converges for any starting point.
For and , the first few iterates are: Convergence is rapid: by iteration 4 the residual is below .
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 [16] applies the same Transformer block repeatedly to the sequence representation: (UT INIT) where is a per-step positional encoding that informs the shared block of the current iteration count, and the block is shared (weight-tied) across all steps .
Remark 10 (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) [7] 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 11.
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] employs two interacting modules at different levels of abstraction:
H-module (“system”): A large pre-trained language model that provides high-level reasoning guidance. Given the current context, it generates a latent thought token summarising the current reasoning state.
L-module (“action”): A smaller, faster model that receives as an additional conditioning signal and generates the next output token(s).
The two modules alternate: generates a thought produces tokens re-evaluates continues. Formally, at macro-step : where is the number of tokens the L-module generates before deferring back to the H-module.
Remark 12 (Manager–Worker Analogy).
HRM is reminiscent of the manager–worker pattern in hierarchical reinforcement learning. The H-module (manager) sets subgoals; the L-module (worker) executes them. By decoupling “thinking” from “doing,” HRM allows a small, efficient worker to benefit from the deep reasoning of a large, expensive manager, without running the large model at every token.
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 achieves 60% on the ARC-AGI benchmark (Abstract Reasoning Corpus), vastly outperforming DeepSeek-R1 (671B parameters, 21% 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. This represents a roughly parameter efficiency gain!
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 depthwise separable convolutions with the SwiGLU activation: (URM GATE) The full block is .
TBPTL training. Like TRM, URM trains with Truncated Backpropagation Through Loops, unrolling for steps during training.
Adaptive halting. The model monitors the entropy of its output distribution and halts when the entropy drops below a threshold, indicating high confidence.
URM achieves strong performance on both mathematical reasoning and common-sense benchmarks, demonstrating that recursive architectures scale beyond toy problems.
Remark 13 (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 entropy-based adaptive halting. 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
tab:recursive-comparison summarises the key properties of the architectures discussed in this section.
| lrllp3.5cm@ Model | Params | Recursion Type | ARC-AGI | Key Innovation |
| Standard Transformer | None | Attention mechanism | ||
| Universal Transformer | Weight sharing | - | Shared blocks + ACT | |
| DeepSeek-R1 [6] | 671B | CoT (token-level) | 21% | GRPO training |
| HRM [17] | Mixed | Hierarchical | - | H/L module separation |
| TRM [18] | 7M | Fixed-point (latent) | 60% | Tiny net + iteration |
| URM [19] | Varies | ConvSwiGLU + TBPTL | 51% | Scalable recursion |
The most striking entry in tab:recursive-comparison is TRM's performance: 60% on ARC-AGI with only 7M parameters, compared to DeepSeek-R1's 21% with 671B parameters. This 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 (Self-Reflection and Iterative Refinement), 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 ).
tab:reasoning-unification shows how every method in this chapter instantiates this framework.
| lp3.6cmp5.2cm@ Method | State Space | Operator |
| RNN (def:rnn) | 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 with work 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) and entropy-based halting in URM (Definition 19) are two mechanisms 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? ACT and entropy-based halting 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 with iterations where is polynomial in the input size? Is it exactly , or some proper subclass?
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 [6] focus on parameters; 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).
For any decision problem in , there exists a neural network of size polynomial in the input length , and a number of iterations polynomial in , such that the recursive iteration correctly solves the problem for all inputs of length . That is, latent-space recursion with a compact network is computationally universal for polynomial-time computation.
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).
Show that the GRU (Definition 1) can be viewed as a special case of the LSTM (def:lstm) in which the forget gate and input gate are coupled via and , and the output gate is always open ().
Write out the LSTM equations under these constraints and simplify.
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 and the correct answer has probability .
If we draw independent samples and take a majority vote, express the error probability as a sum involving the multinomial distribution.
Use the multiplicative Chernoff bound to show that the error probability is at most .
How many samples are needed to achieve 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
-
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
-
The Expressive Power of Transformers with Chain of Thought
BibTeX
@article{merrill2023expressive, title={The Expressive Power of Transformers with Chain of Thought}, author={Merrill, William and Sabharwal, Ashish}, journal={International Conference on Learning Representations}, year={2024} }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 Hong, Tianhao and Gu, Yuntian}, 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
-
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
-
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
-
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
-
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