How does a "reflexive" algorithm like model-free reinforcement learning (RL) produce something as sophisticated as "thinking"? We have seen this phenomenon recently with Large Language Models (LLMs) like DeepSeek-R1, where model-free RL incentivizes the model to generate long chains of thought before providing an answer.
From a classical RL perspective, this presents a puzzle: "thinking" actions—such as generating intermediate reasoning tokens—do not change the external environment state, nor do they provide immediate rewards. So why would an RL agent ever choose to execute them? A recent paper from researchers at UW–Madison provides a formal theoretical framework to answer this question, demonstrating that "thinking" emerges in model-free RL as a way to unlock better sub-policies already hidden within an agent's initialization.
The Core Problem: Reward and Initialization
In cognitive science, Dual Process Theory distinguishes between System 1 (fast, intuitive, reflexive) and System 2 (slow, deliberate, logical). Traditionally, model-free RL is viewed as a System 1 process, while model-based planning (like Monte Carlo Tree Search) is seen as System 2. However, recent breakthroughs in LLMs show System 2-like reasoning emerging purely from model-free RL.
The authors tackle two primary questions regarding this emergence:
- The Reward Paradox: If thinking actions produce no reward and delay the final answer (incurring a "time cost" via discounting), why does RL select them?
- The Initialization Problem: What must be true about an agent before RL starts for thinking to emerge as a viable strategy?
Theoretical Framework: Thought MDPs
To formalize this, the researchers introduce the Thought Markov Decision Process (Thought MDP). This is a minimal extension of a standard MDP that adds two key components:
- Thought States ($T$): Internal states that the agent can control.
- Thought Actions ($C$): Actions that change the internal thought state but do not change the external world or provide external reward.
Using this model, the authors prove that while a perfectly optimal policy would never need to think (it would just act perfectly immediately), thinking is a powerful transient strategy. Mathematically, a thought action is equivalent to the agent choosing to perform a step of internal policy improvement before acting in the environment.
Key Insights
- Thinking as a Pointer: Thinking actions do not "create" new logic from scratch during an episode. Instead, they manipulate the agent's internal state to point toward a better sub-policy that the agent already "knows" how to execute.
- The Importance of Pre-training: For thinking to emerge, the agent must be initialized with a "messy" policy containing both good and bad strategies. Thought actions allow the agent to navigate away from the bad strategies toward the good ones.
- Horizon Reduction: Thinking reduces the "effective horizon" of a problem. It is often easier for RL to learn a sequence like "Action A -> Think -> Better Policy" than to learn a single, massive, perfect policy for every possible state.
Empirical Results
To validate their theory, the researchers tested various open-source LLMs (including Llama-2, Qwen2.5, Gemma-3, and Mistral) on multi-step addition problems. They compared a "No Thinking" approach (forcing a direct answer) against a "Thinking" approach (forcing a step-by-step breakdown).
The empirical results strongly support the "Thinking as Policy Improvement" theory. Forcing LLMs to think led to massive performance gains. For example, Qwen2.5-14B-Instruct jumped from a dismal 0.9% accuracy without thinking to 95.2% accuracy with thinking.
Furthermore, the authors built a custom Gridworld toy domain to demonstrate how multi-task pre-training creates the sub-policies that RL later learns to trigger via thought actions. In these experiments, agents allowed to "think" reached 100% success rates significantly faster than agents trained from scratch or those forbidden from using thought actions. Interestingly, thinking persisted even as the policy converged; once an agent found a reliable "Think then Act" strategy, it stopped exploring the technically faster "Act Immediately" path due to sampling error.
Limitations and Future Work
The paper notes a few limitations to this framework:
- Static Worlds: The model assumes the environment does not change while the agent is thinking. In dynamic environments (like autonomous driving), the time cost of thinking might be too high.
- Bounded Capacity: For agents with limited neural capacity, thinking might be a permanent necessity to "swap" different skills into active memory, rather than just a transient learning strategy.
- Discovery of Thought Actions: In LLMs, "thought actions" are predefined as language tokens. A major open question for future research is how an agent might autonomously discover its own internal "mental actions" in non-linguistic domains, such as robotics.
Summary updated