Introduction
Reinforcement learning (RL) often struggles in environments where rewards are sparse—the "needle in a haystack" problem. Standard model-free RL agents learn by trial and error, but in environments where only a tiny fraction of states provide a reward signal, an agent might wander aimlessly for millions of steps before stumbling upon a success. While forward-looking world models (predicting the next state) can assist, they often struggle with long-term planning because small errors compound over time.
This paper proposes a novel approach: learning a backtracking model that predicts the states and actions that likely preceded a high-reward state. By generating these "Recall Traces" and training an agent to imitate them, the authors significantly improve the sample efficiency of both on-policy and off-policy RL algorithms.
The Backtracking Model
The core innovation is the Backtracking Model ($B_\phi$), which acts as a density estimator for the previous state-action pair given the current state: $q_\phi(s_t, a_t | s_{t+1})$.
Methodology
- Learning the Model: The agent stores its experiences in a buffer. The backtracking model is trained via maximum likelihood on the top $k\%$ of trajectories (those with the highest rewards). To ensure stability in continuous spaces, the model predicts the change in state ($\Delta s_t = s_t - s_{t+1}$) rather than the raw state.
- Generating Recall Traces: To create a trace, the agent picks a high-value state (either from its history or generated by a goal-proposing network) and recursively samples backward using the model. This creates a "hallucinated" trajectory of how one might have reached that high-value state.
- Policy Improvement: The agent then uses Imitation Learning to update its policy, treating these generated recall traces as "expert" demonstrations.
This approach can be interpreted as a form of Expectation-Maximization (EM), effectively maximizing a lower bound on the probability of achieving a high return by treating the trajectories as latent variables.
Experimental Evaluation
The researchers evaluated their method across several challenging RL benchmarks, including the Four-Room Grid World, MuJoCo Locomotion tasks (Half-Cheetah, Ant, Humanoid), and U-Maze Navigation.
Key Results
- Sample Efficiency: In the 19x19 Four-Room maze, the baseline Actor-Critic often failed to converge, while the backtracking-augmented version succeeded consistently and much faster. As shown in the results, the performance gap widens as the environment complexity (size) increases.
- MuJoCo Performance: On the Ant task, the backtracking model reached high reward levels significantly faster than standard TRPO or SAC.
- Coverage: In the U-Maze Ant task, the backtracking model achieved ~64% maze coverage in just 155 steps, whereas the GoalGAN baseline required 275 steps to reach the same level.
Discussion and Insights
Backtracking acts as an automatic curriculum; as the agent discovers better states, the model naturally focuses on more optimal paths. Unlike Prioritized Experience Replay (PER), which repeats old transitions, Recall Traces can generate new plausible paths to success, aiding exploration. The method is most powerful when rewards are rare, avoiding the "vanishing signal" problem common in forward-looking RL.
However, the method faces challenges such as compounding error (drift), where long traces may become unrealistic. Currently, trace lengths must be manually tuned. Additionally, the method relies on the agent finding at least some high-value states to begin the backtracking process. Future work may involve jointly training forward and backward models to "verify" the plausibility of generated traces.
Summary updated