[论文解读] Explaining Code with a Purpose: An Integrated Approach for Developing Code Comprehension and Prompting Skills
本文提出一种整合性教学方法,利用大语言模型(LLM)自动评估学生在'用通俗英语解释'(EiPE)任务中的回答,通过从其解释生成代码,从而并行评估代码理解能力与提示工程技能。在一门大型CS1课程中,学生成功生成了大量有效提示,能够产出功能等效的代码,其中具有关联性、聚焦于目的的解释最为有效。
Reading, understanding and explaining code have traditionally been important skills for novices learning programming. As large language models (LLMs) become prevalent, these foundational skills are more important than ever given the increasing need to understand and evaluate model-generated code. Brand new skills are also needed, such as the ability to formulate clear prompts that can elicit intended code from an LLM. Thus, there is great interest in integrating pedagogical approaches for the development of both traditional coding competencies and the novel skills required to interact with LLMs. One effective way to develop and assess code comprehension ability is with ``Explain in plain English'' (EiPE) questions, where students succinctly explain the purpose of a fragment of code. However, grading EiPE questions has always been difficult given the subjective nature of evaluating written explanations and this has stifled their uptake. In this paper, we explore a natural synergy between EiPE questions and code-generating LLMs to overcome this limitation. We propose using an LLM to generate code based on students' responses to EiPE questions -- not only enabling EiPE responses to be assessed automatically, but helping students develop essential code comprehension and prompt crafting skills in parallel. We investigate this idea in an introductory programming course and report student success in creating effective prompts for solving EiPE questions. We also examine student perceptions of this activity and how it influences their views on the use of LLMs for aiding and assessing learning.
研究动机与目标
- 为解决编程教育中EiPE(用通俗英语解释)问题长期存在的主观性与耗时性评分难题。
- 开发一种可扩展的自动化方法,利用大语言模型(LLM)从学生解释中生成代码,以评估代码理解能力。
- 同时培养学生撰写有效提示的能力,这是现代编程中一项关键新兴技能。
- 探究基于EiPE的大语言模型提示任务是否能提升学生参与度,并促进对代码的深入理解,超越传统编程练习。
- 探索该方法在支持多样化学习者(包括非英语母语者)方面的潜力,通过多语言解释支持实现。
提出的方法
- 学生被提供一个代码片段,并被要求用通俗英语解释其用途,模拟传统的EiPE问题。
- 学生的解释被用作提示输入给一个代码生成型大语言模型(LLM),以生成相应的代码。
- 通过测试套件自动评估生成的代码是否与原始代码功能等效,从而实现客观评估。
- 该方法利用SOLO分类法,根据学生解释中对代码元素的整合程度,对其质量进行分类。
- 成功与否以LLM生成的代码是否通过所有测试用例为判断标准,表明理解准确。
- 该方法支持形成性评估,并促进学生在代码理解与提示工程两方面的能力发展。
实验结果
研究问题
- RQ1学生在用通俗英语解释代码片段时,其生成的提示在多大程度上能产生功能等效的代码?
- RQ2学生解释的质量(以SOLO分类法的层级衡量)在多大程度上影响LLM生成代码的成功率?
- RQ3与传统编程练习相比,学生对这种LLM辅助的EiPE任务有何看法?
- RQ4该方法是否可通过多语言解释支持,实现对不同英语水平学生更公平的评估?
- RQ5提示的长度与结构在多大程度上影响LLM生成代码的可靠性与正确性?
主要发现
- 在一门大型CS1课程(n ≈ 900)中,学生成功生成了大量提示,能够从EiPE解释中产出功能正确的代码,成功率很高。
- 高水平的、具有关联性的解释——即有意义地整合多个代码元素的解释——显著更可能生成正确代码,而表面性或逐行描述的解释则效果较差。
- 学生表示该活动具有吸引力且有助于提升代码理解能力,许多人认为其新颖且对学习有价值。
- 该方法实现了对EiPE回答的自动、客观评估,克服了长期存在的主观评分障碍。
- 有六名学生提交了中文版本的优秀解释,证明该方法在支持多语言学习者及减少语言相关评估偏见方面具有潜力。
- 尽管成功率很高,但提示的可靠性存在波动,同一提示有时生成正确代码,有时生成错误代码,表明仍需改进一致性检查机制。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。