Large Language Models 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 CoCoST framework, which enhances complex code generation by online searching for more information with planned queries and correctness testing for code refinement. Moreover, CoCoST serializes the complex inputs and outputs to improve comprehension and generates test cases to ensure the adaptability for real-world applications. CoCoST is validated through rigorous experiments on the DS-1000 and ClassEval datasets. Experimental results show that CoCoST substantially improves the quality of complex code generation, highlighting its potential to enhance the practicality of LLMs in generating complex code.
翻译:大型语言模型通过将自然语言描述转换为可执行代码,彻底改变了代码生成能力。然而,由于复杂的结构、细微的错误、对高级数据类型的理解不足以及缺乏补充内容,在真实场景中生成复杂代码仍然具有挑战性。为应对这些挑战,我们提出了CoCoST框架,该框架通过规划查询在线搜索更多信息并进行正确性测试以优化代码,从而增强复杂代码生成能力。此外,CoCoST对复杂的输入和输出进行序列化以提高理解能力,并生成测试用例以确保其在真实应用中的适应性。CoCoST在DS-1000和ClassEval数据集上进行了严格的实验验证。实验结果表明,CoCoST显著提升了复杂代码生成的质量,凸显了其在增强大型语言模型生成复杂代码实用性方面的潜力。