Soft Self-Consistency Improves Language Models Agents

Han Wang, Archiki Prasad, Elias Stengel-Eskin, Mohit Bansal

Abstract

Standard Self-Consistency (SC) enhances Large Language Model (LLM) performance by selecting the most frequent answer from multiple sampled outputs. However, this approach falters in interactive agent environments where exact string matches are rare due to expansive action spaces. We present Soft Self-Consistency (SOFT-SC), a method that replaces discrete majority voting with continuous likelihood-based scoring. SOFT-SC significantly improves sample efficiency and boosts success rates by up to 6.6% on complex interactive tasks such as Bash command generation, web navigation, and household chore execution.

Introduction

Self-Consistency (SC) has become a staple technique for improving LLM reasoning by aggregating multiple sampled outputs via majority voting. While effective for closed-form tasks like math or multiple-choice questions, SC struggles when LLMs act as agents in interactive environments. In these settings, the action space is vast; for instance, a single objective in a Bash terminal can be achieved through various functionally equivalent but syntactically different commands (e.g., ls -ltr vs. ls -trl). Because standard SC relies on exact string matches to tally votes, it requires an impractical number of samples to find a "majority," leading to high latency and reduced effectiveness in long-horizon tasks.

Methodology

Soft Self-Consistency (SOFT-SC) addresses the limitations of discrete voting by utilizing the model's internal confidence.

  1. Likelihood-Based Scoring: Instead of counting occurrences, SOFT-SC calculates a continuous score for each sampled action based on token probabilities (logits). The authors explored aggregation methods including mean probability, minimum token probability, and length-normalized products.
  2. Selection Mechanism: The action with the highest likelihood score is selected, even if it appears only once in the sample set.
  3. Adaptive Sampling: To optimize computational costs, an adaptive version of SOFT-SC terminates sampling once cumulative confidence reaches a predefined threshold.
  4. Black-Box Compatibility: For models that do not expose logits (e.g., GPT-4), a smaller "white-box" model (e.g., a 7B parameter local model) can be employed to score the outputs of the larger model.

Experimental Evaluation

The method was evaluated on three interactive benchmarks: Bash (generating functional commands), WebShop (navigating e-commerce sites), and ALFWorld (executing household tasks in text-based environments).

Success rates of SOFT-SC vs. standard SC across different sample sizes (k) for Bash, WebShop, and ALFWorld.

Results and Key Insights

SOFT-SC consistently outperforms standard SC and greedy decoding across all benchmarks. Using CodeLlama-34B as a backbone, SOFT-SC achieved an 8.6% improvement over greedy decoding and a 6.6% absolute increase over SC on WebShop. In ALFWorld and Bash, success rates increased by 4.7% and 1.3%, respectively.

Main experimental results comparing Greedy decoding, Self-Consistency, and SOFT-SC across benchmarks.

A critical finding is that frequency does not equate to correctness in sparse action spaces. The model's internal probability provides a richer signal for selection than simple frequency. Furthermore, SOFT-SC is highly efficient, often achieving superior performance with half the samples required by standard SC. For example, in WebShop, SOFT-SC with $k=5$ samples outperforms standard SC with $k=10$.

The study also demonstrated that SOFT-SC scales effectively with model size. Notably, a 13B model using SOFT-SC can outperform a 34B model using standard SC, suggesting that sophisticated selection logic can compensate for smaller model capacity. Additionally, the method is robust; it does not require perfect model calibration, as long as the model can effectively rank its own generated options.

Conclusion

SOFT-SC provides a robust and efficient framework for improving LLM agents in interactive environments. By leveraging continuous likelihood scores rather than discrete votes, it overcomes the "exact match" bottleneck of traditional self-consistency. While it remains more computationally expensive than greedy decoding, its significant gains in success rate and sample efficiency make it a compelling choice for complex agentic workflows.

Summary updated

BibTeX
@inproceedings{wang2024soft,
  author = {Han Wang and Archiki Prasad and Elias Stengel-Eskin and Mohit Bansal},
  title = {{Soft Self-Consistency Improves Language Models Agents}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-short.28},
}
Figure