How Beginning Programmers and Code LLMs (Mis)read Each Other

Sydney Nguyen, Hannah McLean Babe, Yangtian Zi, Arjun Guha, Carolyn Jane Anderson, Molly Q. Feldman

This CHI '24 paper explores the "communication gap" between novice programmers and Large Language Models (LLMs). While experts use tools like GitHub Copilot to boost productivity, this study reveals that beginners struggle significantly with the iterative process of prompting and refining code, often due to incorrect mental models of how AI actually works.

TL;DR

Despite the hype that LLMs might make traditional coding obsolete, beginning programmers struggle to use them effectively, achieving only a 57% eventual success rate on introductory tasks. The study finds that "prompting" is a distinct technical skill that requires precise communication and a clear mental model of the AI—skills that novices have yet to develop.

What Problem Does This Paper Address?

The "end of programming" has been a recurring headline since the rise of LLMs. The assumption is that if you can describe a task in natural language, the AI will handle the technical implementation. However, most research on "text-to-code" has focused on expert developers or used expert-written prompts.

The authors identify a major gap: we don't know if beginners (specifically students who have only completed an introductory CS1 course) can successfully navigate the multi-step loop of querying an LLM. This loop involves articulating intent, evaluating generated code, and—most importantly—editing prompts when the model fails. If beginners can't bridge this gap, LLMs may exacerbate the "digital divide" rather than democratizing programming.

Methods

The researchers conducted a large-scale, multi-institutional controlled study with 120 students from three U.S. colleges.

  • The Interface: They built "Charlie the Coding Cow," a simplified web interface. To prevent students from simply copy-pasting problem descriptions, the tasks were presented as Input/Output examples (e.g., [1, 2, 3], 1 -> [1, 2, 3]).
  • The Loop: Students wrote a natural language prompt, which was sent to OpenAI’s Codex (code-davinci-002). The system automatically ran the generated code against hidden test cases and gave the student immediate feedback (Pass/Fail).
  • The Data: The team used a mixed-methods approach, collecting quantitative success metrics (pass@1, eventual success) and qualitative data through NASA-TLX surveys and semi-structured interviews to understand the students' thought processes.

Datasets

  • CS1 Problem Set: The authors curated 48 Python programming problems across eight categories (e.g., Lists, Loops, Dictionaries, Sorting). These were adapted from actual introductory course materials to ensure they were at an appropriate difficulty level.
  • StudentEval: While not the primary focus of this specific paper, the authors reference their related work on StudentEval, a benchmark of student-written prompts used to evaluate LLM performance.

Key Insights and Ideas

  • The "Keyword" Mental Model: Most students didn't view the LLM as a probabilistic model. Instead, they treated it like a searchable database or dictionary. They believed that if they just found the "right" magic keywords (like "return" or "if-statement"), the model would work.
  • The Stochastic Wall: Students were deeply frustrated by the non-deterministic nature of LLMs. They were baffled when the same prompt produced different code on a second try, or when they changed their prompt and the model stubbornly produced the exact same incorrect code.
  • Prompting as Technical Communication: The study suggests that prompting isn't "natural" language; it’s a form of technical communication. Students who struggled often failed because they couldn't describe the logic of the problem, even if they understood the goal.
  • Equity Concerns: The study found a statistically reliable difference in success for first-generation college students, who struggled more with the task. This suggests that without explicit instruction, LLM tools might inadvertently favor students with more prior exposure or "hidden curriculum" knowledge.

Key Results

  • Low Success Rates: The mean eventual success rate was only 57%, even though the problems were at the students' skill level and they had unlimited attempts.
  • High Effort, Low Yield: Students were persistent—one student tried 32 times on a single problem—but their prompting abilities did not observably improve over the 75-minute session.
  • Mental Workload: According to NASA-TLX ratings, students found the task mentally demanding (mean 4/7) and reported significant levels of stress and insecurity when the model failed to understand them.
  • Pass@1: The average probability that a single student prompt would work on the first try was only 0.22.

Limitations and Future Work

  • Model Evolution: The study used Codex (the state-of-the-art at the time). While newer models like GPT-4 are more capable, the authors argue that the fundamental human-AI communication barriers likely persist.
  • Interface Restrictions: In this study, students could only edit the prompt, not the code. In real-world scenarios, developers often use a "hybrid" approach (prompting then manually fixing). Future work should explore how beginners handle this hybrid workflow.
  • Pedagogical Shift: The authors conclude that educators shouldn't "ban" LLMs but should instead focus on teaching code comprehension and problem decomposition. If a student can't explain a problem clearly to a human or an AI, they can't program—regardless of the tool they use.

Summary updated

BibTeX
@inproceedings{nguyen2024how,
  author = {Sydney Nguyen and Hannah McLean Babe and Yangtian Zi and Arjun Guha and Carolyn Jane Anderson and Molly Q. Feldman},
  title = {{How Beginning Programmers and Code LLMs (Mis)read Each Other}},
  booktitle = {CHI},
  year = {2024},
  doi = {10.1145/3613904.3642706},
}

Loading related content...

Figure