Simulating Students' Java Programming Errors with Large Language Models

📄 arXiv: 2606.14113v1 📥 PDF

作者: Ali Keramati, Jie Cao, Iman Mohammadi, Mark Warschauer, Yang Shi

分类: cs.SE, cs.CL

发布日期: 2026-06-12


💡 一句话要点

利用大型语言模型模拟学生Java编程错误以提升教育效率

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 编程教育 学生错误模拟 智能辅导系统 教育数据分析

📋 核心要点

  1. 现有方法在获取学生编程错误时效率低下,且真实错误的积累需要大量课堂时间。
  2. 本研究提出利用大型语言模型模拟学生的逻辑错误,以快速生成多样化的编程错误数据。
  3. 实验结果显示,所有模型均能生成多样化的错误,Claude Sonnet 4在与真实错误的对齐度上表现最佳。

📝 摘要(中文)

理解学生在编程中的错误是编程教育的基石,但获取代表性的学生错误集既耗时又昂贵。本文探讨大型语言模型(LLMs)是否可以作为学生的可扩展代理,通过模拟代码提交中的逻辑错误。我们使用包含74,000多个独特学生Java提交的CodeWorkout数据集,评估了五种LLM在三种主流提示策略下的表现。研究发现,尽管所有模型生成的错误具有多样性,但与真实学生提交的对齐程度存在差异,Claude Sonnet 4的表现最为平衡。此外,专家盲评研究确认生成的错误在功能上与真实学生错误无显著区别。这些结果强调了使用LLMs模拟人类学习者的权衡,并为将合成错误整合到可教代理、智能辅导系统和大规模学习分析中提供了设计考虑。

🔬 方法详解

问题定义:本文旨在解决在编程教育中获取代表性学生错误的低效问题,现有方法依赖真实提交,过程缓慢且成本高昂。

核心思路:通过利用大型语言模型(LLMs)模拟学生的编程错误,提供一种可扩展的解决方案,以快速生成多样化的错误数据。

技术框架:研究使用CodeWorkout数据集,包含74,000多个学生Java提交,评估五种LLM在三种提示策略(输入-输出、思维链、迭代自我精炼)下的表现,分析错误的多样性和对齐度。

关键创新:最重要的创新在于将LLMs作为学生错误的代理,能够在不依赖真实数据的情况下生成具有代表性的编程错误,且Claude Sonnet 4在对齐度上表现最佳。

关键设计:在实验中,采用了多种提示策略,并通过定量和定性分析评估生成错误的多样性和与真实错误的相似性,确保生成的错误在功能上与真实学生错误无显著区别。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,所有评估的模型均能生成多样化的编程错误,Claude Sonnet 4在与真实学生错误的对齐度上表现最佳,显示出其在教育应用中的潜力。专家评估确认生成的错误在功能上与真实错误无显著区别,进一步验证了模型的有效性。

🎯 应用场景

该研究的潜在应用领域包括智能辅导系统、教育数据分析和可教代理的设计。通过模拟学生错误,教育工作者可以更有效地识别和解决学生在编程学习中的常见问题,从而提升教学效果和学习体验。

📄 摘要(原文)

Understanding student errors in the programming is a cornerstone of programming education, yet obtaining a representative set of student errors for any newly designed task remains slow and costly, since authentic submissions only accumulate after extensive classroom deployment. This paper explores whether large language models (LLMs) can serve as scalable proxies for students by simulating realistic logical errors in code submissions. Using the CodeWorkout dataset of 74,000+ unique student Java submissions across 37 problems, we evaluate five LLMs under three mainstream prompting strategies: Input-Output (IO), Chain-of-Thought (CoT), and iterative Self-Refine. We assess performance along two key dimensions: diversity (the range of distinct error patterns) and alignment (alignment with authentic student mistakes), and examine how these vary by struggling level of programming tasks. Our quantitative findings reveal that while all models generate diverse errors, their alignment to human submissions diverges: Claude Sonnet 4 achieves the most balanced performance. In addition, we conducted a blinded expert annotation study (N = 401) comparing synthetic and authentic errors. This qualitative analysis confirms that the generated errors are functionally indistinguishable from authentic student errors. Moreover, higher-struggling-level problems elicit more diverse but less student-like errors. These results highlight trade-offs in using LLMs to simulate human learners and suggest design considerations for integrating synthetic errors into teachable agents, intelligent tutoring systems, and large-scale learning analytics.