Constrained Reinforcement Learning Using Successor Representations

Michael Girstl, Alexander Mattick, Christopher Mutschler

TL;DR

SafeDSR introduces a novel framework for Constrained Reinforcement Learning (CRL) that decouples environment dynamics from rewards and safety costs using successor representations. By isolating safety constraints into a single, easily trainable weight matrix, the agent can adapt to shifting hazards (like moving obstacles) via fast supervised learning instead of retraining the entire policy from scratch.

What Problem Does This Paper Address?

Deploying reinforcement learning (RL) in the real world requires strict safety guarantees. Constrained Markov Decision Processes (CMDPs) model this by augmenting standard reward signals with cost signals that penalize unsafe behavior.

However, standard deep CRL algorithms suffer from a major flaw: they assume safety constraints are static. If an environment undergoes a domain shift or if obstacles move, the agent's learned value function (Q-function) breaks down because it conflates environment transitions, rewards, and costs. Adapting to these changes typically requires computationally expensive retraining of the entire neural network. This paper tackles the challenge of building flexible, safety-constrained agents that can adapt rapidly to changing cost structures without losing what they've already learned about environment dynamics.

Methods

The authors propose Safe Deep Successor Representation (SafeDSR). This method builds upon the Deep Successor Representation (DSR) by mathematically separating the value function into three distinct components:

  1. Successor Features ($M$): A predictive model of environment dynamics (how states transition into one another).
  2. Reward Weights ($w_r$): A linear mapping from features to immediate rewards.
  3. Cost Weights ($w_c$): A linear mapping from features to immediate safety costs.
Overview of the SafeDSR action selection process

By enforcing this linear decomposition, the agent can compute future expected rewards ($Q$) and future expected costs ($K$) independently. During action selection, SafeDSR uses a Lagrangian relaxation mechanism to dynamically balance these two objectives based on a safety budget ($b$) and a Lagrange multiplier ($\lambda$).

As a baseline for comparison, the authors also introduce SafeDQN, which applies Lagrangian relaxation directly to a standard Deep Q-Network without decoupling the dynamics from the costs.

Agent-environment interface using Lagrangian relaxation

Datasets

The authors evaluate their approach on a newly designed, custom 2D Continuous Grid Environment.

  • Structure: The environment can be configured with one, two, or three rooms separated by walls.
  • Dynamics: The agent moves in cardinal directions with a noisy, stochastic step length.
  • Constraints: Red "cost cells" inflict a penalty of 1 per step. The layout of these cost cells can be dynamically changed during training (e.g., from a diamond shape to a square shape) to test the agent's adaptability.
Custom 2D continuous grid environment with diamond-shaped cost zones

Key Insights and Ideas

  • The Power of Linear Factorization: Because the cost-augmented reward function is a linear combination of rewards and costs, it is perfectly suited for successor features. If the safety landscape changes, the agent only needs to update the single weight matrix ($w_c$) via supervised learning, leaving the massive dynamics network ($M$) completely untouched.
  • The Exploration Bottleneck in CRL: Traditional CRL algorithms often fail in complex environments because their safety mechanisms overcorrect, trapping the agent in local optima or corners. SafeDSR's high exploration rate ($\varepsilon = 0.25$) combined with explicit cost tracking allows it to safely navigate around hazards rather than getting stuck.
  • Pretraining Matters for Zero-Shot Safety: When constraints shift to previously unexplored areas, the agent lacks feature representations for those zones. Pretraining the feature encoder ($\phi$) on random, reward-free environment rollouts dramatically improves the agent's ability to adapt to adversarial cost changes later on.

Key Results

The authors compared SafeDSR and SafeDQN against 11 state-of-the-art CRL baselines (including CPO, TRPO-Lag, and CPPO-PID) across 500,000 environment steps:

  • Multi-Room Navigation: In the challenging two- and three-room environments with costs, SafeDSR was the only algorithm that consistently reached the goal safely. It achieved an average safe goal rate of over 60% (two-room) and 30% (three-room), while almost all baseline algorithms dropped to near 0% due to poor exploration or getting stuck in local optima.
  • Rapid Adaptation: When subjected to sudden cost distribution shifts (e.g., shifting from a "Diamond" to a "Square" hazard layout), SafeDSR successfully adapted its trajectory to avoid the new danger zones within just a few environment interactions, especially when utilizing a pretrained feature encoder.

Limitations and Future Work

  • High-Dimensional Scaling: Successor representations inherently struggle to scale to high-dimensional state spaces (like raw pixels) where features are not easily linearized. Overcoming this requires complex feature engineering or auxiliary unsupervised learning objectives.
  • Discrete Action Spaces: The current formulation relies on an exact argmax optimization over actions, limiting SafeDSR to discrete control tasks. The authors note that transferring this method to continuous Actor-Critic architectures (such as DDPG, SAC, or TD3) is a vital direction for future work.

Summary updated

BibTeX
@article{girstl2026constrained,
  author = {Michael Girstl and Alexander Mattick and Christopher Mutschler},
  title = {{Constrained Reinforcement Learning Using Successor Representations}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2026},
}
Figure