TL;DR
Current Large Language Model (LLM) agents are typically static or suffer from "prompt bloat" when trying to remember past interactions. This paper introduces EvoSC, a framework that enables agents to continuously evolve by analyzing both successes and failures via contrastive reflection, while consolidating long-term memories into compact, learnable prompt parameters to prevent context window explosion.
What Problem Does This Paper Address?
While LLM agents excel at isolated tasks, they are fundamentally stateless—resetting after every session without accumulating lifelong knowledge.
To fix this, recent approaches have tried "textual replay," where an agent retrieves raw text logs of past successful interactions and inserts them into its current prompt. However, this paradigm has two major flaws:
- Ignoring Failures: By focusing only on successes, agents miss out on the rich pedagogical value of their mistakes, making them prone to repeating the same pitfalls.
- The Context Wall: As an agent accumulates experiences over time, the text history grows linearly. This causes "prompt explosion," which increases latency, introduces distracting noise, and eventually triggers Out-Of-Memory (OOM) crashes when the LLM's context window limit is breached.
Methods
The authors propose EvoSC (Self-Consolidation for Self-Evolving Agents), a dual-memory framework that mimics human cognitive memory consolidation by separating short-term text memory from long-term parametric memory.
The architecture relies on two key mechanisms:
- Non-parametric Contrastive Extraction: Instead of just replaying successful runs, EvoSC pairs a failed trajectory with a successful one. By contrasting them, the LLM pinpoints exactly where the logic diverged and explicitly extracts two pieces of text guidance: error-prone insights (what pitfalls to avoid) and success patterns (what logic to replicate). These are managed in a short-term FIFO queue.
- Parametric Trajectory Consolidation: To handle long-term history, EvoSC periodically distills extensive text trajectories into a small set of compact, learnable prompt tokens ($P_\theta$). Using a student-teacher distillation setup, the agent minimizes token-level cross-entropy loss to internalize successful reasoning directly into its latent space.
During inference, the agent uses a hybrid input: the consolidated parametric prompt ($P_\theta$) provides long-term intuition, while a few explicitly retrieved recent text logs provide immediate context.
Datasets
EvoSC was evaluated using LifelongAgentBench, a benchmark designed to assess knowledge accumulation, retention, and transfer across three distinct interactive environments:
- Database (DB): 500 tasks requiring MySQL operations and complex SQL generation.
- Operating System (OS): 500 tasks involving Bash command execution and system administration.
- Knowledge Graph (KG): 396 tasks requiring multi-hop API interactions and long reasoning chains.
Key Insights and Ideas
- Failures are Highly Informative: Successes within a task category often look identical, but failures diverge at critical decision points. Juxtaposing them makes the exact logical flaw highly apparent to the agent.
- Parametric Memory Consolidation: Raw text is excellent for immediate context but terrible for long-term storage. Compressing history into continuous prompt weights allows the agent to retain "intuition-like" knowledge without burning token slots.
- Sustained Growth vs. Performance Degradation: Traditional text-replay agents actually get worse or crash as they live longer because their prompts become bloated with noise. EvoSC maintains a stable, upward learning curve as experience scales.
Key Results
The authors evaluated EvoSC using Llama 3.1-8B-Instruct and Qwen 2.5-7B-Instruct against strong baselines (AWM, TER, SCM, and A-MEM).
- Database & OS Tasks: On the DB dataset, EvoSC achieved an average performance boost of +6.7% using Llama 3.1-8B. On the OS dataset, it improved performance by +4.4% using Qwen 2.5-7B.
- Knowledge Graph Tasks: Because KG tasks involve longer reasoning chains, the benefits of memory consolidation were even more pronounced. EvoSC achieved average improvements of +5.7% (Llama) and +10.6% (Qwen).
- Overcoming Context Limits: When the number of historical experiences scaled up to 32, all baseline methods suffered from Out-Of-Memory (OOM) errors on the Qwen model due to context limits. EvoSC avoided this entirely, maintaining a steady upward trend in success rate without exceeding hardware constraints.
Limitations and Future Work
- Simplistic Retrieval: The current experience retrieval mechanism is relatively basic, which can limit the immediate reasoning capacity of the agent. The authors plan to explore more advanced retrieval methodologies in future work.
- Model Scale: Due to computational constraints, experiments were restricted to 7B and 8B parameter models. Evaluating the scalability of EvoSC on larger architectures (e.g., 70B+) remains a key priority to fully unlock the potential of parametric experience consolidation.
Summary updated