Retrieval-Augmented LLM Agents: Learning to Learn from Experience

Thomas Palmeira Ferraz, Romain Deffayet, Vassilina Nikoulina, Hervé Déjean, Stéphane Clinchant · DOI · OpenReview

Abstract

While large language models (LLMs) have advanced the development of general-purpose agents, achieving robust generalization to unseen tasks remains a significant challenge. Current approaches typically rely on either fine-tuning or training-free memory-augmented generation using retrieved experience; yet both have limitations: fine-tuning often fails to extrapolate to new tasks, while experience retrieval often underperforms compared to supervised baselines. In this work, we propose to combine these approaches and systematically study how to train retrieval-augmented LLM agents to effectively leverage retrieved trajectories in-context. First, we establish a robust supervised fine-tuning (SFT) recipe using LoRA that outperforms several state-of-the-art agent training pipelines. Second, we provide a detailed analysis of key design choices for experience retrieval, identifying optimal strategies for storage, querying, and trajectory selection. Finally, we propose a pipeline that integrates experience retrieval into the fine-tuning process. Our results demonstrate that this combined approach significantly improves generalization to unseen tasks, providing a scalable and effective framework for building agents that learn to learn from experience.

Introduction

Building general-purpose agents capable of navigating diverse environments—from household chores to scientific experimentation—is hindered by the generalization gap. Current methodologies generally fall into two categories: Supervised Fine-Tuning (SFT) and Training-Free Retrieval-Augmented Generation (RAG). SFT models often excel at specific tasks but suffer from "task collapse" when facing novel scenarios. Conversely, RAG-based agents utilize past experiences in-context but frequently underperform relative to specialized models. This research introduces a middle ground: training agents to natively utilize an "Experience Bank" to solve problems they were never explicitly trained for.

The ExpRAG Framework

The proposed ExpRAG (Experience Retrieval-Augmented Generation) framework integrates retrieval into the agent's decision-making loop. The system consists of an offline Experience Bank containing encoded agent trajectories and an online retrieval mechanism.

The ExpRAG Agent architecture, illustrating the flow from the Experience Bank to the LLM policy and the interaction with the world environment.

The core innovation, ExpRAG-LoRA, involves fine-tuning the model using Low-Rank Adaptation (LoRA) while simultaneously providing retrieved trajectories in the prompt. This forces the agent to learn the relationship between retrieved "memories" and the current task, effectively teaching it to use the context as a procedural manual. To optimize training, trajectories are formatted as multi-turn conversations, enabling efficient KV-cache reuse.

Experimental Setup

The framework was evaluated on two text-based embodied environments: ALFWorld (household simulator) and ScienceWorld (complex science experiments). Tasks were partitioned into Easy (seen during training) and Hard (unseen categories) to rigorously test out-of-distribution (OOD) generalization. This "Hard" split serves as the primary benchmark for the agent's ability to extrapolate knowledge.

Key Results and Analysis

The study reveals several critical findings regarding agent training and retrieval strategies:

  1. Delayed Downstream Generalization: The authors observed a "grokking" effect where extended training (up to 50 epochs) improved success rates on new tasks even as validation loss increased, suggesting the model learns more robust strategies over time.
  2. Retrieval Strategy Impact: As shown in the detailed results, increasing the number of retrieved trajectories (Top-$K$) generally improves performance, particularly for "Hard" tasks. Dynamic retrieval—re-querying at every step—often provides a slight edge over static retrieval in complex scenarios by providing more relevant context as the task progresses.
Performance of ExpRAG across different retrieval strategies (static vs. dynamic), Top-K values, and task difficulties in ALFWorld and ScienceWorld.
  1. Generalization Power: ExpRAG-LoRA significantly boosts OOD performance. For instance, on "Hard" ALFWorld tasks, success rates for a Ministral 3-8B model jumped from 34.4% (standard LoRA) to 88.5% with ExpRAG-LoRA. Larger models like Qwen 2.5-7B saw even more dramatic gains in ScienceWorld, jumping from 7.8% to 29.7%.
  2. Baseline Strength: The optimized LoRA baseline alone achieved 94.1% on ALFWorld's standard unseen split, surpassing many complex state-of-the-art pipelines.

Conclusion

ExpRAG-LoRA provides a scalable framework for agents to "learn to learn" from experience. By combining the strengths of fine-tuning with the flexibility of retrieval, the system achieves state-of-the-art performance on challenging unseen tasks. Future work will focus on transitioning from scripted expert trajectories to self-generated experiences and exploring "read-write" memory systems that allow agents to update their knowledge bases in real-time during task execution.

Summary updated

BibTeX
@inproceedings{ferraz2026retrieval,
  author = {Thomas Palmeira Ferraz and Romain Deffayet and Vassilina Nikoulina and Hervé Déjean and Stéphane Clinchant},
  title = {{Retrieval-Augmented LLM Agents: Learning to Learn from Experience}},
  booktitle = {MemAgent @ ICLR},
  year = {2026},
  doi = {10.48550/arxiv.2603.18272},
}
Figure