🤖 AI Summary
This work addresses three key challenges in large language model (LLM)-based code generation: susceptibility to local optima, insufficient solution diversity, and poor scalability of reasoning. To this end, we propose Scattering Forest Search (SFS), a diversity-driven evolutionary search framework grounded in black-box optimization. SFS introduces a novel scattering forest structure—provably capable of strong local-optimum escape—and integrates dynamic feedback-weighted evaluation with diversity-aware sampling to substantially improve search efficiency. On HumanEval+, SFS achieves a pass@1 score of 67.1% (+8.6% over prior state-of-the-art), and 87.2% on HumanEval (+4.3%). It reduces required iterations by 50% while consistently outperforming existing methods across multiple benchmarks.
📝 Abstract
We frame code generation as a black-box optimization problem within the code space and demonstrate how optimization-inspired techniques can enhance inference scaling. Based on this perspective, we propose SCATTERED FOREST SEARCH (SFS), a novel approach that improves solution diversity and better exploits feedback during evolutionary search. Our theoretical analysis illustrates how these methods help avoid local optima during optimization, leading to more efficient exploration. Extensive experiments on HumanEval, MBPP, APPS, CodeContests, and Leetcode reveal significant performance gains. For instance, our method achieves a pass@1 rate of 67.1% on HumanEval+ and 87.2% on HumanEval with GPT-3.5, marking improvements of 8.6% and 4.3% over the state-of-the-art, while also halving the iterations needed to find the correct solution. Furthermore, our approach scales more efficiently than existing search techniques, including tree search, line search, and repeated sampling.