[论文解读] Conversing with Copilot: Exploring Prompt Engineering for Solving CS1 Problems Using Natural Language
本研究评估了 GitHub Copilot 在 166 个 CS1 编程问题上的表现,发现 50% 的问题在首次使用原始提示时即可解决,而剩余 50% 中的 60% 通过自然语言提示工程得以解决。结果表明,提示工程——即通过算法提示优化问题描述——是一种极为有效且具有教学价值的交互方式,有助于在入门级编程教育中培养计算思维。
GitHub Copilot is an artificial intelligence model for automatically generating source code from natural language problem descriptions. Since June 2022, Copilot has officially been available for free to all students as a plug-in to development environments like Visual Studio Code. Prior work exploring OpenAI Codex, the underlying model that powers Copilot, has shown it performs well on typical CS1 problems thus raising concerns about the impact it will have on how introductory programming courses are taught. However, little is known about the types of problems for which Copilot does not perform well, or about the natural language interactions that a student might have with Copilot when resolving errors. We explore these questions by evaluating the performance of Copilot on a publicly available dataset of 166 programming problems. We find that it successfully solves around half of these problems on its very first attempt, and that it solves 60\% of the remaining problems using only natural language changes to the problem description. We argue that this type of prompt engineering, which we believe will become a standard interaction between human and Copilot when it initially fails, is a potentially useful learning activity that promotes computational thinking skills, and is likely to change the nature of code writing skill development.
研究动机与目标
- 评估仅使用自然语言提示时,GitHub Copilot 解决入门级编程问题的能力。
- 探究通过提示工程修改问题描述是否能提升 Copilot 在初始失败后的成功率。
- 识别在合理提示工程努力后仍无法解决的问题的共同特征。
- 探讨将提示工程作为学习活动在 CS1 教育中的教学意义。
- 鉴于模型快速迭代,为 Copilot 在公开 CS1 问题数据集上的表现建立当前基准。
提出的方法
- 在 CodeCheck 的 Python 问题库中公开的 166 个 CS1 编程问题数据集上评估 Copilot 的表现。
- 最初使用原始问题描述原样测试 Copilot,以确定基线成功率。
- 对于初始失败的问题,应用迭代式自然语言提示工程——添加算法提示、澄清约束条件并重构问题陈述。
- 根据失败模式对问题进行分类:提示质量差、提示冗长(模式型)和概念性问题,分析提示结构与清晰度。
- 使用定性与定量分析评估提示修改对解法正确性的影响。
- 通过多次重复实验以应对底层 Codex 模型的非确定性行为。
实验结果
研究问题
- RQ1RQ1:使用原始问题描述时,Copilot 在公开的 CS1 编程问题库中的表现如何?
- RQ2RQ2:对问题描述进行自然语言修改后,Copilot 在初始失败后能多大程度上成功解决问题?
- RQ3RQ3:即使经过合理的提示工程努力,Copilot 仍无法解决的问题之间存在哪些共性?
- RQ4RQ4:将提示工程作为与 AI 配对编程工具(如 Copilot)的交互策略,其在教学上具有哪些意义?
主要发现
- Copilot 在首次使用原始问题描述时,成功解决了 166 个 CS1 问题中的 50%。
- 在初始失败的剩余 50% 问题中,60% 通过自然语言提示工程成功解决,主要通过添加算法提示实现。
- 提示工程在所有问题类别中均有效,包括模式归纳、字符串操作和概念性推理问题。
- 需要归纳推理或隐含模式识别的问题初始失败率更高,但通过更清晰、更结构化的提示可被解决。
- 研究识别出三种失败类别:提示质量差(描述模糊或不完整)、提示冗长(指令过于复杂或重复)和概念性问题(对边界情况或约束条件缺乏清晰说明)。
- 尽管底层 Codex 模型具有非确定性,但重复评估中观察到一致的成功率,支持本研究结果作为当前基准的可靠性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。