Large Language Models (LLMs) have revolutionized code generation ability by converting natural language descriptions into executable code. However, generating complex code within real-world scenarios remains challenging due to intricate structures, subtle bugs, understanding of advanced data types, and lack of supplementary contents. To address these challenges, we introduce the CONLINE framework, which enhances code generation by incorporating planned online searches for information retrieval and automated correctness testing for iterative refinement. CONLINE also serializes the complex inputs and outputs to improve comprehension and generate test case to ensure the framework's adaptability for real-world applications. CONLINE is validated through rigorous experiments on the DS-1000 and ClassEval datasets. It shows that CONLINE substantially improves the quality of complex code generation, highlighting its potential to enhance the practicality and reliability of LLMs in generating intricate code.
翻译:大语言模型通过将自然语言描述转换为可执行代码,彻底革新了代码生成能力。然而,在现实场景中生成复杂代码仍面临诸多挑战,包括复杂结构、隐晦错误、对高级数据类型的理解不足以及补充内容的缺失。为解决这些问题,我们提出了CONLINE框架,该框架通过融合计划性在线搜索进行信息检索与自动化正确性测试实现迭代精炼,从而增强代码生成能力。CONLINE还对复杂输入输出进行序列化处理以提升理解能力,并通过生成测试用例确保框架在现实应用中的适应性。通过在DS-1000和ClassEval数据集上开展的严格实验验证,CONLINE显著提升了复杂代码生成的质量,充分展现了其增强大语言模型在生成复杂代码时的实用性与可靠性的潜力。