Universal Self-Consistency for Large Language Models

Xinyun Chen, Renat Aksitov, Uri Alon, Jie Ren, Kefan Xiao, Pengcheng Yin, Sushant Prakash, Charles Sutton, Xuezhi Wang, Denny ZhouICL @ ICML 2024

TL;DR

This paper introduces Universal Self-Consistency (USC), a novel method that enables large language models (LLMs) to select the most consistent answer from multiple generated responses, even for free-form text. USC significantly improves performance on tasks like open-ended question answering and summarization, while matching existing methods on tasks like math and code generation, all without requiring complex answer extraction or execution.

What Problem Does This Paper Address?

Large Language Models (LLMs) have shown impressive capabilities across various domains, but their outputs can still be error-prone, especially for complex tasks. A common technique to improve LLM performance is "self-consistency," which involves generating multiple reasoning paths (e.g., using Chain-of-Thought prompting) and then selecting the most frequent final answer. This approach has been highly effective for tasks with well-defined, extractable answers, like multiple-choice questions or numerical math problems. However, this method breaks down for tasks requiring free-form generation, such as writing code, summarizing text, or answering open-ended questions, because there's no simple way to "count" or aggregate these diverse outputs. This limitation prevents a powerful performance-boosting technique from being applied to a wide range of important LLM applications.

Methods

The core innovation is Universal Self-Consistency (USC). Instead of relying on external heuristics or exact matching to aggregate answers, USC leverages the LLM itself to perform the selection. The process is as follows:

  1. Sample Multiple Responses: The LLM generates several candidate answers for a given prompt.
  2. Prompt for Consistency: These candidate responses are then fed back into the LLM, along with a specific instruction asking it to identify and select the most consistent response among them.

This approach bypasses the need for predefined answer formats or execution results. The LLM acts as both the generator and the "judge" of consistency, making it applicable to any task where multiple diverse outputs can be produced. The authors found that LLMs are surprisingly adept at judging consistency, even when they might struggle with directly assessing correctness.

Datasets

The paper evaluates USC on a variety of established benchmarks:

  • Mathematical Reasoning: GSM8K (grade school math), MATH (high school competitions).
  • Code Generation: BIRD-SQL (text-to-SQL), ARCADE (Python code generation).
  • Long-Context Summarization: GovReport, SummScreen (from ZeroSCROLLS).
  • Open-Ended Question Answering: TruthfulQA.

No new datasets were introduced.

Key Insights and Ideas

  • LLMs as Consistency Judges: The most significant insight is that LLMs can effectively evaluate the consistency of their own generated outputs, even for free-form text, without explicit rules or external tools. This is a more generalizable approach than traditional self-consistency.
  • Bridging the Free-Form Gap: USC directly addresses the limitation of standard self-consistency, opening up its benefits to a much wider array of generative tasks.
  • Simplicity and Generality: USC is remarkably simple to implement, requiring only an additional LLM query with a specific prompt. Its generality means it can be applied across diverse domains without task-specific engineering.
  • Robustness to Order: Unlike some LLM evaluation methods that suffer from positional bias, USC appears robust to the order in which candidate responses are presented.

Key Results

USC demonstrates strong performance across various tasks:

  • Open-Ended Generation: For tasks like TruthfulQA and summarization (GovReport, SummScreen), USC consistently outperforms greedy decoding and random sampling, showing significant gains in truthfulness, informativeness, and summary quality. For example, on TruthfulQA, USC achieved higher truthfulness (67.7% for PaLM 2-L, 82.5% for GPT-3.5-turbo) compared to baselines.
  • Mathematical Reasoning: On GSM8K and MATH, USC achieves performance comparable to standard self-consistency (e.g., 90.2% accuracy on GSM8K with PaLM 2-L, very close to standard SC's 90.4%). Crucially, USC does this without needing to parse answers into a specific format.
  • Code Generation: On BIRD-SQL and ARCADE, USC matches the performance of execution-based self-consistency, even though USC does not utilize code execution for its selection process. For BIRD-SQL, USC achieved 45.5% execution accuracy, very close to SC-Exec's 45.6%.

Limitations and Future Work

  • Context Length Dependency: USC's ability to handle multiple samples is limited by the LLM's context window. While this is becoming less of an issue with advancements in long-context LLMs, it remains a constraint.
  • No Explicit Confidence Measure: Standard self-consistency provides a confidence score based on vote counts. USC, in its current form, does not directly provide such a confidence measure. The authors suggest developing calibration mechanisms for future work.
  • Inference Cost: USC requires an additional LLM query for selection, increasing inference costs. Future work could explore using lighter models for USC or optimizing the prompt.
  • Consistency vs. Correctness: While consistency is a good heuristic, the most consistent answer isn't always the best or most correct one. The authors acknowledge a gap between USC and "oracle" performance (where the best answer is known) and suggest task-specific adaptations to further improve results. They also note that while USC generally aligns with standard SC, there are cases where USC selects a different response, sometimes leading to better outcomes.

Summary updated

BibTeX
@inproceedings{chen2024universal,
  author = {Xinyun Chen and Renat Aksitov and Uri Alon and Jie Ren and Kefan Xiao and Pengcheng Yin and Sushant Prakash and Charles Sutton and Xuezhi Wang and Denny Zhou},
  title = {{Universal Self-Consistency for Large Language Models}},
  booktitle = {ICL @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=LjsjHF7nAN},
}
Figure