English

Scattered Forest Search: Smarter Code Space Exploration with LLMs

Software Engineering 2025-02-26 v2 Artificial Intelligence Machine Learning

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.

Keywords

Cite

@article{arxiv.2411.05010,
  title  = {Scattered Forest Search: Smarter Code Space Exploration with LLMs},
  author = {Jonathan Light and Yue Wu and Yiyou Sun and Wenchao Yu and Yanchi liu and Xujiang Zhao and Ziniu Hu and Haifeng Chen and Wei Cheng},
  journal= {arXiv preprint arXiv:2411.05010},
  year   = {2025}
}

Comments

Accepted at ICLR 2025 Conference

R2 v1 2026-06-28T19:52:08.157Z