Manuscript Offprint
arXiv:2610.10656Can LLMs Simulate Novice Programmers' Misconceptions?
Abstract
We evaluate 13 LLMs on generating, solving, simulating, and diagnosing novice programming misconceptions on code-tracing problems. While frontier models reliably perform these tasks, small models ( 14B) struggle with dynamic execution. Notably, code-tuned models fail during misconception simulation by reverting to correct execution. Finally, misconception diagnosis is significantly easier in True/False formats than in open-ended generation tasks.
Keywords
Large Language Models, Misconceptions, Code Tracing, CS1
2 Background and Related Work
The idea that mistakes novices make in programming are not random, but caused by specific and systematic misconceptions, has a long history in CS education [6, 15]. Much work has focused on assembling misconception catalogs [5], through close observation and interviews [4] or mining common errors from repositories of student code [2], including with LLMs [1]. Recent work in STEM education has explored LLMs for misconception modeling. Sonkar
Daniel Bauer
Columbia University
New York, NY, USA
Question 34. What is the exact output of the following program?
lst = []
if len(lst) > 0 and lst[0] == 1: print("first_element_is_1")
else: print("safe")
A. safe B. An IndexError from evaluating lst[0] on an empty list. C. first element is 1 D. A TypeError
Figure 1: MC question for NoSHORTCIRCUIT (misconception: and/or always evaluate both operands). The correct answer is A. Option B is the misconception answer.
et al. [16], Zengaffinen et al. [18] finetune models to enable them to model specific student misconceptions about algebra. Liu et al. [9] find that LLM error patterns on math problems do not align with the errors students make. Parker and Zavala-Cerna [12] use LLMs to aid instructors in identifying misconceptions in biomedical science. Scarlatos et al. [14] use LLMs to simulate students to testing educational technology. We are the first to specifically investigate LLMs for misconception modeling in CS education, with implications for teaching and learning programming with generative AI.
3 Approach and Uniqueness
ProgMiscon [5] is a curated online repository of common misconceptions encountered by students. We downloaded labels and brief descriptions of the 30 available Python misconceptions. For each misconception, we prompted Anthropic’s Claude Fable 5 model to generate two exam-style code tracing problems, one multiple-choice version with four total options and one True/False question, for a total of 60 questions (see example in figure 1), with additional manual review. One of the answer choices reflected the correct output, while one (the misconception answer) corresponded to the specific misconception. Every MC question had one correct option and at least one misconception option, and true/false question had a wrong answer corresponding to the misconception. After manual vetting, four questions had to be revised to align better with the description of the misconception (RQ1). We then prompted 13 LLMs to complete the following tasks for each code tracing question: Exp. 1: Select a response from the provided candidate answers (RQ2); Exp. 2: Predict the output and a brief explanation, without access to candidate answers (RQ2). ; Exp. 3: Select a response from the provided candidate answers under the pretense of suffering from the misconception (RQ3); Exp. 4: Given a question and misconception answer, diagnose the misconception (free form output) (RQ4);
Only 27 out of the 60 generated questions were solvable without access to the answer choices because the answer choices often contain part of the problem statement.
Yeltekin and Bauer
| Model | MC/TF (n = 60) | Open-ended (n = 27) | ||
|---|---|---|---|---|
| Correct | Acc. | Correct | Acc. | |
| Opus 5 | 60 | 100.0% | 27 | 100.0% |
| Sonnet 5 | 60 | 100.0% | 26 | 96.3% |
| Haiku 4.5 | 60 | 100.0% | 26 | 96.3% |
| GPT-5.6 Sol | 60 | 100.0% | 25 | 92.6% |
| GPT-5.6 Terra | 60 | 100.0% | 26 | 96.3% |
| GPT-5.6 Luna | 60 | 100.0% | 27 | 100.0% |
| OLMo-3:7b | 57 | 95.0% | 26 | 96.3% |
| Qwen3-coder:30b | 58 | 96.7% | 24 | 88.9% |
| Qwen3:30b | 60 | 100.0% | 25 | 92.6% |
| Qwen2.5-coder:14b | 58 | 96.7% | 24 | 88.9% |
| Qwen2.5:14b | 57 | 95.0% | 22 | 81.5% |
| Qwen2.5-coder:7b | 50 | 83.3% | 20 | 74.1% |
| Qwen2.5:7b | 50 | 83.3% | 17 | 63.0% |
Table 1: Accuracy of solving code tracing problems correctly for MC/TF items (Exp. 1) and open-ended items (Exp. 2).
| Model | Followed | Other wrong | Correct |
|---|---|---|---|
| Opus 5 | 96.7% | 0.0% | 3.3% |
| Sonnet 5 | 90.0% | 1.7% | 8.3% |
| Haiku 4.5 | 85.0% | 0.0% | 15.0% |
| GPT-5.6 Sol | 95.0% | 1.7% | 3.3% |
| GPT-5.6 Terra | 86.7% | 3.3% | 10.0% |
| GPT-5.6 Luna | 88.4% | 3.3% | 8.3% |
| OLMo-3:7b | 76.7% | 3.3% | 20.0% |
| Qwen3-coder:30b | 45.0% | 1.7% | 53.3% |
| Qwen3:30b | 86.7% | 1.7% | 11.6% |
| Qwen2.5-coder:14b | 55.0% | 8.3% | 36.7% |
| Qwen2.5:14b | 61.7% | 3.3% | 35.0% |
| Qwen2.5-coder:7b | 53.4% | 13.3% | 33.3% |
| Qwen2.5:7b | 38.3% | 6.7% | 55.0% |
Table 2: Exp. 3 results. Followed: Accuracy of selecting the misconception answer. Other wrong :problem solved incorrectly by selecting an answer other than a misconception answer. Correct: misconception was not modeled
Exp. 5: Repeat Exp. 4, but select the misconception from a list of all 30 misconception definitions (RQ4). For Exp. 2 and 4, we matched the LLMs' output against the reference answer or misconception definition, using Claude Fable 5 with human review.
4 Results and Contributions
Table 1 shows results for Exp. 1 and 2. Large frontier models (Opus, Sonnet, Haiku and GPT-5.6) solve the entire question bank with minimal mistakes on the open-ended questions. The 30b open-weight models are also competitive, with Qwen3's 30 billion parameter non-coder variant returning a perfect score on MC/TF. Smaller models appear unable to model dynamic code execution at the same level as students. We did not find systematic differences between models fine-tuned on coding tasks and comparable non-coding models. Table 2 shows results for Exp. 3., investigating if LLMs can
We used API/CLI access for Anthropic and OpenAI models, and deployed the open weight models, including OLMo 3 [11], locally using Ollama [10].
| Model | Free (Exp. 4) | List (Exp. 5) | |||||
|---|---|---|---|---|---|---|---|
| Acc. | MC | TF | Sim. | Acc. | MC | TF | |
| Opus 5 | 86.7% | 76.7% | 96.7% | 4.40 | 96.7% | 96.7% | 96.7% |
| Sonnet 5 | 88.3% | 80.0% | 96.7% | 4.42 | 95.0% | 93.3% | 96.7% |
| Haiku 4.5 | 86.7% | 76.7% | 96.7% | 4.32 | 91.7% | 86.7% | 96.7% |
| GPT-5.6 Sol | 91.7% | 86.7% | 96.7% | 4.50 | 98.3% | 96.7% | 100.0% |
| GPT-5.6 Terra | 90.0% | 83.3% | 96.7% | 4.40 | 96.7% | 96.7% | 96.7% |
| GPT-5.6 Luna | 85.0% | 76.7% | 93.3% | 4.37 | 91.7% | 86.7% | 96.7% |
| OLMo-3:7b | 68.3% | 56.7% | 80.0% | 3.42 | 75.0% | 63.3% | 86.7% |
| Qwen3-coder:30b | 68.3% | 50.0% | 86.7% | 3.67 | 70.0% | 56.7% | 83.3% |
| Qwen3:30b | 76.7% | 66.7% | 86.7% | 4.12 | 88.3% | 83.3% | 93.3% |
| Qwen2.5-coder:14b | 73.3% | 63.3% | 83.3% | 3.72 | 70.0% | 56.7% | 83.3% |
| Qwen2.5:14b | 73.3% | 56.7% | 90.0% | 3.65 | 68.3% | 53.3% | 83.3% |
| Qwen2.5-coder:7b | 65.0% | 53.3% | 76.7% | 3.40 | 61.7% | 60.0% | 63.3% |
| Qwen2.5:7b | 55.0% | 30.0% | 80.0% | 3.08 | 53.3% | 50.0% | 56.7% |
Table 3: Misconception diagnosis given a question and misconception answer. Free (Exp. 4): the model describes the misconception in its own words. List (Exp. 5): the model selects one of the 30 misconceptions.
internalize programming misconceptions. The Followed column shows the percentage of MC/TF questions for which the model selected the misconception answer, i.e. the answer we would expect a student suffering from the misconception would give. Larger models with higher reasoning depth (Opus and GPT-5.6 Sol), perform best. The Correct column shows the percentage of questions for which the model chose the expected answer ignoring the misconception. This was an issue for coder models, which have been trained on large amounts of correct code examples. The misconception description in the prompt is not sufficient to overcome their bias for correct code generation and debugging. Inspecting the reasoning chain for Qwen3-coder, we find that it interrupts the process midway and turns from assuming the misconception to attempting to just solve the question. Table 3 shows results of detecting the misconception from a question / answer pair, either asking for a free description (Exp. 4) or selecting from the list of all misconceptions (Exp. 5). Selecting from a list is somewhat easier and, as before, large reasoning models perform best. Detecting misconceptions from TF question seems easier across both modalities. The TF questions are designed to more concretely address one specific misconception, while MC questions are more open-ended and require more abstract reasoning to identify the misconception from a single response.
Overall, our results suggest that (RQ1) LLMs can reliably generate diagnostic code tracing problems from misconception definitions; (RQ2) Larger LLMs (30+B parameters) can reliably solve code tracing problems; (RQ3) Large LLMs can mimic student behavior when answering code tracing problems under specific misconceptions. Model size and reasoning abilities seem to be key for this task and coding oriented models appear to be overfitted to a correct (misconception free) understanding of code. Future work will investigate to what degree LLMs actually model the notional machine and dynamic code execution rather than just stochastically simulating behavior.
Can LLMs Simulate Novice Programmers' Misconceptions?
References
[1] Erfan Al-Hossami and Razvan Bunescu. 2026. McMining: Automated Discovery of Misconceptions in Student Code. In Proceedings of the 19th Conference of the European Chapter of the Association for Computational Linguistics (Volume 2: Short Papers), Vera Demberg, Kentaro Inui, and Lluís Marquez (Eds.). Association for Computational Linguistics, Rabat, Morocco, 160–178. doi:10.18653/v1/2026.eaclshort.10
[2] Amjad Altadmri and Neil C.C. Brown. 2015. 37 Million Compilations: Investigating Novice Programming Mistakes in Large-Scale Student Data. In Proceedings of the 46th ACM Technical Symposium on Computer Science Education (Kansas City, Missouri, USA) (SIGCSE '15). Association for Computing Machinery, New York, NY, USA, 522–527. doi:10.1145/2676723.2677258
[3] Imen Azaiz, Natalie Kiesler, and Sven Strickroth. 2024. Feedback-Generation for Programming Exercises With GPT-4. In Proceedings of the 2024 on Innovation and Technology in Computer Science Education V. 1 (Milan, Italy) (ITiCSE 2024). Association for Computing Machinery, New York, NY, USA, 31–37. doi:10.1145/3649217.3653594
[4] Benedict Du Boulay. 1986. Some Difficulties of Learning to Program. Journal of Educational Computing Research 2, 1 (1986), 57–73. arXiv:https://doi.org/10.2190/3LFX-9RRF-67T8-UVK9 doi:10.2190/3LFX-9RRF-67T8-UVK9
[5] Luca Chiodini, Igor Moreno Santos, Andrea Gallidabino, Anya Tafliovich, André L. Santos, and Matthias Hauswirth. 2021. A Curated Inventory of Programming Language Misconceptions. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education V. 1 (Virtual Event, Germany) (ITiCSE '21). Association for Computing Machinery, New York, NY, USA, 380–386. doi:10.1145/3430665.3456343
[6] Lisa C. Kaczmarczyk, Elizabeth R. Petrick, J. Philip East, and Geoffrey L. Herman. 2010. Identifying student misconceptions of programming. In Proceedings of the 41st ACM Technical Symposium on Computer Science Education (Milwaukee, Wisconsin, USA) (SIGCSE '10). Association for Computing Machinery, New York, NY, USA, 107–111. doi:10.1145/1734263.1734299
[7] Natalie Kiesler, Dominic Lohr, and Hieke Keuning. 2023. Exploring the potential of large language models to generate formative programming feedback. In 2023 IEEE frontiers in education conference (FIE). IEEE, 1–5.
[8] Mengqi Liu and Faten M'Hiri. 2024. Beyond Traditional Teaching: Large Language Models as Simulated Teaching Assistants in Computer Science. In Proceedings of the 55th ACM Technical Symposium on Computer Science Education
V. 1 (Portland, OR, USA) (SIGCSE 2024). Association for Computing Machinery, New York, NY, USA, 743–749. doi:10.1145/3626252.3630789
[9] Naiming Liu, Shashank Sonkar, and Richard Baraniuk. 2025. Do LLMs make mistakes like students? Exploring natural alignments between language models and human error patterns. In International Conference on Artificial Intelligence in Education. Springer, 364–377.
[10] Ollama. 2026. Ollama. https://github.com/ollama/ollama. Software.
[11] Olmo Team. 2025. Olmo 3. arXiv:2512.13961 https://arxiv.org/abs/2512.13961
[12] M. J. Parker and M. G. Zavala-Cerna. 2026. What don't you understand? Using large language models to identify and characterize student misconceptions about challenging topics. Education and Information Technology 31 (2026), 4705–4744. doi:10.1007/s10639-026-13902-8
[13] Tung Phung, Victor-Alexandru Pădurean, José Cambronero, Sumit Gulwani, Tobias Kohn, Rupak Majumdar, Adish Singla, and Gustavo Soares. 2023. Generative AI for Programming Education: Benchmarking ChatGPT, GPT-4, and Human Tutors. In Proceedings of the 2023 ACM Conference on International Computing Education Research - Volume 2 (Chicago, IL, USA) (ICER '23). Association for Computing Machinery, New York, NY, USA, 41–42. doi:10.1145/3568812.3603476
[14] Alexander Scarlatos, Jaewook Lee, Simon Woodhead, and Andrew Lan. 2026. Simulated Students in Tutoring Dialogues: Substance or Illusion?. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Maria Liakata, Viviane P. Moreira, Jiajun Zhang, and David Jurgens (Eds.). Association for Computational Linguistics, San Diego, California, United States, 42349–42385. doi:10.18653/v1/2026.acl-long.1960
[15] E. Soloway. 1986. Learning to Program = Learning to Construct Mechanisms and Explanations. Commun. ACM 29, 9 (Sept. 1986), 850–858. doi:10.1145/6592.6594
[16] Shashank Sonkar, Xinghe Chen, Naiming Liu, Richard G Baraniuk, and Mrinmaya Sachan. 2024. Llm-based cognitive models of students with misconceptions (working paper). arXiv preprint arXiv:2410.12294 (2024).
[17] Juha Sorva. 2013. Notional machines and introductory programming education. ACM Trans. Comput. Educ. 13, 2, Article 8 (July 2013), 31 pages. doi:10.1145/2483710.2483713
[18] Yanick Zengaffinen, Andreas Opedal, Donya Rooein, Kv Aditya Srivatsa, Shashank Sonkar, and Mrinmaya Sachan. 2026. Can LLMs Model Incorrect Student Reasoning? A Case Study on Distractor Generation. arXiv preprint arXiv:2603.15547 (2026).