NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Memory-Driven Self-Improvement with Large Language Models

Xue Yan, Zijing Ou, Mengyue Yang, Yan Song, Haifeng Zhang, Yingzhen Li, Jun Wang · Submission to ICLR 2026 · Withdrawn

TL;DR

Deploying Large Language Models (LLMs) as sequential decision-making agents often fails because general world knowledge does not transfer cleanly to domain-specific environments with sparse feedback. This paper introduces an Expectation-Maximization framework that couples an LLM action prior with a non-parametric, episodic memory table of past experiences and Q-values. The memory guides exploration and value estimation, while periodically refining the LLM prior via LoRA, yielding over a 40% gain on in-distribution tasks and a 75% gain on unseen environments in ALFWorld.

What Problem Does This Paper Address?

Text-based sequential decision-making (SDM) environments—such as household navigation or text-based coordination games—feature combinatorial, unstructured state and action spaces. Pretrained LLMs have strong zero-shot reasoning priors, but applying them directly to specialized tasks presents significant hurdles:

  1. Prompt-engineering and memory buffers (e.g., in-context learning): Rely heavily on foundation model size and struggle when task dynamics require learning from trial-and-error feedback.
  2. Reinforcement Learning Fine-Tuning (RLFT): On-policy RL algorithms like PPO suffer from notoriously poor sample efficiency when training billion-parameter models.
  3. Fixed LLM Priors: Constraining traditional RL search spaces with frozen LLMs can permanently bottle-neck performance if the LLM fails to suggest the optimal action.

The authors address this dilemma by asking: How can an LLM agent efficiently adapt to domain-specific environments without requiring massive online sample budgets or getting trapped by flawed initial priors?

Methods

The authors cast decision-making into the Control-as-Inference framework, optimizing an Evidence Lower Bound (ELBO) via an iterative Expectation-Maximization (EM) process called Mem-EM:

  • Episodic Memory Table ($M$): A non-parametric memory stores visited state-action pairs $(s, a)$, their dense vector representations $f(s, a)$ (derived from BERT or the LLM's encoder), and cumulative Monte Carlo returns $Q(s, a) \leftarrow \max\{Q(s, a), R_t\}$.
  • Role 1 — Memory-Driven Value Estimation (E-step): Given a state $s$, the LLM prior proposes $K$ candidate actions. The agent calculates a non-parametric value estimate $\hat{Q}(s, a)$ for each candidate by querying the $M$-nearest neighbors from memory using an inverse-distance kernel. Actions are then sampled from the inferred posterior: $$\pi(a|s) \propto \exp(\hat{Q}(s, a)/\tau) \cdot p_{\text{LLM}}(a|s)$$
  • Role 2 — Memory-Driven Prior Refinement (M-step): Instead of noisy, sample-inefficient on-policy updates, the agent uses self-normalized importance sampling over the memory table. It periodically fine-tunes the LLM's weights using LoRA by maximizing an off-policy, return-reweighted log-likelihood objective: $$\arg \max_{\theta} \sum_{(s,a) \sim M} \frac{\exp(Q(s, a)/\tau)}{\sum_{(s',a')} \exp(Q(s', a')/\tau)} \log p_{\text{LLM}_\theta}(a|s)$$

This establishes a closed loop: accurate non-parametric value estimation guides exploration toward high-reward trajectories, which enrich the memory table, which in turn distills task knowledge into the LLM prior so it generates better candidates in future steps.

Datasets

The authors evaluate their method on three textual decision-making environments:

  • ALFWorld: A text-based embodied environment benchmark featuring large, varying admissible action spaces (up to 50 actions per step) and sparse terminal rewards. Evaluated on ALFWorld(Pick) and ALFWorld(Examine) across thousands of subtasks, enabling seen and unseen task evaluation.
  • Textual Overcooked: A multi-step coordination and recipe preparation environment (Overcooked(Tomato) and Overcooked(Salad)) with intermediate reward shaping.
  • VirtualHome: A simulated household environment tested on a sparse-reward food-preparation task across 4 rooms.

Key Insights and Ideas

  • Decoupling Action Generation from Value Estimation: Instead of forcing the LLM to output accurate scalar values or evaluating all admissible actions, the LLM acts as an adaptive candidate filter (size $K$), while memory-based episodic control estimates action quality.
  • Few Updates, Huge Gains: Traditional RL updates policy weights continuously at every step. Mem-EM only needs periodic LoRA updates (e.g., just 6 fine-tuning events throughout 600 episodes), keeping GPU compute overhead modest while outperforming on-policy PPO.
  • Prior Refinement Enables Out-of-Distribution Generalization: Value estimators alone fail on unseen tasks because vector representations cannot extrapolate beyond visited states. Fine-tuning the LLM prior, however, successfully internalizes general rules (e.g., how to search containers in ALFWorld), allowing zero-shot success on novel environments.
  • Compact Memory is Sufficient: Experiments with a Least Recently Used (LRU) eviction policy show that a memory buffer storing only 200 state-action pairs achieves comparable results to keeping all 1,000+ pairs in Overcooked.

Key Results

  • ALFWorld Success Rates: Mem-EM with fine-tuning (Mem-EMw/ tune) achieved over a 40% absolute performance improvement on seen tasks compared to baseline LLM priors and DQN variants.
  • Unseen Task Generalization: On unseen tasks in ALFWorld(Pick) using Qwen2.5-7B, zero-shot LLM scored 0.19, whereas combining the refined LLM prior with the memory estimator reached 0.81 (over a 75% relative improvement).
  • Sample Efficiency over Baselines: On Overcooked(Tomato) and ALFWorld, Mem-EM converged significantly faster and to higher terminal rewards than PPO, standard DQN, DQN-Prior, and memory-prompting baselines like MemoryBank.
  • Cross-Model Transfer: Memory trajectories collected using Qwen2.5-7B on ALFWorld(Pick) were successfully used to fine-tune and boost the performance of smaller models (Qwen2.5-3B jumped from 0.05 to 0.85) and distinct architectures (LLaMA3-8B jumped from 0.0 to 0.83).

Limitations and Future Work

  • Action Space Assumptions: The framework is evaluated on environments with discrete, enumerable action sets where model outputs are mapped to environment actions via rule-based matching.
  • Representation Dependence: Value estimation accuracy depends on the semantic quality of the embedding space (e.g., BERT-base representations).
  • Future Directions: Extending the memory-driven EM paradigm to handle continuous or unbounded free-form text action spaces, and adapting the method to multimodal agents via Vision-Language Models (VLMs).

Summary updated

BibTeX
@misc{yan2025memory,
  author = {Xue Yan and Zijing Ou and Mengyue Yang and Yan Song and Haifeng Zhang and Yingzhen Li and Jun Wang},
  title = {{Memory-Driven Self-Improvement with Large Language Models}},
  year = {2025},
  eprint = {2509.26340},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.26340},
}

Loading related content...

Figure