Calibrating Reasoning in Language Models with Internal Consistency

Zhihui Xie, Jizhou Guo, Tong Yu, Shuai Li

Large language models (LLMs) have demonstrated impressive capabilities in complex problem-solving, largely thanks to techniques like Chain-of-Thought (CoT) prompting. By asking a model to "think step-by-step," we elicit verbalized reasoning that often leads to better answers. However, this process is not foolproof. LLMs frequently suffer from a "faithfulness" problem: they might generate a perfectly logical-looking explanation that leads to a wrong answer, or a nonsensical explanation that coincidentally ends in the correct one.

Current methods for estimating a model's confidence typically rely on the probability of the final output token (logits). Unfortunately, these final-layer probabilities do not reveal whether the underlying reasoning process was sound. To address this, researchers have investigated the internal representations of LLMs, discovering a phenomenon called "internal inconsistency"—where a model’s middle layers often disagree with its final output. By measuring this disagreement, we can better estimate a model's true confidence and significantly boost reasoning accuracy.

The Concept of Internal Consistency

The authors identify a specific failure mode in LLM reasoning: the model's internal representations in the middle layers might actually "know" the right answer, but the later layers become distracted by errors introduced in the generated rationale, leading to an incorrect final prediction.

To quantify this, the researchers propose a novel, off-the-shelf calibration metric called Internal Consistency (IC).

Illustration of Internal Consistency calculation and its distribution for correct vs. wrong answers.

Here is how the IC metric is calculated and applied:

  1. The Logit Lens: Instead of only looking at the final layer's output, the researchers use the "logit lens" technique to decode "latent predictions" from every intermediate layer of the Transformer.
  2. Measuring Agreement: For a given reasoning path, they calculate the percentage of layers whose latent predictions match the final stated answer. High agreement indicates high internal consistency.
  3. SC+IC (Self-Consistency + Internal Consistency): Standard "Self-Consistency" works by sampling multiple reasoning paths and taking a majority vote. The authors improve this by weighting each vote based on its Internal Consistency score. If a reasoning path shows high agreement across all its internal layers, its "vote" carries more weight.
  4. Layer Weighting: The method can be further refined by learning which specific layers are the most "trustworthy" for different types of tasks, rather than treating all layers equally.

Key Insights: Middle-Layer Wisdom and Misalignment

The study evaluated several popular open-source models (including Llama-2, Mistral, and Mixtral) across diverse reasoning benchmarks like BoolQ, CoinFlip, PrOntoQA, and ProofWriter. The analysis revealed several fascinating dynamics within the Transformer architecture:

  • The CoT Paradox: Surprisingly, while Chain-of-Thought improves final accuracy, it actually increases internal inconsistency. The process of verbalizing a rationale seems to introduce noise that can confuse the model's internal layers.
  • Middle-Layer Wisdom: Middle layers often capture the "truth" of a problem more reliably than the final layers. If the middle layers and final layers disagree, the model is likely hallucinating or following a flawed reasoning path.
  • Structural Misalignment: By analyzing the Transformer components, the authors found that middle layers focus heavily on the query and rationale (via Attention mechanisms), while final layers are dominated by "value vectors" in the Feed-Forward Networks (FFN) that drive the final token. Inconsistency emerges when these two systems fail to align.
Heatmap and probe accuracy showing layer-wise dynamics during reasoning steps.

Results and Future Directions

The proposed SC+IC method consistently outperformed standard majority voting and other logit-based confidence measures. Across various models and tasks, SC+IC improved reasoning performance by 1.8% to 4.9%. Furthermore, the Internal Consistency score proved to be a highly reliable indicator of whether an answer was actually correct, requiring zero training of a separate "judge" model or human annotations.

While these results are promising, the study focused exclusively on decoder-only models. Future work will need to explore how Internal Consistency applies to encoder-decoder architectures and how it behaves with more complex prompting strategies like "Tree of Thoughts." Additionally, because the very first layers of an LLM are often too noisy to provide meaningful latent predictions, refining the filtering of these early layers could yield even stronger calibration metrics.

Ultimately, peeking under the hood at an LLM's internal consistency offers a powerful, unsupervised way to make AI reasoning more reliable and interpretable.

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