Abstract
Chain-of-Thought (CoT) reasoning is a critical capability for large language models (LLMs), enabling them to tackle complex multi-step tasks. While base LLMs, pre-trained on general text corpora, often struggle with reasoning due to a lack of specialized training, recent studies reveal their latent reasoning potential tied to hidden states. However, existing hidden state manipulation methods, such as linear activation steering, suffer from limitations due to their rigid and unconstrained nature, often leading to distribution shifts and degraded text quality. In this work, we propose a novel approach for eliciting CoT reasoning from base LLMs through hidden state manipulation grounded in probabilistic conditional generation. By reformulating the challenge as an optimization problem with a balanced likelihood and prior regularization framework, our method guides hidden states toward reasoning-oriented trajectories while preserving linguistic coherence. Extensive evaluations across mathematical, commonsense, and logical reasoning benchmarks demonstrate that our approach consistently outperforms existing steering methods, offering a theoretically principled and effective solution for enhancing reasoning capabilities in base LLMs.
Introduction
Base Large Language Models (LLMs) are pre-trained on massive text corpora, granting them impressive linguistic fluency. However, they often fail at multi-step reasoning tasks, typically providing direct but incorrect answers. While instruction fine-tuning can address this, it is resource-intensive. Recent "Representation Engineering" suggests that reasoning capabilities are latent within base models but suppressed during standard decoding. Existing steering methods, like adding fixed reasoning vectors, often degrade text quality by pushing representations off the natural language manifold. This paper proposes a gradient-based optimization approach to elicit Chain-of-Thought (CoT) reasoning while maintaining linguistic coherence.
Methodology: Gradient-Based Representation Optimization
The core idea is to treat hidden state manipulation as a probabilistic optimization problem, specifically Maximum A Posteriori (MAP) estimation. Instead of a blunt linear shift, the authors perform iterative gradient ascent on the hidden states at each step of the generation.
The method balances two primary components:
- Reasoning Likelihood ($p(c|h)$): A small Multi-Layer Perceptron (MLP) classifier is trained to distinguish between reasoning and non-reasoning states. Its gradient guides the hidden state $h$ toward a "reasoning mode."
- Linguistic Prior ($p(h)$): An L2 regularization term ensures the optimized state remains close to the original, preserving fluency and preventing the model from generating gibberish.
Optimization occurs entirely at inference time without modifying the underlying model weights, utilizing adaptive step sizes and Gaussian noise injection to explore the state space effectively.
Experimental Setup
The classifier was trained on 2,000 response pairs (CoT vs. non-CoT) generated by Mistral-7B on the GSM8K dataset. Evaluation spanned math (GSM8K, MultiArith, SVAMP, MAWPS), commonsense (C-QA, S-QA), and logic (Obj-T, C-Flip) benchmarks across various models, including Mistral-7B, Gemma-7B, Qwen1.5-4B, and Phi-1.5.
Results and Discussion
The proposed method consistently outperforms vanilla greedy decoding and several state-of-the-art linear steering baselines. For instance, it improved Gemma-7B's accuracy on MultiArith by 14.56% and Phi-1.5's by 8.89% compared to the next best steering method.
Key findings include:
- Quality Preservation: Unlike linear steering, which often leads to skyrocketing perplexity as steering strength increases, this optimization approach maintains stable fluency and text quality.
- Cross-Model Transferability: Classifiers trained on Mistral-7B data were effective at steering entirely different models like Gemma or Qwen, suggesting that "reasoning" representations may be universal across transformer-based LLMs.
- Layer Sensitivity: Optimizing the top 50% of layers (where the classifier performed best) yielded the most significant improvements.
Limitations and Conclusion
While effective, the method introduces computational overhead due to per-token optimization. Furthermore, it can only unlock existing latent capacity; it cannot instill reasoning skills absent from the base model's pre-training. Future work may explore combining this inference-time technique with post-training methods like RLHF to further amplify the reasoning capabilities of foundation models.
Summary updated