Skip to content

Coldmist-Lu/AgentExit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentExit: On the Early-Exit Behavior of Large Language Model-based Agents in Embodied Environments

📄 Paper | 📚 Twitter/X

🎉 This work has been accepted by Findings of EMNLP 2025. 🎉


This repository presents AgentExit, a framework for large language model (LLM)-based agents to early exit when necessary.
It is built on AgentBoard, and provides the agent code for replication of the study as well as a plug-and-play tool for agent manipulation.

Abstract

Agents powered by large language models (LLMs) have demonstrated strong planning and decision-making capabilities in complex embodied environments. However, such agents often suffer from inefficiencies in multi-turn interactions, frequently trapped in repetitive loops or issuing ineffective commands, leading to redundant computational overhead. Instead of relying solely on learning from trajectories, we take a first step toward exploring the early-exit behavior for LLM-based agents. We propose two complementary approaches:

image
  1. an intrinsic method that injects exit instructions during generation,
  2. an extrinsic method that verifies task completion to determine when to halt an agent's trial.

To evaluate early-exit mechanisms, we introduce two metrics:

image
  1. Redundancy Steps: measures the reduction of redundancy steps as a positive effect,
  2. Progress Degradation: measures task progress loss via reduced subgoal completion as a negative effect.

Experiments with 4 different LLMs across 5 embodied environments show significant efficiency improvements, with only minor drops in agent performance. We also validate a practical strategy where a stronger agent assists after an early-exit agent, achieving better performance with the same total steps.

Usage

We provide several different setups, along with the agent and configuration:

Intrinsic Early Exit Extrinsic Early Exit Agent Configuration
React Style Agent React Baseline Config
✔️ React Style Agent Intrinsic Config
✔️ React Style Verify Agent Intrinsic Config
✔️ ✔️ React Style Extrinsic+Intrinsic Agent Extrinsic Intrinsic Config

We also adjust the datasets task workflow (ALFWorld, ScienceWorld, BabyAI, Jericho, PDDL), to permit actions such as "EXIT" to exit the interaction status. We also provide the react style example.

Explanation of Metrics

image

Please refer to this picture to explain the behavior of early exit for LLM-based agents.

  1. Perfect Early-Exit Scenario: The ideal scenario occurs when both RS and PR are zero, meaning no redundant steps and no progress loss.
  2. Too-Early Scenarios: Reduce redundant steps but significantly impair progress.
  3. Too-Late Scenarios: PD remains low but RS stays high.

Main Results & Findings

Statistical Results in Embodied Environments

image

We can see that:

  1. Early-exit mechanisms significantly reduce redundant steps.
  2. Minor performace drop in success and progress rates.
  3. LLMs show varying preferences for early exit strategies.
  4. Combining intrinsic and extrinsic early exit maximizes performance retention.
  5. Early-exit strategye generalizes to gaming environments.

Sample-wise Visualization

image

The results indicate that the earlyexit strategy has potential but remains imperfect redundant steps persist, and premature termination can still harm task progress. The PD metric provides a clearer view of these negative impacts, complementing RS as an efficiency measure.

Practical Implications

Stronger Agent's Assistance after Early-Exit

We simulate a practical scenario in embodied environments, where a weaker agent exits early from challenging environments and requests assistance from a stronger agent. We use ALFWorld as our testset, Mistral-24B-Instruct as the weak agent, and Llama3.1-70B-Instruct as the strong agent.

image

We find that early exit followed by strong agent assistance yields over a 10% improvement in success rate within the same 40-step budget. The implementation of the agent, followed by the other agent history can be seen in React Style Agent History.

Adaptation to Reflexion Framework

image

We adapt the Reflexion framework for a one-trial scenario: if an agent terminates early, it reflects on its trajectory and resumes the interaction within the same trial. We use Llama3.1-70b-Instruct as the backbone of LLM Agent and find that combining Early Exit with Reflexion significantly boosts both success and progress rates by over 10%, while keeping the average steps and token costs nearly identical to the baseline.

Citation

If you find this work helpful, please consider citing as follows:

@article{Lu2025AgentExit,
  title={Runaway is Ashamed, But Helpful: On the Early-Exit Behavior of Large Language Model-based Agents in Embodied Environments},
  author={Lu, Qingyu and Ding, Liang and Cao, Siyi and Liu, Xuebo and Zhang, Kanjian and Zhang, Jinxia and Tao, Dacheng},
  journal={arXiv preprint},
  url={https://arxiv.org/pdf/2505.17616},
  year={2025}
}

About

[AgentExit] On the early-exit behavior of large language model-based agents in embodied environments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published