Instruct, Not Assist: LLM-based Multi-Turn Planning and Hierarchical Questioning for Socratic Code Debugging

Priyanka Kargupta, Ishika Agarwal, Dilek Hakkani-Tur, Jiawei Han
6/17/2024
34 citations
cs.CLcs.MA

Official code: agarwalishika/TreeInstruct (20 stars, Python, Apache-2.0, last commit 2025-08-01).

Abstract

Socratic questioning is an effective teaching strategy, encouraging critical thinking and problem-solving. The conversational capabilities of large language models (LLMs) show great potential for providing scalable, real-time student guidance.

Show full abstract

However, current LLMs often give away solutions directly, making them ineffective instructors. We tackle this issue in the code debugging domain with TreeInstruct, an Instructor agent guided by a novel state space-based planning algorithm. TreeInstruct asks probing questions to help students independently identify and resolve errors. It estimates a student's conceptual and syntactical knowledge to dynamically construct a question tree based on their responses and current knowledge state, effectively addressing both independent and dependent mistakes concurrently in a multi-turn interaction setting. In addition to using an existing single-bug debugging benchmark, we construct a more challenging multi-bug dataset of 150 coding problems, incorrect solutions, and bug fixes -- all carefully constructed and annotated by experts. Extensive evaluation shows TreeInstruct's state-of-the-art performance on both datasets, proving it to be a more effective instructor than baselines. Furthermore, a real-world case study with five students of varying skill levels further demonstrates TreeInstruct's ability to guide students to debug their code efficiently with minimal turns and highly Socratic questioning.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

TreeInstruct is a novel method that uses state space estimation and dynamic tree-based questioning for multi-turn Socratic instruction, applied to code debugging.

203Python, ShellJun 18, 20241 years agoApache-2.0
conversational-aidialogue-systemseducationmulti-agent-systemsnatural-language-processing+1 more

Similar Papers

Cite this paper

@article{kargupta2024instruct,
  title  = {Instruct, Not Assist: LLM-based Multi-Turn Planning and Hierarchical Questioning for Socratic Code Debugging},
  author = {Priyanka Kargupta and Ishika Agarwal and Dilek Hakkani-Tur and Jiawei Han},
  year   = {2024},
  eprint = {2406.11709},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.11709v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.11709.svg)](https://codeofpaper.com/paper/2406.11709)

Discussion