Tuning Safety Penalties in Reinforcement Learning
In this article, we examine agents trained with different side effect penalties on three different tasks: Pattern creation, pattern removal, and navigation.
Created on October 2|Last edited on November 29
Comment
In this article, we explore the task of pattern creation, including pattern removal and navigation, using Weights & Biases, and examine how agents trained with different side effect penalties perform.
Table of Contents
Pattern creation
In the pattern creation task (append-spawn), agents must fill in blue squares with new cells of life. There are lots of green patterns in the way though, and a typical unsafe agent will disrupt these patterns while trying to accomplish its goal. This task can be quite tricky! A safe agent may need to give up and only half-complete its task rather than take unsafe actions.
We perform a sweep over different side effect impact penalty coefficients. Agents can be made to get moderately high reward or low side-effects, but not both. In fact, all of the agents in our sweep get a negative combined score, meaning that they perform worse than a dummy agent that takes no actions (and causes no side effects) at all.
append-spawn
19
Pattern Removal
The pattern removal task is quite a lot easier than the pattern creation task, and the agents tend to get high rewards and high (positive!) overall scores. The trade-off between performance and safety is much more abrupt than it is in the pattern creation task. As long as the side effect penalty is relatively small, its exact value doesn't make much difference to either the agent's safety or performance in removing patterns. However, once KaTeX parse error: Undefined control sequence: \gsim at position 9: \lambda \̲g̲s̲i̲m̲ ̲0.35, performance quickly drops and side effects soon go to near zero, indicating that the agent has decided to forsake any reward in order to act safely. However, there's no intermediate sweet spot: safety goes up only after performance goes down. In between, both safety and performance suffer.
In general, one cannot expect that training a safe agent is just a matter of finding the right balance between performance and safety. When the trade-off is very abrupt, as it is here, we instead need to find new techniques to train agents that are simultaneously performant and safe.
prune-spawn
22
Navigation
The final benchmark task is navigation. Navigation is a relatively straightforward task: the agent just needs to get to the level exit with no intermediary goals. The navigation levels have many more obstacles (walls) placed in the agents' paths, so finding ones way is not always straightforward. Every navigation level consists of two regions. There is region of green cells filled with oscillating patterns, and there is a region of yellow cells with stochastically generated patterns.
The green patterns are fragile — walking next to (or through) them will usually disrupt them, either causing them to collapse or to expand chaotically. The yellow patterns are much more robust. The agent can still disrupt them, but any small disruption will soon be washed out by new randomly generated patterns, and any evidence of disruption will disappear.
Here we perform a sweep over two parameters: the side effect penalty and the reinforcement learning discount factor . In the pattern creation task, we kept relatively low () such that exploring agents would receive substantial multi-step rewards for creating new patterns even though those patterns were typically accidentally destroyed at a later time step. If were large, then the agent would consider the pattern creation and its inevitable destruction to have equal weight, so it wouldn't bother to create the pattern in the first place.
In navigation, there are no rewards for creating patterns, so we thought that a larger value of might enable an agent to find an exit that is farther away. Instead, we find that has only a week dependence on overall score. Instead, the impact penalty coefficient is much more important.
No matter what the side effect impact penalty coefficient is, the navigation agents do not learn how to act safely. Larger impact penalties tend to lead to smaller side effects, but the side effects are still quite substantial. In no case does the agent reliably learn to go through the robust yellow pattern and avoid the fragile green pattern.
Training agents to make the distinction between robust and fragile patterns is an open and ongoing problem.
prune-spawn
12
Add a comment
Iterate on AI agents and models faster. Try Weights & Biases today.