InterCode:标准化并基准测试带执行反馈的交互式编程
InterCode: Standardizing and Benchmarking Interactive Coding with Execution Feedback
AI总结:
本文提出 InterCode 框架,将交互式编程标准化为强化学习环境,以代码为动作、执行反馈为观测,并在 Bash、SQL 和 Python 三个环境中验证其能有效提升 LLM 的代码生成能力。
摘要:
人类编写代码的方式本质上是交互式的,并依赖持续的执行反馈来纠正错误、消除歧义和分解任务。尽管大语言模型(LLM)近期展现出有前景的编程能力,但当前的编程基准大多考虑静态的指令到代码序列转换过程,这可能导致错误传播,并使生成的代码与其最终执行环境之间产生脱节。为弥补这一差距,我们引入了 InterCode,一个轻量、灵活且易于使用的交互式编程框架,作为标准的强化学习(RL)环境,其中代码作为动作,执行反馈作为观测。我们的框架与语言和平台无关,使用自包含的 Docker 环境提供安全且可复现的执行,并且开箱即用地兼容传统的 seq2seq 编码方法,同时支持开发用于交互式代码生成的新方法。我们利用 InterCode 创建了三个交互式代码环境,分别以 Bash、SQL 和 Python 作为动作空间,并利用了静态的 NL2Bash、Spider 和 MBPP 数据集中的数据。我们通过评估多个配置了不同提示策略(如 ReAct 和 Plan & Solve)的最先进 LLM,展示了 InterCode 作为测试平台的可行性。我们的结果展示了交互式代码生成的优势,并证明 InterCode 可以作为一个具有挑战性的基准,用于推进代码理解和生成能力。InterCode 设计上易于扩展,甚至可以用于创建新任务,例如 Capture the Flag,这是一种流行的编程谜题,本质上涉及多步骤并涉及多种编程语言。项目网站包含代码和数据:https://intercode-benchmark.github.io
英文摘要:
Humans write code in a fundamentally interactive manner and rely on constant execution feedback to correct errors, resolve ambiguities, and decompose tasks. While LLMs have recently exhibited promising coding capabilities, current coding benchmarks mostly consider a static instruction-to-code sequence transduction process, which has the potential for error propagation and a disconnect between the generated code and its final execution environment. To address this gap, we introduce InterCode, a lightweight, flexible, and easy-to-use framework of interactive coding as a standard reinforcement learning (RL) environment, with code as actions and execution feedback as observations. Our framework is language and platform agnostic, uses self-contained Docker environments to provide safe and reproducible execution, and is compatible out-of-the-box with traditional seq2seq coding methods, while enabling the development of new methods for interactive code generation. We use InterCode to create three interactive code environments with Bash, SQL, and Python as action spaces, leveraging data from the static NL2Bash, Spider, and MBPP datasets. We demonstrate InterCode's viability as a testbed by evaluating multiple state-of-the-art LLMs configured with different prompting strategies such as ReAct and Plan & Solve. Our results showcase the benefits of interactive code generation and demonstrate that InterCode can serve as a challenging benchmark for advancing code understanding and generation capabilities. InterCode is designed to be easily extensible and can even be used to create new tasks such as Capture the Flag, a popular coding puzzle that is inherently multi-step and involves multiple programming languages. Project site with code and data: https://intercode-benchmark.github.io
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。