[论文解读] Enhancing Computer Programming Education with LLMs: A Study on Effective Prompt Engineering for Python Code Generation
本论文系统地对基于LLM的 Python 代码生成的提示工程策略进行分类,评估它们在 LeetCode 与 USACO 数据集上的影响,并提出一个框架与教育者指南。
Large language models (LLMs) and prompt engineering hold significant potential for advancing computer programming education through personalized instruction. This paper explores this potential by investigating three critical research questions: the systematic categorization of prompt engineering strategies tailored to diverse educational needs, the empowerment of LLMs to solve complex problems beyond their inherent capabilities, and the establishment of a robust framework for evaluating and implementing these strategies. Our methodology involves categorizing programming questions based on educational requirements, applying various prompt engineering strategies, and assessing the effectiveness of LLM-generated responses. Experiments with GPT-4, GPT-4o, Llama3-8b, and Mixtral-8x7b models on datasets such as LeetCode and USACO reveal that GPT-4o consistently outperforms others, particularly with the "multi-step" prompt strategy. The results show that tailored prompt strategies significantly enhance LLM performance, with specific strategies recommended for foundational learning, competition preparation, and advanced problem-solving. This study underscores the crucial role of prompt engineering in maximizing the educational benefits of LLMs. By systematically categorizing and testing these strategies, we provide a comprehensive framework for both educators and students to optimize LLM-based learning experiences. Future research should focus on refining these strategies and addressing current LLM limitations to further enhance educational outcomes in computer programming instruction.
研究动机与目标
- 按不同教育需求和题型对提示工程策略进行分类。
- 评估提示如何影响 LLM 超出其默认能力解决编程问题的能力。
- 开发一个鲁棒的框架来测试提示策略,并为教育者和学生提供实用指南。
提出的方法
- 按教育水平对问题进行分类:知识/技能、竞赛、高级综合问题。
- 应用三种提示策略:无提示工程、通用提示工程、具体提示工程。
- 使用正确性、有效性(时间/内存)和代码质量指标评估 LLM 输出;在不同数据集上分析结果。
实验结果
研究问题
- RQ1提示工程策略能否系统地针对不同教育需求和题型进行分类?
- RQ2定制的提示策略是否使 LLM 能够解决超出其直接能力的问题?
- RQ3是否可以建立一个鲁棒的评估框架和面向教育落地的可行指南?
主要发现
- GPT-4 和 GPT-4o 在 LeetCode 上在各种提示下均优于其他模型,GPT-4o 在多提示策略下达到 100% 通过率。
- 多步提示对复杂问题提供强力提升,例如 GPT-4o 在 LeetCode 上通过多提示达到 100% 通过率。
- 在 LeetCode 上,基础通过率在 GPT-4o 的各提示之间约为 97–99%,对 GPT-4 为 98–99%,而 Llama3-8b 和 Mixtral-8x7b 落后。
- 时间效率偏向 GPT-4 变体,最快时间在各提示之间大约 3959–4604 ms;GPT-4 通常最快。
- 代码质量(Pylint)在 GPT-4 上最高,尤其在多提示下;其他模型变动性更大。
- USACO 结果显示多提示将可解题目比例从 30%(基础)提升到 55%(多提示)和 75%(多提示+具体),尽管仍有部分题目未解。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。