# A Solvable Model of Chain-of-Thought in In-Context Learning

*Kaito Takanami, Cengiz Pehlevan*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/154777) · [OpenReview](https://openreview.net/forum?id=B3HqjP2biY) · [Open on the map](../papers.html#p154777)

Category: [LLM Reasoning, Memory & RAG](../pcat/19.md) › [Chain-of-Thought Reasoning](../pgroup/428.md) · Type: theory · Keywords: chain-of-thought reasoning, in-context learning, generalization error, phase transition, random matrix theory

Areas: [LLM Reasoning](../areas/reasoning.md) › Reasoning Mechanisms › Chain-of-Thought Reasoning

## Summary
We develop a solvable theoretical model of chain-of-thought reasoning for in-context learning that yields an exact formula for generalization error and reveals phase transitions in reasoning depth.

## Explained to a 5-year-old
We study how a computer brain can think out loud when answering questions. It writes down small steps, like a story, to get the answer right. We made a simple math model to see how many steps help. The model shows that sometimes more steps are good, sometimes not. This helps us understand when to use many steps and when to stop.

## Explained to a 5-year-old, longer
We look at a special kind of computer brain that can think before answering. It writes down little steps, like a chain of thoughts, to help itself solve problems. The researchers made a simple math model that works like a puzzle to study this thinking. In the model, the brain tries to guess a number by improving its guess step by step. They found that sometimes adding more steps makes the guess much better, and sometimes it does not help. They also discovered that if the brain has learned a lot, more steps are useful, but if it has learned little, too many steps can make mistakes. The model shows a clear change where the benefit jumps from small to big. This helps us understand why some problems need many steps and others need few. The findings were checked on other computer brains that work like the model. This gives us a better idea of how to use step-by-step thinking in real computers. Overall, the study explains when thinking more helps and when it might hurt.

## For a technical reader
The paper investigates how giving a language model extra reasoning steps at inference time influences its accuracy. They create a simplified mathematical model that captures this process and derive an exact formula for the model’s error. Using random matrix theory, they uncover distinct regimes where deeper reasoning either dramatically improves performance or leads to saturation and overthinking. The analysis also shows how the amount of pretraining data and context length affect the optimal number of reasoning steps. Finally, they validate the theoretical predictions on learned attention models, confirming the model’s practical relevance.

## Problem
The scaling behavior of generalization with chain-of-thought depth in in-context learning is not well understood.

## Method
We formulate a solvable model of chain-of-thought reasoning for in-context weight prediction in linear regression, derive an exact generalization error formula using random matrix theory under high-dimensional asymptotics, and analyze phase transitions and optimal depth scaling.

## Results
The approach uncovers a sharp phase transition between exponential and polynomial gains in generalization as reasoning depth increases, identifies regimes of saturation and overthinking, and shows that optimal depth depends on pretraining data and context size; experiments on linear and softmax attention models confirm these theoretical predictions.

## Contributions
We provide a theoretically solvable model of chain-of-thought reasoning for in-context learning, derive an exact generalization error formula, and characterize depth-dependent scaling behavior and phase transitions; we also empirically validate the theory on attention-based models.

## Limitations and assumptions
The model assumes linear regression and high-dimensional asymptotics, which may not capture all aspects of large language models; results are validated only on linear and softmax attention models.

## Research questions this paper is counted under

- [Do different components of deep models contribute equally to generalization when trained end-to-end?](../q/160.md)

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/154777)
