Table of Contents
Fetching ...

Localizing and Correcting Errors for LLM-based Planners

Aditya Kumar, William W. Cohen

TL;DR

The paper tackles the problem that LLM-based planners frequently violate domain constraints in symbolic planning. It introduces Localized In-Context Learning (L-ICL), which identifies the first constraint violation in a model's reasoning trace and injects a minimal input-output correction into the relevant subroutine's prompt, iteratively building a bank of corrections during training. Across diverse domains such as gridworlds, mazes, Sokoban, and BlocksWorld, L-ICL achieves substantial gains and demonstrates sample efficiency relative to retrieval-based ICL, and it generalizes across multiple LLM architectures. The work provides a practical, architecture-agnostic approach to improving LLM reliability in planning by distilling domain knowledge into localized prompt corrections, while acknowledging that strategic long-horizon planning remains a remaining challenge.

Abstract

Large language models (LLMs) have demonstrated strong reasoning capabilities on math and coding, but frequently fail on symbolic classical planning tasks. Our studies, as well as prior work, show that LLM-generated plans routinely violate domain constraints given in their instructions (e.g., walking through walls). To address this failure, we propose iteratively augmenting instructions with Localized In-Context Learning (L-ICL) demonstrations: targeted corrections for specific failing steps. Specifically, L-ICL identifies the first constraint violation in a trace and injects a minimal input-output example giving the correct behavior for the failing step. Our proposed technique of L-ICL is much effective than explicit instructions or traditional ICL, which adds complete problem-solving trajectories, and many other baselines. For example, on an 8x8 gridworld, L-ICL produces valid plans 89% of the time with only 60 training examples, compared to 59% for the best baseline, an increase of 30%. L-ICL also shows dramatic improvements in other domains (gridworld navigation, mazes, Sokoban, and BlocksWorld), and on several LLM architectures.

Localizing and Correcting Errors for LLM-based Planners

TL;DR

The paper tackles the problem that LLM-based planners frequently violate domain constraints in symbolic planning. It introduces Localized In-Context Learning (L-ICL), which identifies the first constraint violation in a model's reasoning trace and injects a minimal input-output correction into the relevant subroutine's prompt, iteratively building a bank of corrections during training. Across diverse domains such as gridworlds, mazes, Sokoban, and BlocksWorld, L-ICL achieves substantial gains and demonstrates sample efficiency relative to retrieval-based ICL, and it generalizes across multiple LLM architectures. The work provides a practical, architecture-agnostic approach to improving LLM reliability in planning by distilling domain knowledge into localized prompt corrections, while acknowledging that strategic long-horizon planning remains a remaining challenge.

Abstract

Large language models (LLMs) have demonstrated strong reasoning capabilities on math and coding, but frequently fail on symbolic classical planning tasks. Our studies, as well as prior work, show that LLM-generated plans routinely violate domain constraints given in their instructions (e.g., walking through walls). To address this failure, we propose iteratively augmenting instructions with Localized In-Context Learning (L-ICL) demonstrations: targeted corrections for specific failing steps. Specifically, L-ICL identifies the first constraint violation in a trace and injects a minimal input-output example giving the correct behavior for the failing step. Our proposed technique of L-ICL is much effective than explicit instructions or traditional ICL, which adds complete problem-solving trajectories, and many other baselines. For example, on an 8x8 gridworld, L-ICL produces valid plans 89% of the time with only 60 training examples, compared to 59% for the best baseline, an increase of 30%. L-ICL also shows dramatic improvements in other domains (gridworld navigation, mazes, Sokoban, and BlocksWorld), and on several LLM architectures.
Paper Structure (148 sections, 3 equations, 14 figures, 8 tables, 2 algorithms)

This paper contains 148 sections, 3 equations, 14 figures, 8 tables, 2 algorithms.

Figures (14)

  • Figure 1: Overview of L-ICL. The prompt template follows PTP: it includes documentation for each subroutine but no executable code. Prompting an LLM produces a trace that follows the format of the $k$ provided example traces. The trace is parsed to find the first failing step, and the failing input is passed to an oracle that returns the correct output. This yields a localized example (e.g., $x{=}\texttt{\small (5,4)}$, $y{=}\texttt{\small ['move\_east','move\_west']}$) that is inserted into the subroutine's documentation. This process iterates over training instances to accumulate examples in a failure-driven manner.
  • Figure 2: 8$\times$8 Gridworld learning curves. Success and Optimal rates vs. training examples. L-ICL (without being given the ASCII grid) improves rapidly in the first 30--60 examples, substantially outperforming all baselines, which are given access to the ASCII grid (horizontal line shows best baseline).
  • Figure 3: Sample efficiency: L-ICL vs. RAG-ICL. Success rate vs. context size (characters) on 8$\times$8 Gridworld. L-ICL achieves higher performance with substantially less context.
  • Figure 4: Grid representation ablation on 10$\times$10 Maze. The ASCII grid accelerates early learning but does not change peak performance. Without L-ICL, the grid provides little benefit.
  • Figure 5: L-ICL across LLM architectures. Success rate on 10$\times$10 Maze for four models. All improve substantially; Claude Sonnet 4.5 shows the largest gains (10% $\to$ 74%).
  • ...and 9 more figures