Reinforcement learning (RL) agents often struggle with high sample complexity in environments where rewards are sparse or delayed. In these settings, random exploration rarely yields success. While Large Language Models (LLMs) can provide "common sense" priors and subgoal structures to guide early learning, relying heavily on them introduces scalability issues, high computational costs, and a dangerous dependence on potentially unreliable signals.
MIRA (Memory-Integrated Reinforcement Learning Agent) is a novel framework designed to bridge this gap. It leverages LLMs to provide high-level guidance without the prohibitive cost of constant supervision. By storing LLM-derived subgoals and trajectory segments in an evolving "memory graph," MIRA shapes early-stage learning and gracefully transitions to autonomous RL, achieving high performance with significantly fewer LLM queries than previous methods.
The Challenge of Sparse Rewards and LLM Supervision
In complex tasks—such as a robot needing to locate a key, unlock a specific door, and navigate a maze—an agent might take thousands of random steps before stumbling upon a reward. Existing approaches try to solve this by querying an LLM at every step to act as a "teacher." However, this per-step querying is slow, expensive, and creates a single point of failure: if the LLM hallucinates or goes offline, the agent fails.
The core challenge MIRA addresses is how to leverage LLM priors to accelerate early learning while maintaining the agent's autonomy and ensuring long-term convergence to the environment's actual reward function.
The MIRA Framework
MIRA introduces a structured approach to amortize the cost of LLM reasoning by integrating it into a persistent memory structure.
1. The Evolving Memory Graph
Instead of querying an LLM in real-time for every action, MIRA builds a persistent memory graph. Nodes in this graph represent trajectory segments and subgoals (e.g., "Go to the red door"), while edges represent hierarchical relationships. This graph is initialized offline with LLM suggestions and updated online. When the agent gets stuck, it requests "healthy grafts"—new trajectory segments generated by the LLM—to expand its memory.
2. Consistency-Based Screening
To mitigate the risk of LLM hallucinations, MIRA employs a screening unit. This unit filters out low-confidence or contradictory LLM suggestions before they can be grafted onto the memory graph, ensuring the agent only learns from reliable priors.
3. Adaptive Advantage Shaping
MIRA uses its memory graph to derive a utility signal ($U_t$). Crucially, MIRA does not alter the underlying environment reward, which can often lead to unintended "reward hacking." Instead, it uses this utility signal to shape the advantage estimate during policy updates (specifically for Proximal Policy Optimization, or PPO): $$ \tilde{A}_t = \eta_t A_t + \xi_t U_t $$
4. The Decay Mechanism
To preserve the theoretical convergence guarantees of standard RL, MIRA anneals these weights over time. The LLM's influence ($\xi_t$) decays toward zero, while the environment's true signal ($\eta_t$) ramps up to one. This ensures that the agent eventually relies entirely on its own experience.
Evaluation and Key Results
The authors evaluated MIRA across several challenging sparse-reward benchmarks, including Gymnasium ToyText and procedurally generated grid worlds from MiniGrid and BabyAI.
These environments included tasks like LavaCrossing (featuring irreversible hazards) and DoorKey (requiring complex dependencies, as seen above). MIRA was also tested on a custom Distracted DoorKey variant to evaluate its resilience against perceptual distractors that might confuse an LLM.
Key Findings: * Sample Efficiency: In harsh environments like LavaCrossing, standard PPO completely fails to learn, whereas MIRA rapidly reaches optimal returns. In DoorKey, MIRA achieves optimal performance in less than half the iterations required by hierarchical RL baselines. * Query Efficiency: MIRA achieves performance comparable to state-of-the-art "teacher" methods (like LLM4Teach) while using roughly 15x to 20x fewer LLM queries. For instance, MIRA required only ~30 queries compared to >500 for continuous teacher models. * Robustness: Thanks to its screening and pruning mechanisms, MIRA remains stable even when degraded or noisy LLM guidance is introduced late in training.
Limitations and Future Directions
Currently, MIRA's similarity functions and memory structures are optimized for discrete action spaces and grid-like environments. Furthermore, the annealing schedule for the advantage shaping requires careful hyperparameter tuning; decaying the LLM influence too quickly can cause the agent to lose the "trail," while decaying it too slowly risks over-reliance on biased priors.
Future work aims to extend MIRA to continuous control and vision-based domains (such as robotics) by utilizing latent representation comparisons (e.g., CLIP embeddings) instead of discrete state matching, opening the door to even more complex, multi-goal environments.
Summary updated