TL;DR
AI agents using In-Context Reinforcement Learning (ICRL) can learn new tasks on the fly without updating their neural weights, but they typically assume the rules of the world stay frozen once a trial begins. This paper breaks that illusion by introducing Lifelong ICRL, testing how frozen-weight sequence models survive when gravity drifts or logical rules suddenly flip mid-lifetime without warning. Through massive-scale experiments, the authors show what it takes—in terms of training curricula, modern recurrent architectures, and data scale—to build agents that actively choose what to remember and what to forget.
What Problem Does This Paper Address?
Standard Deep Reinforcement Learning is notoriously slow to adapt, usually requiring expensive gradient updates every time a task changes. In-Context RL (ICRL) bypassed this by treating decision-making as a sequence modeling problem: feed an agent its past interaction history, and it figures out the task purely through forward passes, keeping its weights completely frozen.
There’s a catch, though: existing ICRL relies on the Episodic Stationarity Assumption. While tasks might change between separate trials, the underlying rules or physics remain static across all episodes within a single trial. The real world isn’t so polite—motors wear down gradually, and operating rules shift abruptly. Under standard ICRL, when the world changes mid-stream without an explicit reset button, an agent's past memory turns from a helpful guide into toxic interference. How do you get a frozen network to continuously track shifting realities, discard obsolete history, and still exploit recurring patterns?
Methods
The authors formalize Lifelong ICRL as a procedurally evolving Latent Markov Decision Process. Instead of sampling one static task per lifetime, they sample a dynamics evolution function that dictates how tasks shift across hundreds of episodes—with no change signals, no memory resets, and frozen policy weights.
Using standard PPO (reinforcement learning from rewards alone, no expert demonstrations), they systematically probe three dimensions:
- Training Regimes: Comparing standard Stationary training and Domain Randomization (DR, changing tasks every episode) against novel Non-Stationary (NS) and Composite Non-Stationary (CNS) curricula—where CNS mixes random switches with periodic recurrences—plus staged curricula (e.g., DR followed by NS).
- Sequence Architectures: Moving beyond standard quadratic-cost Transformers to test bounded-memory Sliding Window Attention (SWA) against modern linear-time recurrent models: Gated DeltaNet (fast-weight linear attention), Mamba2 (state-space model), and a Hybrid alternating Gated DeltaNet with local SWA.
- New Decoupled Metrics: Beyond raw returns, they measure Switch Resilience ($\Delta_{\text{Switch}}$, performance right after a rule change) and Stationary Adaptation ($\Delta_{\text{Static}}$, learning efficiency during stable periods) relative to a zero-shot baseline.
Datasets
In RL, environments are the datasets. Rather than static offline logs, the authors build a new Lifelong ICRL evaluation suite by extending two existing procedural benchmarks with intra-lifetime non-stationarity and Out-of-Distribution (OOD) test splits:
- XLand-Minigrid (Symbolic Reasoning): Agents navigate grid-worlds governed by hidden logical rules (up to 10B training steps; evaluated over 200-episode lifetimes on unseen, deeper depth-3 compositional rules).
- Kinetix (Physics Control): Agents control 2D rigid bodies, joints, and thrusters (1B training steps on chaotic procedural layouts; evaluated over 100-episode lifetimes on human-designed mechanical tasks with shifting gravity and friction).
Agents face three evaluation protocols: Stationarity, Random Switching, and Structured Non-Stationarity (Periodic Recurrence, Linear Drift, and Noisy Fluctuation).
Key Insights and Ideas
- Knowing how to remember doesn't mean knowing how to forget: Agents trained in stationary worlds learn to use context well, but completely crumble when rules switch mid-lifetime—performing significantly worse than if they had zero memory at all because they cling to obsolete rules.
- Early habits die hard ("forgetting bias"): You might think pre-training with Domain Randomization (new task every episode) before Non-Stationary fine-tuning is a smart curriculum. Surprisingly, it underperforms. Inspecting Gated DeltaNet's memory gates shows DR teaches the bottom layer to wipe its memory at episode boundaries—a reflex that stubbornly persists even after fine-tuning (clearing memory 58% of the time vs. 20% when trained on NS from scratch).
- Active memory revision shows up in hidden states: Measuring cosine similarity in hidden layers reveals that Stationary-trained agents barely budge their internal representations when tasks switch ($\Delta \approx 0$), whereas NS and CNS agents trigger sharp state shifts in middle and upper layers to flush out old context.
- Bounded attention hits a wall; recurrence shines: Sliding Window Attention (512-token window) struggles to even fit the meta-training distribution, whereas recurrent fast-weight/state-space models (Mamba2, Gated DeltaNet) and Hybrid designs effortlessly bridge dependencies across 200 episodes.
Key Results
Per-episode returns across training paradigms
- Training Regimes: On XLand Random Switch, Stationary training collapses to a sequence return ($R_{\text{Seq}}$) of
0.048(with a painful $\Delta_{\text{Switch}}$ of-0.112), while CNS hits0.153. Because CNS exposes agents to both switches and cycles, it generalizes best—even beating all baselines on unseen Drift protocols (0.214in XLand;0.028in Kinetix). - Architectures: Under XLand Random Switch, Hybrid (
0.153) and Mamba2 (0.147) crush Sliding Window Attention (0.048). In Kinetix, Mamba2 leads across the board (0.088on Random Switch vs.0.046for SWA). - Scale Coupling: Simply stacking more layers (from 6 to 24) at a fixed 10B-step budget doesn't monotonically improve performance; the 24-layer model needs 20B interaction steps to unlock higher returns (
0.155vs.0.146). - Crushing Gradient Updates: Compared against online gradient-based adaptation (Online PPO and PPO+EWC) on XLand Random Switch, Frozen LICRL achieves positive stationary adaptation (
+0.011vs.-0.085for PPO) and 240x lower variance across runs ($\sigma = 0.001$ vs. $\sigma \approx 0.24$).
Limitations and Future Work
While the main text does not feature a standalone limitations section (the provided excerpt concludes at Section 6 before the appendices), a few boundaries and future directions are noted in the text:
- Pure RL vs. Supervised Pretraining: The study focuses strictly on online RL from reward feedback without expert action labels. However, the authors suggest their non-stationary curricula could directly guide dataset construction for supervised pretraining approaches (like Decision-Pretrained Transformers or Algorithm Distillation) as a complementary future route.
- Finite Context & Compute Budgets: Persistent biases (like the DR forgetting reflex) and depth-scaling bottlenecks were observed within the tested 10B–20B step budgets, highlighting that scaling model capacity requires carefully matched interaction volumes.
Summary updated