Safe Reinforcement Learning through Meta-learned Instincts

Djordje Grbic, Sebastian Risi

Abstract

An important goal in reinforcement learning is to create agents that can quickly adapt to new goals while avoiding situations that might cause damage to themselves or their environments. One way agents learn is through exploration mechanisms, which are needed to discover new policies. However, in deep reinforcement learning, exploration is normally done by injecting noise in the action space. While performing well in many domains, this setup has the inherent risk that the noisy actions performed by the agent lead to unsafe states in the environment. Here we introduce a novel approach called Meta-Learned Instinctual Networks (MLIN) that allows agents to safely learn during their lifetime while avoiding potentially hazardous states. At the core of the approach is a plastic network trained through reinforcement learning and an evolved "instinctual" network, which does not change during the agent's lifetime but can modulate the noisy output of the plastic network. We test our idea on a simple 2D navigation task with no-go zones, in which the agent has to learn to approach new targets during deployment. MLIN outperforms standard meta-trained networks and allows agents to learn to navigate to new targets without colliding with any of the no-go zones. These results suggest that meta-learning augmented with an instinctual network is a promising new approach for safe AI, which may enable progress in this area on a variety of different domains.

Introduction

Reinforcement Learning (RL) often struggles in real-world applications because its fundamental "trial-and-error" nature can lead to catastrophic mistakes during exploration. To discover optimal policies, agents typically inject noise into their actions. While acceptable in simulation, this behavior is dangerous in physical environments like factories or autonomous driving.

Current "Safe RL" methods frequently rely on reward penalties, which are difficult to tune: insufficient penalties lead to risk-taking, while excessive penalties can "paralyze" the agent. This research draws inspiration from nature, where animals are born with instincts that prevent dangerous behaviors without requiring individual trial and error. We introduce Meta-Learned Instinctual Networks (MLIN), a framework that combines a learning policy with an evolved, fixed instinct network to ensure safety during adaptation.

Methods: The MLIN Architecture

The MLIN framework utilizes a dual-network architecture to decouple task learning from safety constraints:

  1. The Policy Network (Plastic): Responsible for learning specific tasks (e.g., navigating to a goal). Its weights are updated during the agent's lifetime using Proximal Policy Optimization (PPO).
  2. The Instinctual Network (Fixed): Evolved over generations using a Genetic Algorithm (GA). Its weights remain static during the agent's lifetime, acting as a permanent safety layer.
The MLIN architecture: The instinctual network modulates the policy network's output using a suppression signal $s$ to ensure safe exploration.

As shown in Figure 3, the instinctual network modulates the policy network via a suppression signal ($s \in [0, 1]$). When $s$ is high, the instinctual network "mutes" the policy's noisy exploratory actions and replaces them with a hardcoded instinctual action ($a_i$). This allows evolution to hardwire safety into the agent's "hardware," leaving the "software" (the policy) free to learn new goals safely.

Experimental Setup

The researchers evaluated MLIN on a custom 2D navigation benchmark. An agent starts in the center of a map and must find one of four hidden goal positions. Four "no-go" hazard zones are placed between the start and the goals. Entering these zones incurs a large negative penalty. The agent is equipped with $(x, y)$ coordinates and eight "range-finder" sensors to detect hazard proximity.

Key Insights

  • Safety as a Meta-Prior: MLIN treats safety as a "meta-prior" refined over evolutionary time rather than a constraint learned through individual experience.
  • Redirection vs. Stopping: Evolved instincts do more than just stop the agent; they learn to "steer" it around hazards, redirecting noisy exploratory actions into safe paths.
  • Separation of Concerns: By isolating safety (instinct) from goal-seeking (policy), agents can adapt to new goals in a single gradient update without needing to re-learn the dangers of the environment.

Key Results

MLIN was compared against pure RL and standard meta-learning (MAML-style) without instincts.

Comparison of best individual fitness across generations. MLIN (blue) consistently outperforms standard meta-learning (orange) when hazards are present.
  • Superior Safety: MLIN achieved an average of only 0.05 hazard violations, a stark contrast to the 75.9 violations recorded for pure RL.
  • Faster Adaptation: MLIN reached goals more accurately. In "distance fitness" metrics, MLIN scored -3.9, significantly outperforming standard meta-learning at -11.3.
  • Robustness: Ablation tests showed that even with the policy network disabled, the instinctual network alone successfully avoided all hazards, confirming it had internalized a spatial map of danger.

Limitations and Future Work

While promising, MLIN currently faces challenges. The hazards in this study were static; future work will explore generalization to dynamic or procedurally generated environments. Additionally, the computational cost of the evolutionary "outer loop" is high. Scaling MLIN to high-dimensional inputs like raw pixels or complex robotic control remains a key objective, with planned testing on benchmarks like the OpenAI Safety Gym.

Summary updated

Abstract

An important goal in reinforcement learning is to create agents that can quickly adapt to new goals while avoiding situations that might cause damage to themselves or their environments. One way agents learn is through exploration mechanisms, which are needed to discover new policies. However, in deep reinforcement learning, exploration is normally done by injecting noise in the action space. While performing well in many domains, this setup has the inherent risk that the noisy actions performed by the agent lead to unsafe states in the environment. Here we introduce a novel approach called Meta-Learned Instinctual Networks (MLIN) that allows agents to safely learn during their lifetime while avoiding potentially hazardous states. At the core of the approach is a plastic network trained through reinforcement learning and an evolved "instinctual" network, which does not change during the agent's lifetime but can modulate the noisy output of the plastic network. We test our idea on a simple 2D navigation task with no-go zones, in which the agent has to learn to approach new targets during deployment. MLIN outperforms standard meta-trained networks and allows agents to learn to navigate to new targets without colliding with any of the no-go zones. These results suggest that meta-learning augmented with an instinctual network is a promising new approach for safe AI, which may enable progress in this area on a variety of different domains.
BibTeX
@inproceedings{grbic2020safe,
  author = {Djordje Grbic and Sebastian Risi},
  title = {{Safe Reinforcement Learning through Meta-learned Instincts}},
  booktitle = {ALIFE},
  year = {2020},
  doi = {10.1162/isal\_a\_00318},
}
Figure