Calibrating Reasoning in Language Models with Internal Consistency

Zhihui Xie, Jizhou Guo, Tong Yu, Shuai Li · OpenReview

Abstract

Large language models (LLMs) have demonstrated impressive capabilities in various reasoning tasks, aided by techniques like chain-of-thought (CoT) prompting that elicits verbalized reasoning. However, LLMs often generate text with obvious mistakes and contradictions, raising doubts about their ability to robustly process and utilize generated rationales. In this work, we investigate CoT reasoning in LLMs through the lens of internal representations, focusing on how these representations are influenced by generated rationales. Our preliminary analysis reveals that while generated rationales improve answer accuracy, inconsistencies emerge between the model's internal representations in middle layers and those in final layers, potentially undermining the reliability of their reasoning processes. To address this, we propose internal consistency as a measure of the model's confidence by examining the agreement of latent predictions decoded from intermediate layers. Extensive empirical studies across different models and datasets demonstrate that internal consistency effectively distinguishes between correct and incorrect reasoning paths. Motivated by this, we propose a new approach to calibrate CoT reasoning by up-weighting reasoning paths with high internal consistency, resulting in a significant boost in reasoning performance. Further analysis uncovers distinct patterns in attention and feed-forward modules across layers, providing insights into the emergence of internal inconsistency. In summary, our results demonstrate the potential of using internal representations for self-evaluation of LLMs.

Introduction

Chain-of-Thought (CoT) prompting has significantly enhanced the reasoning capabilities of Large Language Models (LLMs) by allowing them to generate intermediate steps toward a solution. Despite these gains, LLMs frequently suffer from "unfaithful reasoning," where the generated rationale is logically disconnected from or contradicts the final answer. This phenomenon undermines trust in model outputs, especially in complex reasoning domains.

Traditional methods for estimating model confidence, such as output token probabilities, are often poorly calibrated for reasoning tasks. They reflect the model's certainty at the final layer but ignore the stability of the underlying logical process. This paper introduces Internal Consistency (IC), a training-free metric that evaluates the reliability of a reasoning path by measuring the agreement between intermediate layer representations and the final output.

Methodology

The proposed Internal Consistency metric leverages the "logit lens" technique to decode latent predictions from the hidden states of every intermediate layer in the transformer.

Overview of Internal Consistency (IC) calculation and its correlation with answer correctness.

Defining Internal Consistency

IC is calculated as the percentage of layers whose latent predictions match the model's final answer for a given reasoning path. A high IC score suggests that the model's internal state converged on the answer early and remained stable, whereas a low score indicates internal conflict or a "last-minute" change in the predicted token.

SC+IC: Calibrated Self-Consistency

The authors propose an enhanced version of the Self-Consistency (SC) decoding strategy. In standard SC, the final answer is determined by a simple majority vote among multiple sampled reasoning paths. In SC+IC, each path's vote is weighted by its Internal Consistency score. This approach prioritizes reasoning chains that exhibit stable internal logic over those that appear internally conflicted. Additionally, the researchers explored a "tuned" version where specific layers (typically middle to late-middle) are given more weight based on their historical predictive accuracy.

Experimental Evaluation

The effectiveness of Internal Consistency was tested across four diverse reasoning benchmarks: BoolQ (reading comprehension), CoinFlip (symbolic reasoning), and PrOntoQA and ProofWriter (logical deduction). The study utilized several open-source model families, including Llama-2, Mistral, and Mixtral.

Results and Analysis

The experimental results confirm that Internal Consistency is a robust indicator of reasoning accuracy and provides superior calibration compared to standard logit-based methods.

Statistical analysis of IC calibration, layer-wise agreement patterns, and distribution discrepancy.

Key Insights

  • Accuracy Improvements: Implementing SC+IC led to consistent performance boosts of 1.8% to 4.9% across various models and tasks.
  • The CoT Paradox: While CoT prompting improves final accuracy, it can paradoxically increase internal inconsistency as the long rationale provides more opportunities for internal representations to drift.
  • Mechanistic Misalignment: Analysis of attention and feed-forward modules suggests that middle layers focus on logical tokens, while final layers can be dominated by specific "value vectors" in Feed-Forward Networks (FFNs) that may override the logic.
  • Efficiency and Transferability: SC+IC is highly sample-efficient, reaching high accuracy with fewer reasoning paths. Furthermore, the optimal layer weights learned on one task were found to transfer effectively to others, suggesting a universal property of model reasoning.

Conclusion

Internal Consistency provides a powerful, "white-box" mechanism for self-evaluation in LLMs. By looking "under the hood" at intermediate activations, we can significantly improve the reliability and calibration of complex reasoning. While currently requiring access to internal model states, this research paves the way for more transparent and trustworthy AI systems.

Summary updated

BibTeX
@inproceedings{xie2024calibrating,
  author = {Zhihui Xie and Jizhou Guo and Tong Yu and Shuai Li},
  title = {{Calibrating Reasoning in Language Models with Internal Consistency}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=udZKVMPf3S},
}
Figure