Enhancing Language Model Reasoning via Weighted Reasoning in Self-Consistency

Tim Knappe, Ryan Li, Ayush Chauhan, Kaylee Chhua, Kevin Zhu, Sean O'Brien

Abstract

While large language models (LLMs) have rapidly improved their performance on a broad number of tasks, they still often fall short on reasoning tasks. As LLMs become more integrated in diverse real-world tasks, advancing their reasoning capabilities is crucial to their effectiveness in nuanced, complex problems. Wang et al.'s self-consistency framework reveals that sampling multiple rationales before taking a majority vote reliably improves model performance across various closed-answer reasoning tasks. Standard methods based on this framework aggregate the final decisions of these rationales but fail to utilize the semantic information detailed in the step-by-step reasoning paths. Our work introduces semantic self-consistency, enhancing this approach by incorporating and analyzing both the reasoning paths of these rationales in addition to their final decisions before taking a majority vote. These methods not only improve the reliability of reasoning paths but also cause more robust performance on complex reasoning tasks.

Introduction: The Logic-Blindness of Standard Self-Consistency

Large Language Models (LLMs) frequently encounter difficulties with complex reasoning, often producing "hallucinations" or logical inconsistencies. To mitigate these issues, researchers employ Chain-of-Thought (CoT) prompting and Self-Consistency (SC) frameworks. Standard SC involves sampling multiple outputs for a single query and selecting the most frequent final answer via majority voting.

However, standard SC is fundamentally "logic-blind." It treats the intermediate reasoning steps—the rationales—as a black box, focusing solely on the final output string. This approach fails when a model arrives at a correct answer through flawed logic or when multiple distinct reasoning paths converge on the same incorrect answer. The semantic content of these reasoning steps contains valuable signals that are discarded in traditional majority voting.

The Semantic Self-Consistency Framework

To address these limitations, we propose Semantic Self-Consistency, a framework that shifts from simple frequency counting to semantic weighting and filtering. The pipeline consists of three primary stages: generation, featurization, and aggregation.

The Semantic Self-Consistency pipeline, illustrating the flow from rationale generation to vector embedding and final aggregation.
  1. Generate: The model produces multiple reasoning paths (rationales) using CoT prompting.
  2. Embed: A "featurizer" model (such as SciBERT for mathematical domains or RoBERTa for general logic) converts the entire reasoning path into a high-dimensional vector.
  3. Weight & Filter: Algorithmic weighting is applied to these vectors to determine the final answer.

Weighting and Filtering Strategies

We introduce two primary weighting methods and an outlier removal process:

  • Centroid Proximity Weighting (CPW): This method calculates the centroid of all reasoning paths in the vector space. Rationales closer to this "average" logic are assigned higher weights.
  • Semantic Consensus Weighting (SCW): This approach uses cosine similarity to measure the agreement between a rationale and all others in the sample set, rewarding the most "consensual" logic.
  • Outlier Removal: Classical machine learning techniques, including K-Nearest Neighbors (KNN), Isolation Forests, and One-class SVMs, are used to identify and discard "degenerate" or hallucinated paths before the final vote.

Experimental Evaluation

The framework was evaluated across three benchmarks: AQuA-RAT (algebraic word problems), SVAMP (math word problems with varied phrasing), and StrategyQA (multi-step strategic reasoning). We tested several models, including Llama 2, Mistral 7B, GPT-3.5, Llama 3 8B, and GPT-4o mini.

Results and Analysis

Our results demonstrate that Semantic Consensus Weighting (SCW) consistently outperforms the standard Self-Consistency baseline across various models and tasks.

Performance comparison of standard Self-Consistency (SC) versus the proposed Semantic Consensus Weighting (SCW) and Centroid Proximity Weighting (CPW) across various models and benchmarks.

Key findings include:

  • Significant Accuracy Gains: Llama 2 7B achieved a 13.53% accuracy boost on StrategyQA using SCW. Similarly, GPT-3.5 saw a 7.89% improvement on the same dataset.
  • Clustering of Truth: Correct reasoning paths tend to cluster together in vector space, while hallucinations appear as idiosyncratic outliers. By identifying these clusters, the framework can find the correct answer even when raw majority votes are close.
  • Effective Outlier Detection: Pruning reasoning paths using an Isolation Forest led to a dramatic performance increase for Llama 3 8B on AQuA-RAT, rising from 45.28% to 72.25%.
  • Efficiency at Scale: Semantic filtering remains effective even with a small number of samples (e.g., $k=10$), offering a more computationally efficient alternative to high-sample standard SC.

Conclusion and Future Work

Semantic Self-Consistency provides a robust mechanism for improving LLM reasoning by analyzing the "how" behind the "what." While the method introduces some computational overhead due to the embedding process, the gains in reliability are substantial. Future work will address the "short sequence" problem, where brief rationales lack sufficient semantic information for effective embedding, and explore more advanced featurization models tailored for abstract logical structures.

Summary updated

BibTeX
@inproceedings{knappe2024enhancing,
  author = {Tim Knappe and Ryan Li and Ayush Chauhan and Kaylee Chhua and Kevin Zhu and Sean O'Brien},
  title = {{Enhancing Language Model Reasoning via Weighted Reasoning in Self-Consistency}},
  booktitle = {MATH-AI @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=2w0CIzWlle},
}
Figure