SocraticRepair improves stepwise tutoring for python debugging

SocraticRepair: Planning-Guided Socratic Tutoring for Program Debugging and Misconception Repair

Artificial IntelligenceMachine Learning

Summary

Large language models (LLMs) help teach programming but often reveal answers too quickly and lose track of what the learner is struggling with. The authors created SocraticRepair, a system that uses a planned series of guiding questions to help learners debug Python programs without giving away solutions too soon. They fine-tuned an LLM on simulated tutoring conversations and showed it provides better step-by-step help and asks higher-quality questions than a general LLM. The study also found that reliably creating teaching plans remains a key challenge.

What this means in practice

  • For coding bootcamp trainers: Offer automated Python debugging help that guides learners step-by-step without revealing answers prematurely.
  • For online learning platforms: Incorporate planned Socratic questioning to support programming learners’ debugging skills with interactive AI tutors.$Commercial implications: Enables AI-driven tutoring products that improve learner engagement and outcomes through adaptive questioning.

Authors

Mykhailo Kopytskyi, Jianhua Yang, Mir Seyedebrahimi

Abstract

Large language models are increasingly used in computer science education. However, the teaching abilities of even the most powerful LLMs are limited: they tend to reveal the solution prematurely and may lose focus on the learner's current debugging objective. To address this, we introduce SocraticRepair, a planning-guided Socratic tutoring framework for program debugging and miscon- ception repair that adapts prior planning-guided tutoring work (Li et al., 2026b). The framework is instantiated in the Python programming domain by fine-tuning Qwen2.5-Coder-7B-Instruct on synthetic multi-turn tutoring dialogues constructed from four preprocessed programming datasets. The system is evaluated using a predefined set of independent metrics and benchmarked against a general-purpose LLM. The experiments show that SocraticRepair achieves higher scores on stepwise scaffolding and question quality while also substantially reducing premature solution disclosure. The results also identify reliable pedagogical plan generation as an important remaining challenge.