"I Would Have Written My Code Differently'': Beginners Struggle to Understand LLM-Generated Code

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zi, Yangtian, Li, Luisa, Guha, Arjun, Anderson, Carolyn Jane, Feldman, Molly Q
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918001464311808
author Zi, Yangtian
Li, Luisa
Guha, Arjun
Anderson, Carolyn Jane
Feldman, Molly Q
author_facet Zi, Yangtian
Li, Luisa
Guha, Arjun
Anderson, Carolyn Jane
Feldman, Molly Q
contents Large language models (LLMs) are being increasingly adopted for programming work. Prior work shows that while LLMs accelerate task completion for professional programmers, beginning programmers struggle to prompt models effectively. However, prompting is just half of the code generation process -- when code is generated, it must be read, evaluated, and integrated (or rejected). How accessible are these tasks for beginning programmers? This paper measures how well beginners comprehend LLM-generated code and explores the challenges students face in judging code correctness. We compare how well students understand natural language descriptions of functions and LLM-generated implementations, studying 32 CS1 students on 160 task instances. Our results show a low per-task success rate of 32.5\%, with indiscriminate struggles across demographic populations. Key challenges include barriers for non-native English speakers, unfamiliarity with Python syntax, and automation bias. Our findings highlight the barrier that code comprehension presents to beginning programmers seeking to write code with LLMs.
format Preprint
id arxiv_https___arxiv_org_abs_2504_19037
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle "I Would Have Written My Code Differently'': Beginners Struggle to Understand LLM-Generated Code
Zi, Yangtian
Li, Luisa
Guha, Arjun
Anderson, Carolyn Jane
Feldman, Molly Q
Software Engineering
Human-Computer Interaction
Large language models (LLMs) are being increasingly adopted for programming work. Prior work shows that while LLMs accelerate task completion for professional programmers, beginning programmers struggle to prompt models effectively. However, prompting is just half of the code generation process -- when code is generated, it must be read, evaluated, and integrated (or rejected). How accessible are these tasks for beginning programmers? This paper measures how well beginners comprehend LLM-generated code and explores the challenges students face in judging code correctness. We compare how well students understand natural language descriptions of functions and LLM-generated implementations, studying 32 CS1 students on 160 task instances. Our results show a low per-task success rate of 32.5\%, with indiscriminate struggles across demographic populations. Key challenges include barriers for non-native English speakers, unfamiliarity with Python syntax, and automation bias. Our findings highlight the barrier that code comprehension presents to beginning programmers seeking to write code with LLMs.
title "I Would Have Written My Code Differently'': Beginners Struggle to Understand LLM-Generated Code
topic Software Engineering
Human-Computer Interaction
url https://arxiv.org/abs/2504.19037