Abstract
Standard Self-Consistency (SC) relies on majority voting to select the best answer from multiple language model samples. While effective for closed-form tasks, this approach often fails in complex agentic environments where multiple valid actions may be syntactically distinct. We present Soft Self-Consistency (SOFT-SC), a method that replaces discrete voting with continuous scoring based on model likelihoods. Our evaluation across Bash, WebShop, and ALFWorld benchmarks demonstrates that SOFT-SC significantly improves success rates and sample efficiency, even allowing smaller open-source models to enhance the performance of larger "black-box" models like GPT-4.
Introduction
Large Language Models (LLMs) acting as agents must navigate vast action spaces, often generating code or multi-step commands. The current standard for improving reliability, Self-Consistency (SC), uses a majority vote over $k$ samples. However, in agentic tasks, the "exact match" requirement of SC becomes a bottleneck. For instance, in shell command generation, ls -ltr and ls -trl are functionally identical but fail to group together in a standard vote. This lack of consensus often forces a reliance on high sample counts, increasing latency and cost.
Methods: From Voting to Scoring
SOFT-SC shifts the selection process from frequency-based voting to likelihood-based scoring. The process involves three steps:
- Sampling: Generate $k$ candidate actions via temperature sampling.
- Scoring: Assign a continuous score to each candidate based on its token-level logits. The authors evaluated several aggregation functions, finding that Mean (average token probability) performed best for Bash and ALFWorld, while Min (the lowest token probability) was optimal for WebShop.
- Selection: The action with the highest aggregate score is executed.
Additionally, Adaptive SOFT-SC was introduced to optimize inference costs. It samples actions sequentially and terminates once a cumulative confidence threshold is met, reducing the average number of samples required without sacrificing performance.
Experimental Evaluation
The method was tested on three interactive benchmarks: Bash (shell command generation), WebShop (online shopping navigation), and ALFWorld (household task completion).
Key Results
Using CodeLlama-34B, SOFT-SC provided substantial gains over standard SC:
- WebShop: A 6.6% absolute increase in success rate.
- ALFWorld: A 4.7% increase in success rate.
- Efficiency: SOFT-SC with $k=5$ often outperformed standard SC with $k=10$ or $k=15$, demonstrating superior sample efficiency.
Cross-Model Reranking
A significant finding is the utility of SOFT-SC for "black-box" models. Since models like GPT-4 do not always provide accessible logits, SOFT-SC can be implemented by using a smaller, "white-box" model (e.g., CodeLlama-7B) to score the candidates generated by the larger model.
As shown in the figure above, using a 7B model to rerank GPT-4's outputs in WebShop improved performance by 4% compared to standard majority voting. This suggests that the internal ranking capabilities of smaller models are sufficient to identify high-quality outputs from more capable generators.
Discussion and Conclusion
SOFT-SC addresses the "exact match" bottleneck inherent in standard self-consistency for agentic tasks. By leveraging the model's internal confidence, it extracts a stronger signal from a smaller number of samples. While the method still requires multiple samples ($k > 1$), its improved scaling and ability to enhance black-box models make it a powerful tool for building more reliable LLM agents. Future work may explore more sophisticated scoring mechanisms or multi-agent verification strategies to further refine action selection.
Summary updated