TL;DR
This paper introduces "Sweet&Sour" (S&S), a novel approach to enhance the performance of AI agents in text-based games by incorporating reflections on positive experiences alongside failures. This method, combined with a managed memory system, leads to more robust and adaptable agents, especially when using smaller language models.
What Problem Does This Paper Address?
Intelligent agents navigating complex text-based games (TBGs) face significant challenges in reasoning and adaptability. While large language models (LLMs) have shown promise, especially with self-reflection, they often struggle when initial attempts are successful or when using smaller models. Existing self-reflection methods primarily focus on learning from failures, overlooking the potential of positive experiences to reinforce successful strategies and build a more balanced understanding. This gap limits the agents' ability to generalize and adapt effectively, particularly in scenarios where they might encounter early successes followed by a "tilt" when a failure occurs.
Methods
The core innovation is the Sweet&Sour (S&S) approach, which augments existing LLM-based agents with a structured reflection mechanism. Unlike methods that only learn from negative feedback, S&S actively prompts the agent to articulate what led to both successful (sweet) and unsuccessful (sour) outcomes.
Key components include:
- Positive Experience Reflection: When an agent achieves a subgoal, S&S queries it to explain the successful strategy. This insight is stored in short-term memory (STM) for immediate use within the current episode.
- Managed Memory: A dual-buffer system separates reflections. Short-term memory (STM) stores positive reflections from the current episode and is reset after each episode. Long-term memory (LTM) stores negative reflections from failed episodes and positive reflections transferred from STM after a successful episode. This provides a persistent knowledge base across multiple attempts.
- Structured Reflection Generation: For successes, the agent verbalizes what made its policy effective and generalizable. For failures, it proposes alternative actions and a revised plan for the next attempt.
This approach is integrated with an LLM acting as the agent's policy, conditioning its action generation on current observations and retrieved memories.
Datasets
The primary dataset used for evaluation is ScienceWorld, a benchmark designed for science experiment tasks across interconnected locations. The authors chose ScienceWorld due to its suitability for current LLM-based agents. They also conducted additional experiments on the ALFWorld benchmark, which features embodied tasks in common household environments.
Key Insights and Ideas
- The Power of Positive Reinforcement in Reflection: The most significant insight is that learning from successes is as crucial as learning from failures for robust agent performance. Simply focusing on errors can lead to agents getting "stuck" when they encounter their first failure after a series of successes (the "tilt" phenomenon).
- Managed Memory for Contextual Awareness: The dual-buffer short-term/long-term memory system effectively balances immediate contextual awareness within an episode with accumulated knowledge across episodes. This allows for more informed decision-making.
- Improved Performance with Smaller LLMs: S&S demonstrates a notable advantage when using smaller LLMs, making advanced AI capabilities more accessible and computationally efficient. This is a critical finding for practical deployment.
- Complementarity of Reflection Types: Ablation studies showed that while positive reflections alone improve performance, they are less effective than negative reflections. However, the combination of both, along with managed memory, yields the superior results.
Key Results
- ScienceWorld Benchmark: Sweet&Sour consistently outperformed baselines (ReAct and Reflexion) across all tested LLM sizes (GPT-40, Mistral Large 2, Llama 3.1 8B). The average success score for S&S with GPT-40 was 54.6.
- Performance Gap with Smaller Models: The performance advantage of S&S was particularly pronounced with smaller models. For instance, on Mistral Large 2, S&S achieved 44.6 compared to Reflexion's 27.6, and on Llama 8B, it reached 32.5 versus Reflexion's 21.7.
- ALFWorld Benchmark: S&S also showed strong performance on ALFWorld, achieving near-perfect scores with larger models, indicating its generalizability.
- Ablation Studies: Removing positive reflections significantly dropped performance, while using only positive reflections still improved upon the ReAct baseline but was less effective than negative reflections alone. The full S&S approach, combining both, was superior.
Limitations and Future Work
- Limitations:
- LLMs do not guarantee reasoning capabilities, and their reliance on textual reflection might introduce biases or inconsistencies.
- The evaluation was conducted on a single environment (ScienceWorld), and further studies are needed to assess generalization to other interactive scenarios and real-world decision-making.
- Future Work:
- Exploring the application of S&S to additional environments, including embodied ones.
- Investigating how agents trained with S&S generalize to real-world decision-making scenarios.
- Further research into mitigating potential biases and inconsistencies introduced by LLM-based reflection.
Summary updated