Self-Abstraction from Grounded Experience for Plan-Guided Policy Refinement

Hiroaki Hayashi, Bo Pang, Wenting Zhao, Ye Liu, Akash Gokul, Srijan Bansal, Caiming Xiong, Semih Yavuz, Yingbo ZhouarXiv 2025 · DOI

Introduction

Large language model (LLM) agents are increasingly tasked with solving complex, long-horizon software engineering problems, such as repository-level bug fixing. However, current agent frameworks often operate in a static manner: if an agent fails a task, it typically restarts from scratch, failing to leverage the insights gained from its previous attempt. While "reflection" mechanisms have been proposed to address this, they often overwhelm the model with raw, noisy trajectories that exceed context windows and obscure actionable insights.

This paper introduces Self-Abstraction from Grounded Experience (SAGE), a framework designed to distill noisy trial-and-error rollouts into concise, high-level plans. By using these abstracted plans to guide subsequent attempts, SAGE enables agents to learn from their own grounded experience at test-time, significantly improving performance on complex benchmarks.

The SAGE Framework

SAGE operates as a test-time adaptation framework through three distinct stages: Exploration, Plan Abstraction, and Plan-augmented Execution.

  1. Exploration: The agent performs an initial attempt at the task using its standard policy. This generates a raw trajectory containing actions, environment observations, and intermediate test results.
  2. Plan Abstraction: A reviewer LLM analyzes the raw trajectory to identify core logic and failure points. It distills this experience into an "Induced Plan" consisting of three components: Analysis (what happened), Feedback (what went wrong), and a Suggested Plan (how to improve).
  3. Plan-augmented Execution: The agent re-attempts the task, but its prompt is now augmented with the Induced Plan. This plan serves as a contextual scaffold, guiding the agent's decision-making and helping it avoid previous pitfalls.

From a theoretical perspective, SAGE can be viewed as a temporal abstraction over actions (an "option" in Reinforcement Learning) or a two-episode case of Posterior Sampling for Reinforcement Learning (PSRL).

Experimental Setup

The framework was primarily evaluated on SWE-bench Verified, a dataset of 500 human-verified GitHub issues requiring complex program repair. To ensure evaluation stability, the authors manually corrected several false negatives in the official gold patches related to deprecated dependencies and transient errors.

SAGE was tested across various frontier models, including GPT-5, GPT-5-mini, Claude Sonnet 4.5, and Gemini 2.5 Pro, using different agent architectures like mini-swe-agent and OpenHands CodeAct.

Results

SAGE consistently improved resolution rates across all tested models and architectures. For instance, using the mini-swe-agent framework, the GPT-5 (high) model's resolution rate increased from 66.6% to 71.4%. When applied to the more tool-rich OpenHands CodeAct framework, the same model reached a 74.0% resolution rate.

Pass rate vs. ensemble size (N) using different selection strategies, showing the effectiveness of the Gemini-2.5 Pro Judge.

Furthermore, the authors explored the power of ensembling. By generating multiple patches with different actor/planner combinations and using an LLM-as-a-judge (Gemini 2.5 Pro) to select the best candidate, the system achieved a robust 74.6% resolution rate. As shown in the ensemble analysis, the judge-based selection significantly outperforms the average pass rate and approaches the oracle "Best-of-N" performance as the ensemble size increases.

Key Insights and Discussion

Several critical findings emerged from the study:

  • Abstraction vs. Raw Reflection: Structured abstraction is superior to raw episodic or stepwise reflection. Feeding raw logs back to the agent often results in negligible gains or even performance degradation due to noise.
  • Heterogeneous Roles: Using a different, often stronger LLM for the Plan Abstraction phase helps mitigate self-bias, as models can be overly attached to their own initial logic.
  • Plan Attribution: Success in second attempts strongly correlates with the agent's adherence to the Induced Plan. Code edits in successful "flipped" cases (failure to success) frequently mapped directly to the plan's specific advice.
  • Evaluation Integrity: The authors identified a "Git Leakage" vulnerability where agents could use commands like git log to peek at future commits (the actual fixes). This underscores the necessity for strictly safeguarded Docker environments in SWE benchmarks.

Conclusion

SAGE demonstrates that distilling grounded experience into high-level abstractions is a powerful method for refining agent policies at test-time. By moving beyond raw reflection to structured plan induction, SAGE achieves state-of-the-art results on SWE-bench Verified. Future work will focus on extending this framework to multi-episode continuous learning loops and developing more robust evaluation safeguards.

Summary updated

BibTeX
@misc{hayashi2025self,
  author = {Hiroaki Hayashi and Bo Pang and Wenting Zhao and Ye Liu and Akash Gokul and Srijan Bansal and Caiming Xiong and Semih Yavuz and Yingbo Zhou},
  title = {{Self-Abstraction from Grounded Experience for Plan-Guided Policy Refinement}},
  year = {2025},
  eprint = {2511.05931},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.05931},
}
Figure