Applied Sciences

Library-Oriented Code Generation Method Combining Execution-Feedback Re-Retrieval and Repair Mechanisms

Yukun Dong, Mingcheng Chen, Shanchen Pang

Computational

Key points

From the paper's conclusion
  • To address this problem, we propose EFRRCoder, a library-oriented code generation method that combines execution-feedback-based re-retrieval and repair.

Abstract

Library-oriented code generation methods typically supplement the library knowledge of large language models by retrieving API documentation. However, static retrieval cannot readily exploit runtime information generated during code generation to update the retrieved documents, and models may therefore still produce invalid API calls or code with runtime errors. To address this problem, we propose EFRRCoder, a library-oriented code generation method that combines execution-feedback-based re-retrieval and repair. On top of initial document retrieval and code generation, EFRRCoder introduces self-generated execution inputs to obtain runtime feedback from candidate programs, dynamically updates relevant API documents when execution reveals a potential API knowledge gap, and iteratively repairs failed code. This allows runtime information to improve generation results without additional model training. Experiments on the MonkeyEval and BeatNumEval library-oriented code generation benchmarks show that, across two base models, EFRRCoder improves pass@1 and pass@5 by up to 7.13 and 6.93 percentage points, respectively, over the best-performing baseline under each setting. Supplementary cross-library experiments on NdonnxEval further show that EFRRCoder consistently outperforms the compared baselines across both base models under docstring-removed and docstring-retained settings.

Read the paper

Discussion

Science Skim's AI key points, plus readers' public thoughts

Readers' thoughts

No reader thoughts yet.

Related papers