Interleaving Natural Language Prompting with Code Editing for Solving Programming Tasks with Generative AI Models

Victor-Alexandru Pădurean, Alkis Gotovos, Ahana Ghosh, Paul Denny, Juho Leinonen, Andrew Luxton-Reilly, James Prather, Adish Singla

TL;DR

This paper investigates how introductory programming students balance natural language prompting and manual code editing when working with Generative AI (GenAI) models. By analyzing over 13,000 interactions, the researchers found that students primarily use prompting to generate initial code structures and rely on manual editing as a localized "last-mile repair" tool to fix bugs after failed test runs.

What Problem Does This Paper Address?

The widespread adoption of GenAI tools like ChatGPT and GitHub Copilot has fundamentally changed how novices learn to code. Instead of starting with a blank text editor, students often begin with AI-generated code blocks. However, AI models frequently produce code with subtle logical errors or boundary condition failures.

Educators worry that easy access to GenAI might lead to passive over-reliance, preventing students from mastering core programming and debugging skills. This paper addresses a critical gap in understanding this new paradigm: How do students actually interleave natural language prompting with manual code editing in practice, and how does this behavior change based on task complexity and student ability?

Methods

The authors conducted a large-scale study within an introductory Python programming course at the University of Auckland. They utilized Prompt Programming, a web-based platform designed for solving visual computational tasks. The platform features a tightly integrated chat interface powered by GPT-4o mini alongside a direct code editor and execution console.

Figure 1: Illustration of a student’s interaction combining prompting and editing. (a) presents the specification for the ‘sort sub- list’ problem, where a sub-list must be sorted within the given index range. (b) recreates a genuine student’s interaction, demon- strating how they interleave natural-language prompting and manual code editing, summarized by the state-transition diagram.

The system tracked student workflows step-by-step, logging state transitions between:

  • Sending a prompt (Msg)
  • Attaching edited code to a prompt (MsgAtt)
  • Running AI code (RunAI)
  • Manually editing code (Edit)
  • Running edited code (RunEdit)

To complement these behavioral logs, the researchers collected open-ended student reflections and cross-referenced interaction data with students' performance on three independent, invigilated, pen-and-paper/sandbox coding exams to gauge baseline programming competence.

Datasets

The study collected a dataset consisting of 13,305 distinct interactions from 355 students over a three-day laboratory activity.

Students interacted with 9 programming problems across three difficulty tiers:

  1. Basic Functions: Simple tasks like counting negative numbers or finding an index.
  2. Advanced Functions: More complex single-function tasks, such as sorting a specific sublist.
  3. Classes & Functions: Multi-function problems requiring custom data structures (e.g., implementing a stack to validate parentheses).

Key Insights and Ideas

  • Editing as "Last-Mile Repair": Students rarely use manual editing to rewrite large blocks of code. Instead, editing is overwhelmingly used for highly localized, single-line fixes (like changing a logical operator or adjusting an index range) near the very end of a problem-solving session.
  • Editing is Reactive: The transition into manual code editing is almost always triggered by a failed code execution (RunAI $\rightarrow$ Fail $\rightarrow$ Edit). Students test the AI's code first, see the error, and then dive into the code themselves rather than trying to re-prompt the model.
  • The Complementary Mindset: Student reflections revealed a clear strategic division: prompting provides speed and initial structure, while manual editing provides precision, verification, and a sense of control.
Figure 2: RQ1. Patterns of prompting and editing across problems. (a) presents aggregate transitions between interaction states: Start/Reset, NL message (Msg), NL message with attached code-edit (MsgAtt), execution of GenAI-generated code (RunAI), manual edit (Edit), execution of edited code (RunEdit), and the terminal outcomes Success (Succ) or Failure (Fail). (b) shows sessions structured into alternating odd turns with messaging/terminal events (Msg, MsgAtt, Reset, Succ, Fail), and even turns summarizing execution/edit actions: RunAI (execution of GenAI code only); {Edit} (potentially multiple edits without execution); {RunAI, Edit} (execution of GenAI code followed by edits without execution); {RunEdit} (potentially multiple loops of editing and running edited code); {RunAI, RunEdit} (both execution of GenAI code and edit-execute loops); and NoOp (no execution or edits).

Key Results

  • Complexity Drives Editing: As tasks got harder, manual editing became significantly more frequent. Only 16% of sessions in the Basic tier involved manual edits, jumping to 26% in Advanced and 28% in the Classes & Functions tier.
  • Competence Reduces Interaction Volume: Students in the HighScore group (determined by exam scores $\ge$ 8/10) were much less reliant on manual editing, entering the edit loop in only 9.6% of sessions compared to 21.5% for the LowScore group. High-performing students also solved problems much faster, requiring significantly fewer total prompt messages to reach a successful solution.

Limitations and Future Work

The authors note a few limitations in their study setup. First, only the basic tasks were mandatory, meaning the advanced task data suffers from potential self-selection bias (stronger students completing optional work). Second, the study did not feature a strict A/B testing control group (e.g., comparing a prompting-only interface to a hybrid interface). Finally, the semantic content and quality of the natural language prompts were not directly analyzed.

For future work, the authors suggest designing exercises that intentionally introduce subtle bugs into AI completions to explicitly train students' "last-mile" debugging capabilities. They also propose exploring how these hybrid prompting-editing workflows scale to open-ended domains like data science and machine learning, where code refactoring demands are much larger.

Summary updated

BibTeX
@inproceedings{padurean2026interleaving,
  author = {Victor-Alexandru Pădurean and Alkis Gotovos and Ahana Ghosh and Paul Denny and Juho Leinonen and Andrew Luxton-Reilly and James Prather and Adish Singla},
  title = {{Interleaving Natural Language Prompting with Code Editing for Solving Programming Tasks with Generative AI Models}},
  booktitle = {ITiCSE},
  year = {2026},
  doi = {10.1145/3803400.3809312},
}
Figure