NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DebugTA: An LLM-Based Agent for Simplifying Debugging and Teaching in Programming Education

Lingyue Fu, Haowei Yuan, Datong Chen, Xinyi Dai, Qingyao Li, Weinan Zhang, Weiwen Liu, Yong YuarXiv 2025 · OpenReview

Abstract

In programming education, Debugging and Teaching (DT) task is a common scenario where students receive assistance in correcting their erroneous code. The task involves multiple inputs, including erroneous code, error messages, reference solutions, and the question description, with the goal of generating modification suggestions to the erroneous code. However, two key challenges hinder the effectiveness of existing approaches. Firstly, the complexity and heterogeneity of inputs inherent in DT tasks significantly elevate the reasoning challenges faced by LLMs. Second, existing approaches often fail to fully leverage the availability of standard code in DT tasks, forcing models to rely solely on complex multi-step reasoning, which limits the potential of LLMs in addressing DT tasks effectively. To address these challenges, we propose DebugTA, a novel LLM-based debugging and teaching agent with specialized tools for standard code retrieval, variable substitution to align reference code, and an external compiler for real-time code analysis. Guided by explicit pedagogical and debugging principles, DebugTA acts as an agent that decomposes a complex task into sequential LLM interactions, each utilizing distinct tools for specific subtasks, thereby simplifying the logical reasoning at each step and reducing overall reasoning complexity. Furthermore, DebugTA utilizes tool calls to align the standard code with the erroneous code as much as possible, allowing the LLM to focus on logic errors within the erroneous code and improving the accuracy of the generated suggestions. To rigorously assess the quality of modification suggestions, we introduce a student simulator-teacher interaction paradigm. Experimental results on three real-world code datasets demonstrate that DebugTA consistently improves teaching effectiveness while significantly reducing computational costs.

Introduction

In programming education, the "Debugging and Teaching" (DT) task is notoriously difficult for AI. Unlike simple code generation, DT requires an agent to reconcile four heterogeneous inputs: the student's erroneous code, compiler error messages, the problem description, and a reference solution.

The authors identify two primary hurdles that hinder current LLM performance:

  1. Reasoning Complexity: Dumping all these inputs into a single prompt overwhelms LLMs, leading to imprecise or "hallucinated" suggestions.
  2. Underutilization of Reference Code: Simply providing a standard solution often confuses the model because the student's variable names and coding style differ from the reference. This often results in the model suggesting superficial changes or, worse, leaking the full answer (plagiarism) rather than teaching the underlying logic.

Methodology: The DebugTA Framework

DebugTA tackles these issues through an agentic framework that breaks the debugging process into sequential, manageable sub-tasks. Instead of a massive context window, DebugTA uses a dictionary-based memory to selectively provide only the necessary code snippets or error logs for each specific step.

The DebugTA framework architecture, highlighting the three main tasks: Standard Code Retrieval (T1), Variable Substitution for alignment (T2), and External Compiler Integration (T3).

Key components of the agent include:

  • Standard Code Retrieval: Uses BM25 token similarity to find the most structurally similar correct solution from a pool of reference codes.
  • Variable Substitution (Alignment): This is the core innovation. It converts both the student and reference code into LaTeX-style pseudocode to map variable correspondences. It then renames variables in the reference code to match the student's, "aligning" the two versions so the LLM can focus purely on logic differences.
  • External Compiler Integration: Provides real-time syntax validation to catch "easy" errors before moving to complex logic analysis.

Experimental Evaluation

The researchers evaluated DebugTA on three real-world datasets representing different difficulty levels: CodeApex (entry-level), ACMOJ (algorithmic), and Code4Bench (competitive programming). To evaluate the agent, the authors created "StuBot," an LLM-based simulator that attempts to fix its code based on the agent's suggestions, mimicking a real student-teacher interaction loop.

Performance comparison (AC Rate) of DebugTA against baselines and ablation versions, demonstrating the significant impact of the alignment and retrieval components.

Key Results

DebugTA consistently outperformed all baselines (including Direct Debugging and Self-Reflection methods) across all datasets and backbone models:

  • Accuracy Boost: On the challenging ACMOJ dataset, DebugTA improved the "Pass All Test Cases" (AC Rate) significantly compared to the original erroneous code and standard baselines.
  • Alignment > Raw Information: A striking finding is that providing a reference solution without alignment often degrades LLM performance. Models get distracted by different variable names rather than focusing on the algorithm. DebugTA’s alignment tool fixes this "misalignment" problem.
  • Lowering the Reasoning Floor: Because the agent decomposes the task into simple steps, smaller, more efficient models (like Qwen-7B or DeepSeek-16B) can perform as well as or better than much larger models using traditional prompting.

Conclusion and Future Work

DebugTA demonstrates that a specialized agentic approach can effectively simplify complex debugging tasks in programming education. By focusing on "modification suggestions" and aligning reference code to the student's existing structure, the agent significantly reduces plagiarism while improving pedagogical value.

Future work aims to address the "cold start problem" for new exercises where no reference solutions exist and to develop more advanced "Socratic" guidance that provides conceptual hints rather than direct modification suggestions.

Summary updated

BibTeX
@misc{fu2025debugta,
  author = {Lingyue Fu and Haowei Yuan and Datong Chen and Xinyi Dai and Qingyao Li and Weinan Zhang and Weiwen Liu and Yong Yu},
  title = {{DebugTA: An LLM-Based Agent for Simplifying Debugging and Teaching in Programming Education}},
  year = {2025},
  eprint = {2510.11076},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.11076},
}
Figure