Abstract: When leveraging language models for reasoning tasks, generating explicit chain-of-thought (CoT) steps often proves essential for achieving high accuracy in final outputs. In this paper, we investigate if models can be taught to internalize these CoT steps. To this end, we propose a simple yet effective method for internalizing CoT steps: starting with a model trained for explicit CoT reasoning, we gradually remove the intermediate steps and finetune the model. This process allows the model to internalize the intermediate reasoning steps, thus simplifying the reasoning process while maintaining high performance. Our approach enables a GPT-2 Small model to solve 9-by-9 multiplication with up to 99% accuracy, whereas standard training cannot solve beyond 4-by-4 multiplication. Furthermore, our method proves effective on larger language models, such as Mistral 7B, achieving over 50% accuracy on GSM8K without producing any intermediate steps.
Introduction
Chain-of-Thought (CoT) prompting has revolutionized the way large language models (LLMs) handle complex reasoning tasks. By "thinking out loud," models can decompose difficult problems into manageable steps, significantly boosting accuracy. However, this performance gain comes with a substantial "CoT tax": increased latency and computational cost due to the sequential generation of intermediate tokens. This research investigates whether models can learn to internalize these reasoning steps, achieving CoT-level accuracy without the overhead of explicit token generation.
The Stepwise Internalization Method
The core contribution of this work is a curriculum learning approach termed Stepwise Internalization. Instead of attempting to train a model to jump directly from a question to an answer—a task that often fails for complex logic—the authors propose a gradual transition.
The process begins with a model trained on Explicit CoT, where every reasoning step is generated. Subsequently, the model undergoes a series of finetuning stages where tokens are progressively removed from the beginning of the reasoning chain. By removing tokens from the start, the model is forced to distribute the initial reasoning workload into its hidden states across the input tokens.
To maintain training stability during this transition, two key techniques were employed:
- Removal Smoothing: Introducing a small random offset to the number of tokens removed prevents sudden spikes in the loss function.
- Optimizer Resets: Resetting the AdamW optimizer states at each removal stage clears stale gradient information, allowing the model to adapt more effectively to the shortened reasoning path.
Experimental Evaluation
The researchers tested this method on two challenging domains: multi-digit multiplication (up to 9x9) and the GSM8K grade-school math benchmark. These tasks typically require significant "scratchpad" space for small models to succeed.
Key Findings
The results demonstrate that even small models possess untapped reasoning potential. A GPT-2 Small (117M parameters) model, which typically fails at 4x4 multiplication without CoT, achieved a remarkable 99% accuracy on 9x9 multiplication after internalization. This internalized model operated up to 11 times faster than its explicit CoT counterpart.
On the GSM8K benchmark, a Mistral 7B model achieved 51% accuracy with zero intermediate steps. Notably, this outperformed GPT-4's direct-answer performance (44%), suggesting that internalization allows models to utilize their internal parameters more efficiently than standard direct-response training.
The research also highlights a flexible accuracy-speed trade-off. Developers can choose to stop the internalization process at a "Partial CoT" stage, retaining a few summary tokens to maintain higher accuracy while still significantly reducing latency compared to full CoT.
Limitations and Conclusion
While promising, Stepwise Internalization faces challenges. The multi-stage finetuning process is computationally intensive, and the resulting "black box" reasoning lacks the interpretability of explicit CoT. Furthermore, "aggressive" removal schedules can lead to performance collapse if the model is not given enough time to adapt.
In conclusion, this work proves that the benefits of Chain-of-Thought reasoning can be internalized into a model's hidden states. By teaching models to "think internally," we can bridge the gap between the high accuracy of slow, explicit reasoning and the efficiency of fast, direct response.
Summary updated