ROCODE: Integrating Backtracking Mechanism and Program Analysis in Large Language Models for Code Generation
Xue Jiang, Yihong Dong, Yongding Tao, Huanyu Liu, Zhi Jin, Wenpin, Jiao, Ge Li

TL;DR
ROCODE enhances large language models for code generation by integrating backtracking and program analysis, enabling early error detection and correction during generation, which significantly improves accuracy and efficiency.
Contribution
This paper introduces ROCODE, a novel framework combining backtracking and program analysis to detect and correct errors during code generation in LLMs, reducing errors and resource wastage.
Findings
Achieves 99.1% compilation pass rate.
Improves test pass rate by up to 23.8%.
Reduces token cost by 19.3%.
Abstract
Large language models (LLMs) have achieved impressive performance in code generation recently, offering programmers revolutionary assistance in software development. However, due to the auto-regressive nature of LLMs, they are susceptible to error accumulation during code generation. Once an error is produced, LLMs can merely continue to generate the subsequent code conditioned on it, given their inability to adjust previous outputs. Existing LLM-based approaches typically consider post-revising after code generation, leading to the challenging resolution of accumulated errors and the significant wastage of resources. Ideally, LLMs should rollback and resolve the occurred error in time during code generation, rather than proceed on the basis of the error and wait for post-revising after generation. In this paper, we propose ROCODE, which integrates the backtracking mechanism and program…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Model-Driven Software Engineering Techniques · Software Testing and Debugging Techniques
