Algorithmic Thinking Theory

MohammadHossein Bateni, Vincent Cohen-Addad, Yuzhou Gu, Silvio Lattanzi, Simon Meierhans, Christopher Mohri · DOI

Abstract

This paper introduces a formal theoretical framework for "reasoning algorithms"—iterative processes like Self-Consistency or Tree of Thoughts that boost Large Language Model (LLM) performance during inference. By modeling LLMs as "reasoning oracles" with specific decay properties, we prove which algorithms are optimal for synthesizing correct answers and establish convergence rates to peak accuracy. This work provides a mathematical foundation for the emerging practice of scaling inference-time compute.

Introduction: The Need for a Theory of Reasoning

The "pass@k" phenomenon demonstrates that LLMs often possess latent capabilities that are not captured in a single forward pass. While a model might fail a difficult math problem on the first attempt (pass@1), it may succeed given multiple independent trials. However, for "Grand Challenge" problems, such as those in the International Mathematical Olympiad (IMO), simple selection from a set of samples is insufficient.

Recent breakthroughs (e.g., OpenAI’s o1, Google’s AlphaProof) suggest that the true power of LLMs lies in synthesis. By iteratively refining, verifying, and aggregating multiple "chains of thought," models can reach conclusions unreachable in isolation. This is often referred to as "System 2" reasoning or "scaling inference-time compute." Despite its success, we lack a formal theory to explain why these iterative pipelines work or how to design them efficiently. This paper addresses this gap by formalizing the balance between "parallel branching" and "sequential depth."

Theoretical Framework: The Reasoning Oracle

We formalize the LLM as a Reasoning Oracle ($\mathcal{A}$). This oracle takes a "context" $C$ of previously generated solutions and produces a new one. Its success is governed by a transfer function ($\mathcal{F}$), which determines the probability of the next answer being correct based on the quality and quantity of answers in the context.

Modeling Decay and Monotonicity

To ensure the theory is grounded in reality, we introduce Decaying Models. Unlike a "Uniform Model" where more context is always beneficial, Decaying Models account for the fact that LLMs can be distracted. If a correct solution is buried under a mountain of incorrect ones, the model's performance may actually drop.

We also define strong monotonicity: the property where adding more correct solutions to a context never hurts performance. If an oracle is monotone, the optimal strategy is to utilize the maximum allowed context size.

Analysis of Reasoning Algorithms

The authors analyze three main classes of reasoning algorithms:

  1. Branching Algorithm: A tree-like structure where groups of independent solutions are merged at each level.
  2. Genetic Algorithm: A resource-efficient version that reuses solutions from a "population," similar to Recursive Self-Aggregation (RSA) methods.
  3. Random Sampling Algorithm: A baseline approach that generates new solutions by sampling from the entire history of previous outputs.

Key Theoretical Insights

  • Synthesis > Selection: The latent capability of LLMs is distributed across multiple, individually flawed chains of thought. Reasoning algorithms aim to synthesize these into a single correct answer.
  • The Optimality of Branching: For a wide class of decaying models, the Branching Algorithm is proven to be optimal. It achieves maximum success probability by maintaining independence between solution paths.
  • The "Sliding Window" Trap: A common heuristic is to provide the $k$ most recent solutions as context. We prove this is sub-optimal because it introduces correlations that eventually lead to "overthinking" and performance collapse.

Empirical Validation

While primarily theoretical, the assumptions are grounded in experiments using:

  • AIME 2025: A dataset of 30 challenging math problems released after the model's training cutoff to prevent data contamination.
  • Gemini 2.5 Pro: Used as the base oracle to test context effects.
  • IMO 2025: Referenced as the benchmark for high-stakes reasoning tasks.

In experiments on AIME problems, the authors found that adding incorrect solutions to a context containing one correct solution caused a measurable "decay" in accuracy. This confirms that LLMs are sensitive to noise, justifying the use of Decaying Models.

Results and Convergence

  • Convergence Rates: The paper provides rigorous bounds on the number of oracle calls ($n$) needed to reach optimal accuracy. For Genetic Algorithms, the error decays at a rate of $1/\sqrt{n}$.
  • Fixed-Point Success: The maximum achievable success probability is the "fixed point" of the transfer function. For example, in an exponential decay model, the maximum accuracy is $2 - 1/q$ (where $q$ is a model-specific parameter).

Limitations and Future Work

The current framework utilizes a binary scoring model (solutions are either correct or incorrect). Future work will focus on:

  1. Fine-grained Scores: Modeling how "partially correct" steps or lemmas can be combined.
  2. Answer Diversity: Incorporating measures of diversity, as combining different correct solutions is more valuable than combining identical ones.

By providing the first rigorous "Algorithmic Thinking Theory," this work moves AI engineering closer to the precision of traditional software algorithms.

Summary updated

BibTeX
@inproceedings{bateni2026algorithmic,
  author = {MohammadHossein Bateni and Vincent Cohen-Addad and Yuzhou Gu and Silvio Lattanzi and Simon Meierhans and Christopher Mohri},
  title = {{Algorithmic Thinking Theory}},
  booktitle = {Conference on Learning Theory},
  year = {2026},
}
Figure