A First-Occupancy Representation for Reinforcement Learning

Ted Moskovitz, Spencer R Wilson, Maneesh Sahani

Introduction

In Reinforcement Learning (RL), agents often struggle to balance the simplicity of "model-free" methods (learning by trial and error) with the power of "model-based" methods (planning with a map). The Successor Representation (SR) was designed as a powerful middle ground, caching the environment's structure by recording expected future state occupancies.

However, the SR has a significant limitation: it assumes rewards are Markovian, meaning they remain in place and can be collected repeatedly. In the real world, rewards are often ephemeral (e.g., food is gone once eaten), or the agent's goal is simply to reach a destination as fast as possible. Because the SR sums up all future visits to a state, it struggles to distinguish between a policy that reaches a goal quickly and one that reaches it slowly but lingers there for a long time.

Comparison of policy evaluation under SR (M) and FR (F)

To resolve this "how often vs. how soon" discrepancy, this paper introduces the First-Occupancy Representation (FR). Unlike the SR, which tracks how often an agent visits a state, the FR measures the expected time (via a discount factor) until an agent first reaches a state, making it significantly more effective for tasks involving one-time rewards, efficient path planning, and exploration.

The First-Occupancy Representation (FR)

While the SR measures the cumulative discounted occupancy of a state, the FR measures the expected temporal discount to the first time a state is accessed. The authors introduce several key technical contributions to make this representation practical for RL agents:

  • The FR Bellman Equation: The authors derive a recursive relationship for the FR. This allows the representation to be learned using standard Temporal Difference (TD) learning, much like traditional value functions.
  • First-Occupancy Features (FF): To handle continuous or infinite state spaces, the authors extend the FR concept to "features." Instead of tracking discrete states, the representation tracks when a specific feature threshold is first crossed.
  • FR-Planning (FRP): A novel planning algorithm is introduced that uses the FR to chain together "subgoals." Because the FR naturally encodes the "distance" (in discount space) between states, the agent can mathematically solve for the shortest path across a sequence of policies.

Key Capabilities and Insights

Shortest Path Encoding

Because the FR only evaluates the first time a state is encountered, it inherently encodes the shortest path under a given policy. This makes it a vastly superior tool for navigation compared to the SR, which can be easily distracted by policies that loop or linger near a goal rather than reaching it efficiently.

Trajectories generated by Generalized Policy Improvement using SR (red) and FR (blue)

Handling Non-Markovian Rewards

The FR is "task-agnostic" for rewards that disappear after one use. By multiplying the FR by a reward vector, an agent can immediately compute the value function for a "collect-once" task without needing to relearn the environment's dynamics.

Superior Exploration Bonus

The authors demonstrate that the FR serves as an excellent exploration bonus. Unlike traditional count-based bonuses that vanish as an agent stabilizes its behavior, the FR bonus remains effective because it only grows when the agent discovers shorter paths or entirely new states.

Biological Plausibility

Interestingly, the paper shows that FR-based agents mimic the "subgoal" behavior observed in mice escaping threats. This suggests that biological brains might utilize a mechanism closer to the FR than the SR for rapid, goal-directed escape planning.

Empirical Evaluation

The authors evaluated the FR across a diverse set of challenging environments, demonstrating strong performance gains over existing baselines:

  • Exploration in DeepSea: In the bsuite DeepSea environment—a challenging grid where the state space grows and random exploration fails—a DQN agent equipped with First-Occupancy Features (DQN+FF) significantly outperformed both standard DQN and DQN+SR, maintaining high scores even as the environment scaled.
  • Robotic Reaching (6-DoF JACO Arm): In a high-dimensional continuous simulation, the "Active Pre-training with First-occupancy features" (APF) method reached spatial targets faster and with higher success rates than state-of-the-art unsupervised RL baselines.
  • Planning Efficiency (FourRooms): The FRP algorithm achieved optimal performance in the classic FourRooms gridworld in just 3 iterations. In contrast, standard Value Iteration (VI) required nearly 180 iterations to reach the same level of accuracy.
  • Robustness: In continuous tasks like MountainCar, the FR proved to be more robust to the choice of feature dimensionality compared to the SR.

Limitations and Future Work

While the FR presents a compelling alternative to the SR, the authors note a few areas for future refinement. First, a more precise theoretical understanding of how the FR behaves in highly stochastic environments is needed. Second, for continuous domains using First-Occupancy Features (FF), performance still depends heavily on the choice of base features and thresholds, presenting an ongoing engineering challenge. Finally, the current FRP planning algorithm is primarily designed for discrete state spaces; extending this rapid shortest-path planning to fully continuous domains remains an exciting direction for future research.

Summary updated

BibTeX
@inproceedings{moskovitz2022first,
  author = {Ted Moskovitz and Spencer R Wilson and Maneesh Sahani},
  title = {{A First-Occupancy Representation for Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=JBAZe2yN6Ub},
}
Figure