利用大语言模型增强计算机编程教育:面向 Python 代码生成的有效提示工程研究
Enhancing Computer Programming Education with LLMs: A Study on Effective Prompt Engineering for Python Code Generation
AI总结:
本文研究面向 Python 代码生成的提示工程策略,通过多模型、多数据集实验验证定制化提示可提升 LLM 编程教学效果,并提出分类与评估框架。
摘要:
大语言模型(LLM)和提示工程在通过个性化教学推进计算机编程教育方面具有巨大潜力。本文通过研究三个关键问题来探索这一潜力:针对不同教育需求对提示工程策略进行系统分类;使 LLM 能够解决超出其固有能力的复杂问题;以及建立一个用于评估和实施这些策略的稳健框架。我们的方法包括根据教育要求对编程问题进行分类、应用各种提示工程策略,并评估 LLM 生成回答的有效性。在 LeetCode 和 USACO 等数据集上对 GPT-4、GPT-4o、Llama3-8b 和 Mixtral-8x7b 模型进行的实验表明,GPT-4o 始终优于其他模型,尤其是在采用“multi-step”提示策略时。结果表明,量身定制的提示策略显著提升了 LLM 的性能,并针对基础学习、竞赛准备和高级问题解决分别推荐了特定策略。本研究强调了提示工程在最大化 LLM 教育收益方面的关键作用。通过系统地分类和测试这些策略,我们为教育工作者和学生提供了一个综合框架,以优化基于 LLM 的学习体验。未来研究应聚焦于完善这些策略并解决当前 LLM 的局限性,从而进一步提升计算机编程教学的教育成果。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。