Learning to Be Cautious

Montaser Mohammedalamen, Dustin Morrill, Alexander Sieusahai, yash satsangi, Michael BowlingTMLR 2025

Abstract

A key challenge in the field of reinforcement learning is to develop agents that behave cautiously in novel situations. It is generally impossible to anticipate all situations that an autonomous system may face or what behavior would best avoid bad outcomes. An agent that could learn to be cautious would overcome this challenge by discovering for itself when and how to behave cautiously. In contrast, current approaches typically embed task-specific safety information or explicitly cautious behaviors into the system, which is error-prone and imposes extra burdens on practitioners. In this paper, we present both a sequence of tasks where cautious behavior becomes increasingly non-obvious, as well as an algorithm to demonstrate that it is possible for a system to learn to be cautious. The essential features of our algorithm are that it characterizes reward function uncertainty without task-specific safety information and uses this uncertainty to construct a robust policy. Specifically, we construct robust policies with a $k$-of-$N$ counterfactual regret minimization (CFR) subroutine given a learned reward function uncertainty represented by a neural network ensemble belief. These policies exhibit caution in each of our tasks without any task-specific safety tuning.

Introduction

In the "train-and-deploy" lifecycle of artificial intelligence, agents frequently encounter situations outside their training distribution. Standard reinforcement learning (RL) algorithms are typically extrapolative, attempting to map novel sensations to familiar labels. This can lead to overconfident and dangerous behavior, such as a self-driving car maintaining speed on a snowy road it misidentifies as bright pavement. While current safety methods often rely on hand-coded "safe actions" or pre-defined hazard zones, it is impossible to anticipate every real-world scenario. This paper argues that agents should instead learn to be cautious by recognizing their own epistemic uncertainty—the "I don't know what I'm looking at" state—and choosing actions that minimize potential worst-case outcomes.

Methodology

The proposed framework enables autonomous caution by combining uncertainty estimation with robust optimization:

  1. Epistemic Uncertainty via Ensembles: The agent trains an ensemble of neural networks to predict rewards. In familiar states, these networks reach a consensus; in novel states, their predictions diverge. This variance serves as a direct signal of the agent's ignorance.
  2. $k$-of-$N$ Counterfactual Regret Minimization (CFR): This core engine samples $N$ reward functions from the ensemble and optimizes the policy to perform well on the average of the $k$ worst outcomes. The $k/N$ ratio acts as a tunable "knob" for caution.
  3. Extension to Continuing MDPs: The authors provide a theoretical extension of $k$-of-$N$ CFR—originally for finite-horizon games—to continuing Markov Decision Processes, ensuring the algorithm's applicability to long-term tasks.

Experimental Setup

The algorithm was evaluated across tasks where cautious behavior is essential for safety.

Familiar vs. novel datasets used for testing caution.

Image Classification with "Ask for Help"

The agent is trained on MNIST digits (familiar) and tested on Fashion-MNIST and EMNIST (novel). A cautious agent should recognize the novelty and choose an "ask for help" action, which yields a small but guaranteed reward, rather than guessing a digit.

Driving Gridworld

In a custom driving environment, the agent must maximize distance. During training, obstacles are only off-road. During testing, obstacles appear on-road. This tests if the agent can plan multiple steps ahead to avoid novel hazards without having been explicitly trained on them.

Results

The experiments demonstrate that robust policies exhibit zero-shot caution in novel environments:

  • Autonomous Help-Seeking: In classification, the most robust agent (1-of-20) chose the "help" action 89% of the time for novel inputs, compared to less than 2% for standard baselines.
  • Proactive Driving Safety: Robust agents intuitively learned to drive slower and avoid novel on-road obstacles, whereas non-robust agents drove through them at full speed.
  • Data Sensitivity: Caution was found to be a learned trait; as the agent sees more of the familiar world, its ability to distinguish and respect the unknown improves.
Action selection distribution for novel inputs (f: fashion, alpha: letters).

Discussion and Conclusion

This research distinguishes between aleatoric uncertainty (randomness) and epistemic uncertainty (lack of knowledge), framing true caution as risk aversion toward the latter. While the current model assumes transition certainty (knowing how the world moves), future work will incorporate uncertainty about environment physics. Additionally, scaling the tabular $k$-of-$N$ CFR to massive, continuous state spaces via deep function approximation remains an important next step for real-world deployment.

Summary updated

BibTeX
@article{mohammedalamen2025learning,
  author = {Montaser Mohammedalamen and Dustin Morrill and Alexander Sieusahai and yash satsangi and Michael Bowling},
  title = {{Learning to Be Cautious}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=NXvGOaYExG},
}
Figure