Integrate the Essence and Eliminate the Dross: Fine-Grained Self-Consistency for Free-Form Language Generation

Xinglin Wang, Yiwei Li, Shaoxiong Feng, Peiwen Yuan, Boyuan Pan, Heda Wang, Yao Hu, Kan Li

Abstract

Self-consistency (SC), leveraging multiple samples from LLMs, shows significant gains on various reasoning tasks but struggles with free-form generation due to the difficulty of aggregating answers. Its variants, UCS and USC, rely on sample selection or voting mechanisms to improve output quality. These methods, however, face limitations due to their inability to fully utilize the nuanced consensus knowledge present within multiple candidate samples, often resulting in suboptimal outputs. We propose Fine-Grained Self-Consistency (FSC) to addresses these limitations by extracting and integrating segment-level commonalities from candidate samples, enhancing the performance of LLMs both in open-ended and reasoning tasks. Based on this, we present two additional strategies: candidate filtering, which enhances overall quality by identifying highly similar candidate sets, and merging, which reduces input token requirements by combining similar samples. The effectiveness of FSC is demonstrated through extensive experiments on various tasks, including summarization, code generation, and mathematical reasoning, using GPT-3.5-turbo and GPT-4. The results indicate significant improvements over baseline methods, showcasing the potential of FSC to optimize output quality by effectively synthesizing fine-grained consensus knowledge from multiple samples.

Introduction

Large Language Models (LLMs) often benefit from a technique called Self-Consistency (SC). Usually, this involves sampling the model multiple times and taking a "majority vote" on the answer. This works effectively for mathematical reasoning where the answer is a single, verifiable number. However, it often fails for free-form generation tasks such as code synthesis or text summarization. In these domains, "voting" is impractical because no two generated samples are likely to be identical.

Existing adaptations like UCS (unigram overlap) or USC (using an LLM to select the most consistent sample) still rely on sample-level selection. They identify a single "winner" and discard the remaining candidates. This approach is inherently wasteful; a "failed" code sample might still contain a perfectly executed, complex logic segment that the selected "winner" missed. The challenge lies in "integrating the essence" of all samples while "eliminating the dross"—the errors and hallucinations.

Comparison between selection-based self-consistency and fine-grained self-consistency.

Methodology

To address the limitations of sample-level selection, the authors propose a three-part framework centered on Fine-Grained Self-Consistency (FSC).

Fine-Grained Self-Consistency (FSC)

Instead of selecting a single candidate, the LLM is prompted to act as an integrator. It receives multiple candidate responses and is instructed to identify "major consensus" segments across these samples. The model then synthesizes these high-confidence segments into a single, optimized final output.

Candidate Filtering

To prevent the integrator from being overwhelmed by "noise" or hallucinations, the system employs a filtering mechanism. Using a similarity function (such as ROUGE), it identifies a core set of highly consistent candidates. Outliers that deviate significantly from the group consensus are filtered out, ensuring the synthesis process focuses on the most reliable information.

Merging

To mitigate the computational cost (or "token tax") of processing many samples, the authors introduce a Merging strategy. Using K-Medoids clustering, semantically similar responses are grouped together. Only the "centroids"—representative samples of these clusters—are sent to the final synthesis step. This maintains the diversity of the consensus while significantly reducing the input length.

The overall framework of Fine-Grained Self-Consistency (FSC), including filtering and merging strategies.

Experimental Results

The researchers evaluated FSC across three distinct domains: Code Generation (HumanEval, HumanEval+, BIRD-SQL), Text Summarization (DailyMail, SummScreen), and Mathematical Reasoning (GSM8K, MATH).

  • Code Generation: On HumanEval, FSC improved GPT-3.5-turbo's accuracy by 4.7% and GPT-4's by 4.6% over the random baseline.
  • Summarization: FSC consistently outperformed baselines across ROUGE and BERTScore metrics, effectively "denoising" the generated summaries.
  • Mathematical Reasoning: FSC showed resilience even in reasoning tasks, proving more robust than standard voting when the majority of samples were incorrect.
  • Efficiency: The "Merge" strategy reduced input token costs by up to 53.2% on the DailyMail dataset while maintaining or improving performance.

Key Insights

A striking finding is that FSC can recover a correct answer even when 100% of the input samples are incorrect. By piecing together correct logic segments from different failed attempts, the LLM can synthesize a successful solution. This represents a paradigm shift: the LLM is no longer a "judge" picking a winner, but an "editor" compiling a "best-of-all-worlds" version.

Conclusion

Fine-Grained Self-Consistency offers a robust alternative to traditional selection-based methods for LLM output aggregation. By shifting from selection to synthesis, FSC more effectively utilizes the collective knowledge within multiple samples. While context window constraints and computational overhead remain challenges, the significant performance gains across diverse tasks—including for smaller open-source models like Mistral-7B—demonstrate its potential for optimizing free-form language generation.

Summary updated

BibTeX
@inproceedings{wang2024integrate,
  author = {Xinglin Wang and Yiwei Li and Shaoxiong Feng and Peiwen Yuan and Boyuan Pan and Heda Wang and Yao Hu and Kan Li},
  title = {{Integrate the Essence and Eliminate the Dross: Fine-Grained Self-Consistency for Free-Form Language Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.634},
}
Figure