Making Sense of Reinforcement Learning and Probabilistic Inference

Brendan O'Donoghue, Ian Osband, Catalin Ionescu

TL;DR

Reinforcement Learning (RL) is often framed as a probabilistic inference problem, but the popular "RL as inference" framework (which underpins methods like Soft Q-learning) fundamentally fails at exploration because it ignores epistemic uncertainty—the uncertainty regarding what the agent doesn't yet know about the world. By re-incorporating this uncertainty into the inference framework, the authors derive K-learning, a method that balances exploration and exploitation as effectively as Thompson Sampling while maintaining the elegant structure of probabilistic inference.

What Problem Does This Paper Address?

Reinforcement Learning is the art of learning to control an unknown system through trial and error. This requires a delicate balance: an agent must exploit what it knows to get rewards, but also explore what it doesn't know to find even better rewards.

A popular research trend casts "RL as inference," treating the goal of "being optimal" as a latent variable to be inferred from data. This perspective has led to powerful algorithms like Soft Q-learning and Maximum Entropy RL. However, the authors argue that these methods are "myopic." They use Boltzmann-style dithering (randomly picking actions based on their current estimated value) which doesn't account for the value of information. In environments where the reward is a "needle in a haystack," these agents can spend an exponential amount of time wandering aimlessly because they don't prioritize visiting states they are most uncertain about.

Methods

The authors contrast three main approaches to the RL problem:

  1. Thompson Sampling (TS): A classic Bayesian heuristic where the agent samples a possible version of the world from its posterior distribution and acts optimally for that specific world.
  2. Soft Q-learning (The "Standard" Inference Approach): This treats rewards as exponentiated probabilities. It leads to "soft" Bellman updates and entropy regularization, but it relies on a point estimate of the environment, ignoring the agent's own uncertainty about that estimate.
  3. K-learning (The Proposed Fix): The authors show that by marginalizing over the posterior distribution of the optimal Q-values (rather than using a point estimate), they arrive at K-learning.

K-learning introduces a crucial "exploration bonus" based on visitation counts ($n_t(s, a)$). This bonus makes the agent optimistic about poorly understood states. Mathematically, K-learning is shown to be an upper bound on the true probability of an action being optimal, effectively bridging the gap between probabilistic inference and statistically efficient exploration.

Datasets

The authors evaluate these algorithms on three distinct settings:

  • Problem 1 (One Unknown Action): A simple bandit problem designed to show how "distractor" actions break simple dithering. As the number of mediocre actions increases, dithering agents fail to ever try the one potentially great action.
  • DeepSea: A scalable grid-world "needle in a haystack" task (Figure 2). The agent starts at the top-left and must move right at every single step to reach a lone treasure at the bottom-right. Any mistake leads to zero reward. DeepSea exploration: A simple example where deep exploration is critical.

  • bsuite (Behaviour Suite for RL): A comprehensive benchmark of tasks designed to isolate and measure specific agent capabilities like memory, credit assignment, and exploration.

Figure 2: DeepSea exploration: A simple example where deep exploration is critical.

Key Insights and Ideas

  • The Dithering Trap: The paper demonstrates that "RL as inference" in its standard form is just sophisticated dithering. If an agent has 1,000 actions and 999 of them look "okay," a dithering agent will waste nearly all its time on those 999 actions rather than testing the 1,000th action it knows nothing about.
  • RL was always Inference: The authors argue that the original, "Bayes-optimal" RL problem was already an inference problem. The modern "RL as inference" trend actually simplified the problem too much by removing the lookahead and uncertainty components that make RL hard.
  • Optimism via Cumulants: K-learning uses the cumulant generating function of the Q-value distribution. This provides a principled way to inject optimism into the agent's value estimates, ensuring it explores until its uncertainty is resolved.

Key Results

  • Regret Scaling: In the "One Unknown Action" test, Soft Q-learning's regret grows linearly with the number of actions $N$. In contrast, K-learning and Thompson Sampling maintain near-constant regret, showing they aren't fooled by distractors. Regret scaling on Problem 1. Soft Q-learning does not scale gracefully with N.

  • Deep Exploration: On the DeepSea task, Soft Q-learning requires an exponential number of episodes ($2^N$) to find the reward. K-learning and Thompson Sampling scale polynomially, solving the task orders of magnitude faster as the grid size increases. Learning times for DeepSea experiments. Dashed line represents 2^N.

  • General Performance: Across the bsuite benchmarks, K-learning and Bootstrapped DQN (a TS variant) perform similarly well, while Soft Q-learning fails significantly on any task requiring deep exploration.

Regret scaling on Problem 1. Soft Q-learning does not scale gracefully with N.
Learning times for DeepSea experiments. Dashed line represents 2^N.

Limitations and Future Work

  • Scaling to Deep RL: While the authors demonstrate a neural network implementation for bsuite, scaling these precise uncertainty estimates to massive, high-dimensional environments (like Atari or robotics) remains a significant challenge.
  • Temperature Sensitivity: Both Soft Q-learning and K-learning rely on a temperature parameter ($\beta$). The authors note that performance can be sensitive to this tuning, and finding a problem-independent way to set this is an open question.
  • Generalization: The current work focuses heavily on tabular and simple function approximation settings. How these insights translate to complex generalization (where states are never visited twice) is a key area for future research.

Summary updated

Abstract

Reinforcement learning (RL) combines a control problem with statistical estimation: The system dynamics are not known to the agent, but can be learned through experience. A recent line of research casts `RL as inference' and suggests a particular framework to generalize the RL problem as probabilistic inference. Our paper surfaces a key shortcoming in that approach, and clarifies the sense in which RL can be coherently cast as an inference problem. In particular, an RL agent must consider the effects of its actions upon future rewards and observations: The exploration-exploitation tradeoff. In all but the most simple settings, the resulting inference is computationally intractable so that practical RL algorithms must resort to approximation. We demonstrate that the popular `RL as inference' approximation can perform poorly in even very basic problems. However, we show that with a small modification the framework does yield algorithms that can provably perform well, and we show that the resulting algorithm is equivalent to the recently proposed K-learning, which we further connect with Thompson sampling.
BibTeX
@inproceedings{odonoghue2020making,
  author = {Brendan O'Donoghue and Ian Osband and Catalin Ionescu},
  title = {{Making Sense of Reinforcement Learning and Probabilistic Inference}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
}
Figure