NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Online Learning of Non-Markovian Reward Models

Gavin Rens, Jean-François Raskin, Raphaël Reynouad, Giuseppe MarraICAART 2020

Abstract

There are situations in which an agent should receive rewards only after having accomplished a series of previous tasks, that is, rewards are non-Markovian. One natural and quite general way to represent history-dependent rewards is via a Mealy machine, a finite state automaton that produces output sequences from input sequences. In our formal setting, we consider a Markov decision process (MDP) that models the dynamics of the environment in which the agent evolves and a Mealy machine synchronized with this MDP to formalize the non-Markovian reward function. While the MDP is known by the agent, the reward function is unknown to the agent and must be learned. Our approach to overcome this challenge is to use Angluin's $L^*$ active learning algorithm to learn a Mealy machine representing the underlying non-Markovian reward machine (MRM). Formal methods are used to determine the optimal strategy for answering so-called membership queries posed by $L^*$. Moreover, we prove that the expected reward achieved will eventually be at least as much as a given, reasonable value provided by a domain expert. We evaluate our framework on three problems. The results show that using $L^*$ to learn an MRM in a non-Markovian reward decision process is effective.

Introduction

In the world of Reinforcement Learning (RL), the standard "Markov property" assumes that rewards depend solely on the current state and action. However, real-world tasks are rarely so simple. For instance, in a complex workflow like baking, the "reward" of a finished product is only achieved after a specific sequence of actions: preheating the oven, mixing ingredients, and baking for a set time. These are non-Markovian rewards, where the payoff is history-dependent.

Standard RL agents struggle with these tasks because baking history into the state space leads to a "state explosion" that makes learning computationally prohibitive. This paper introduces a framework to learn Mealy Reward Machines (MRMs)—finite state automata that track history to dispense rewards—using Angluin’s $L^*$ active learning algorithm.

The ARM Framework

The proposed framework, referred to as ARM (Angluin Reward Machine), alternates between a learning phase and an exploitation phase to systematically discover the underlying reward logic.

The ARM framework workflow, illustrating the interaction between the $L^*$ learning algorithm, the synchronized product MDP, and the environment.

Active Learning with $L^*$

The agent treats the environment as a "teacher," using Angluin’s $L^*$ algorithm to pose targeted "Membership Queries" (e.g., "If I see this sequence of events, what reward do I get?"). This systematic approach to discovery is far more efficient than random exploration. To answer these queries in a stochastic environment, the authors utilize the STORM probabilistic model checker to compute optimal strategies.

Synchronized Product and Exploitation

Once a hypothesis of the reward machine is formed, the agent creates a "Synchronized Product" of the environment (the MDP) and the learned MRM. This transformation effectively converts the non-Markovian problem back into a Markovian one, allowing for standard planning and optimization. A key mechanism in this loop is the Expert Value ($V_{expert}$) trigger: if the agent's current model suggests it cannot reach a benchmark value provided by a domain expert, it assumes the model is incomplete and seeks a counter-example to refine the MRM.

Experimental Evaluation

The framework was evaluated on three custom grid-world environments requiring complex memory: Treasure-Map World, Office-Bot Domain, and the Cube Problem.

The Treasure-Map World environment (left) and its corresponding Mealy Reward Machine (right), demonstrating how history-dependent rewards are modeled.

In the Treasure-Map World (illustrated above), the agent must find a map ('m'), then potentially hire a guide ('g') or buy equipment ('e'), before finally retrieving a treasure ('t') and selling it ('j'). The Mealy machine (right) shows how the reward structure tracks these specific transitions. In the Office-Bot Domain, the agent must remember which specific person requested mail or donuts, a task where standard Deep Q-Networks (DQN) failed to converge even after 10,000 episodes.

Key Results and Insights

  • Sample Efficiency: ARM reached high returns significantly faster than DQN baselines across all domains.
  • Minimalism: The $L^*$ algorithm naturally finds the most compact Mealy machine, which keeps the synchronized MDP small and planning efficient.
  • Provable Guarantees: The authors provide mathematical proofs that the agent will eventually learn the correct reward machine and match the expert's expected performance level.

Conclusion and Future Work

While the ARM framework demonstrates superior performance in discrete environments with deterministic observations, challenges remain. Future research will focus on relaxing the reliance on a "reset" action—which allows agents to restart episodes at will— and extending the framework to handle noisy sensors or continuous state spaces. By treating the environment as a teacher, this work provides a robust path toward robots that can learn the "why" and "when" of complex, multi-step tasks.

Summary updated

BibTeX
@inproceedings{rens2020online,
  author = {Gavin Rens and Jean-François Raskin and Raphaël Reynouad and Giuseppe Marra},
  title = {{Online Learning of Non-Markovian Reward Models}},
  booktitle = {ICAART},
  year = {2020},
  url = {https://openreview.net/forum?id=ZSulFepaW65},
}
Figure