利用打印调试改进大型语言模型的代码生成
Leveraging Print Debugging to Improve Code Generation in Large Language Models
AI总结:
针对LLMs处理复杂编程问题性能欠佳的问题,提出基于“打印调试”的上下文学习方法,指导模型插入打印语句并分析日志修复漏洞,在Leetcode问题上效果优于橡皮鸭调试法。
摘要:
大型语言模型(LLMs)在代码生成任务上取得了显著进展,但在处理涉及复杂数据结构和算法的编程问题时,其性能依然欠佳。为解决此问题,我们提出了一种上下文学习方法,通过使用“打印调试”方法来指导LLMs进行调试,该方法涉及插入打印语句以进行追踪,并分析日志来修复漏洞。我们收集了一个Leetcode问题数据集,并使用Leetcode在线评测系统对我们的方法进行了评估。使用GPT-4进行的实验证明了我们方法的有效性,在简单和中等难度的Leetcode问题上分别以1.5%和17.9%的优势胜过了橡皮鸭调试法。
英文摘要:
Large language models (LLMs) have made significant progress in code generation tasks, but their performance in tackling programming problems with complex data structures and algorithms remains suboptimal. To address this issue, we propose an in-context learning approach that guides LLMs to debug by using a "print debugging" method, which involves inserting print statements to trace and analysing logs for fixing the bug. We collect a Leetcode problem dataset and evaluate our method using the Leetcode online judging system. Experiments with GPT-4 demonstrate the effectiveness of our approach, outperforming rubber duck debugging in easy and medium-level Leetcode problems by 1.5% and 17.9%.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。