Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in reasoning and generation, yet they remain prone to logical slips and hallucinations, particularly in complex or long-form tasks. To mitigate these issues, a popular decoding strategy known as Self-Consistency (SC) was introduced. Standard SC works by sampling multiple reasoning paths for a given prompt and selecting the most frequent answer via a majority vote.
While highly effective for closed-ended tasks like mathematics or multiple-choice questions where answers can be easily normalized and counted, standard SC faces a significant bottleneck: it cannot be easily applied to free-form text. In domains such as summarization, open-ended question answering, or code generation, responses rarely match word-for-word, making traditional "exact-match" voting impossible without complex regex extractors, specialized rerankers, or expensive execution environments.
The Universal Self-Consistency (USC) Framework
To address these limitations, this research introduces Universal Self-Consistency (USC). USC extends the benefits of self-consistency to any generation task by leveraging the LLM itself as the judge of consistency. Instead of relying on programmatic string matching, USC uses the model's semantic understanding to identify the "consensus" among a pool of candidate responses.
The USC Process
The method follows a straightforward three-step pipeline:
- Sampling: The model generates $k$ candidate responses using a non-zero temperature to ensure a diverse set of outputs.
- Selection Prompting: All $k$ responses are concatenated into a single prompt along with the original question.
- The "Vote": The LLM is prompted to select the single response that is most consistent with the majority of the candidates.
By asking the model to find the "most consistent" response rather than the "correct" one, USC bypasses the need for external ground truth or execution sandboxes. It relies on the observation that while an LLM might struggle to verify a single answer's absolute correctness, it is highly proficient at recognizing semantic overlap and fuzzy consensus across multiple versions of the same answer.
Applications Across Diverse Domains
USC is designed to be a general-purpose tool. The researchers demonstrated its utility across four distinct areas where standard self-consistency typically fails or requires heavy engineering:
- Mathematical Reasoning: On benchmarks like GSM8K and MATH, USC matches the performance of standard SC without requiring custom regex to extract final numerical answers.
- Code Generation: In text-to-SQL (BIRD-SQL) and Python tasks, USC achieves accuracy comparable to execution-based consistency (running the code against test cases) without ever needing to execute a single line of code.
- Long-form Summarization: For datasets like GovReport and SummScreen, USC identifies the most representative summary, consistently outperforming greedy decoding.
- Open-ended QA: On TruthfulQA, USC-selected answers were rated as significantly more truthful and informative by independent judges.
Key Results and Insights
The experimental results highlight several critical advantages of the USC approach:
- Eliminating the Execution Sandbox: One of the most striking findings was in code generation. On the BIRD-SQL benchmark, USC achieved 45.5% execution accuracy, nearly identical to the 45.6% achieved by traditional execution-based consistency. This suggests that LLMs can effectively "mentalize" code logic to find a consensus.
- Fuzzy Consensus for Lists: In tasks involving entity extraction or list generation, USC can identify a consensus even if every sample contains a slightly different set of items. It tends to select the response that includes the most frequently mentioned entities across the entire sample pool.
- Robustness: Unlike many LLM-as-a-judge tasks that are sensitive to the order of options, USC proved relatively robust to the sequence in which candidate responses were presented in the selection prompt.
Limitations and Future Directions
Despite its versatility, USC introduces new challenges. Because it requires feeding multiple candidate responses back into the model, it is constrained by the LLM's context window. This limits the number of samples ($k$) that can be evaluated simultaneously, especially for long-form documents. Additionally, the process requires an extra LLM call, increasing inference latency and cost compared to simple greedy decoding.
Future work may focus on bridging the "Oracle gap"—the difference between the USC-selected answer and the best possible answer in the sample pool. Refining selection criteria (e.g., asking for the "most detailed" vs. "most consistent") and developing methods to extract confidence scores from the selection process remain promising avenues for further research.
Summary updated