Abstract
Modern Reinforcement Learning (RL) often employs memory-intensive architectures like LSTMs and Transformers to navigate partially observed environments. However, determining whether a policy effectively utilizes its memory or merely reacts to immediate observations remains a challenge. This paper introduces Temporal Range (TR), a model-agnostic metric that quantifies the history length a policy considers during decision-making. By analyzing action sensitivity to past observations via Jacobians, TR provides a rigorous measure of "look-back" depth. Our evaluations on the POPGym benchmark demonstrate that TR accurately identifies task-specific memory requirements and can guide the optimization of context windows for efficient deployment.
Introduction
In RL, the transition from Markovian to partially observable Markov decision processes (POMDPs) necessitates agents with memory. While architectures like Recurrent Neural Networks (RNNs) and State-Space Models (SSMs) are standard, their actual memory usage is often a "black box." Researchers typically infer memory needs indirectly by comparing performance across different architectures. This approach conflates inductive bias with task demands. Temporal Range addresses this gap by providing a sequence-level, quantitative measure: "How many steps of history does this specific policy actually rely on?"
Methodology: Defining Temporal Range
The proposed Temporal Range metric is built upon first-order sensitivities:
- Jacobian Analysis: The core computation involves the Jacobian $\partial y_s / \partial x_t$, measuring how a small change in input at time $t$ affects the output at time $s$.
- Temporal Influence Profile: These magnitudes are aggregated over a temporal window to create an influence profile.
- Weighted Average Lag: The Temporal Range ($\hat{\rho}_T$) is defined as the magnitude-weighted average of these lags. A TR of 0 indicates reliance only on the current step, while higher values reflect deeper historical dependence.
- Axiomatic Foundation: For linear maps, this formulation is the unique metric satisfying calibration (returning $k$ for a $k$-step look-back task) and scale invariance.
- Differentiable Proxies: For non-differentiable policies, a compact Long Expressive Memory (LEM) network can be trained as a differentiable proxy to estimate the task's inherent memory demands.
Experimental Evaluation
The metric was validated using the POPGym benchmark and several diagnostic tasks designed to test specific memory depths:
- CartPole-v1: A near-Markovian baseline.
- Stateless CartPole: Requires history to infer hidden state variables like velocity.
- Copy-k (RepeatPrevious): Requires the agent to recall an observation from exactly $k$ steps ago.
Functional Validation through Window Ablations
A key test for TR is whether it predicts the minimum history window required for performance. By truncating an agent's history during testing, we observed that performance typically recovers only when the history window size $m$ meets or exceeds the measured Temporal Range.
Key Insights
- Architectural Differences: Even on the same task, architectures exhibit different memory "laziness." In CartPole, GRUs maintain a low TR (~1.8), whereas LSTMs and LEMs often retain longer histories (~9-10 steps) than strictly necessary.
- Policy vs. Value Heads: In actor-critic setups, the "Value" head frequently exhibits a longer TR than the "Policy" head, as estimating long-term returns inherently requires more historical context than immediate action selection.
- Efficiency Gains: TR allows for "shortest sufficient context" selection. Models deployed with history buffers truncated based on TR maintained >90% performance while significantly reducing memory overhead.
Conclusion and Future Work
Temporal Range provides a much-needed tool for auditing memory in RL. While currently a local measure that can vary across episodes, its ability to track observability requirements and architectural biases is significant. Future work includes using TR as a training regularizer to encourage memory-efficient policies and extending the metric to per-output ranges to dissect the memory requirements of complex action spaces.
Summary updated