Abstract
Standard reinforcement learning algorithms often rely on a recency heuristic, decaying credit exponentially over time via a scalar parameter $\lambda$. This approach struggles with long-term dependencies and distractor rewards. We propose replacing the fixed decay with learned, state-dependent pairwise weights. Using a metagradient framework, our agent learns to bridge temporal gaps and ignore irrelevant intermediate rewards. We demonstrate that this method significantly improves performance on complex credit assignment tasks like Key-to-Door and scales effectively to Atari 2600 games.
Introduction
Temporal Credit Assignment (TCA) is a fundamental challenge in Reinforcement Learning (RL): determining which past actions are responsible for a current reward. Most standard algorithms, such as TD($\lambda$), use a simple recency heuristic where credit decays exponentially. While computationally efficient, this heuristic fails in scenarios like the "Umbrella Problem," where a reward (staying dry) is causally linked to a distant action (picking up an umbrella) but separated by many irrelevant intermediate events.
This paper introduces a method to move beyond fixed recency by learning a pairwise weight function $f(s_t, s_k, k-t)$ that determines the credit assigned to state $s_t$ for a reward or error occurring at state $s_k$.
Methods
We introduce two advantage estimators that utilize a flexible pairwise weight function:
- Meta-PWTD (Pairwise Weighted TD-errors): Generalizes TD($\lambda$) by weighting temporal difference errors.
- Meta-PWR (Pairwise Weighted Rewards): Generalizes Monte-Carlo estimation by weighting raw rewards directly.
Metagradient Optimization
To optimize these complex weight functions, we employ a metagradient framework. In the inner loop, the agent interacts with the environment and updates its policy using the current weights. In the outer loop, a meta-learner updates the weight function parameters via gradient ascent to maximize the effectiveness of subsequent policy updates. For high-dimensional tasks, these weights are parameterized by a neural network taking state embeddings and time differences as input.
Experiments
We evaluated our approach on several benchmarks, including structured Directed Acyclic Graphs (DAGs), the Key-to-Door (KtD) task, and the Atari 2600 suite. The Key-to-Door task is particularly illustrative, as it requires the agent to collect a key, ignore distractor rewards (apples), and then use the key to open a door for a large reward.
Results
Beyond Recency in Key-to-Door
In the Key-to-Door task, Meta-PWR and Meta-PWTD successfully learned to "ignore" time. The models assigned high credit from the "Door" reward back to the "Key" state while effectively zeroing out credit for intervening "Apple" rewards. This behavior closely matches handcrafted weights designed with perfect task knowledge, as shown in the heatmaps.
Performance and Scalability
Our methods achieved lower total regret on bsuite credit assignment tasks compared to standard baselines. In Atari 2600, Meta-PWTD outperformed the A2C baseline in 30 out of 49 games, demonstrating that the overhead of learning meta-weights is justified even in general environments. Furthermore, as task depth increases, the proposed methods maintain significantly better sample efficiency than fixed-$\lambda$ baselines.
Discussion and Conclusion
By replacing the scalar $\lambda$ with learned pairwise weights, we enable agents to discover causal links across long temporal horizons. This approach reduces variance by ignoring "noisy" rewards unrelated to the initial action. While the metagradient approach introduces computational overhead and interpretability challenges in deep networks, it represents a significant step toward more robust and flexible credit assignment in RL.
Summary updated