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

Active Finite Reward Automaton Inference and Reinforcement Learning Using Queries and Counterexamples

Zhe Xu, Bo Wu, Daniel Neider, Ufuk Topcu

Introduction

Standard Reinforcement Learning (RL) typically operates under the Markov property, assuming that the current state and action are sufficient to determine the next reward. However, many real-world scenarios are non-Markovian, where rewards depend on a specific history of events—for example, a task requiring an agent to visit locations in a precise sequence. While deep RL can address these tasks using Recurrent Neural Networks (RNNs), it often suffers from extreme data inefficiency and a lack of interpretability. This paper introduces AFRAI-RL, a framework designed to actively infer complex reward structures as human-readable state machines, significantly improving learning speed and transparency.

Methodology

The core innovation of this work is the AFRAI-RL (Active Finite Reward Automaton Inference and RL) algorithm. It integrates three key components: Finite Reward Automata (FRA), the $L^*$ active learning algorithm, and a dual Q-learning approach.

Finite Reward Automata (FRA)

Instead of a black-box neural network, the reward function is represented as a Mealy machine. This FRA captures the logic of the task in a deterministic state machine, making the agent's learned behavior fully interpretable to human developers.

The $L^*$ Learning Algorithm

AFRAI-RL employs the $L^*$ algorithm to actively "interrogate" the environment. Rather than passively waiting for reward signals, the agent maintains an observation table and proactively asks two types of queries:

  1. Membership Queries: "Does this specific sequence of events lead to a reward?"
  2. Equivalence Queries: "Is my current model of the reward rules correct?"
The AFRAI-RL framework architecture, illustrating the interaction between the RL engine and the active inference engine.

Dual Q-Learning

To balance exploration and exploitation, the agent maintains two separate Q-functions. The first, $q_m$, incentivizes exploration specifically to answer $L^*$ queries. The second, $q_h$, focuses on maximizing the task reward based on the current hypothesis of the FRA.

Experimental Setup

The framework was evaluated in two grid-world environments:

  • Office World: A $9 \times 12$ grid where the agent must navigate between specific locations (e.g., "go to $a$, then $b$, then $a$, then $c$").
  • Minecraft World: A $21 \times 21$ grid requiring multi-step crafting sequences, such as collecting specific materials in order before reaching a workbench.

Results and Discussion

The researchers compared AFRAI-RL against several baselines, including JIRP-SAT (passive inference), LRM-QRM (reward machines), and PPO2 (standard deep RL).

  • Efficiency: In the Office World, AFRAI-RL converged to an optimal policy 88.8% faster than the strongest baseline.
  • Scalability: In complex Minecraft tasks like "Build a Spear," AFRAI-RL reached an optimal policy within 170,000 steps, whereas all other baselines failed to converge within the 250,000-step limit.
  • Interpretability: Because the reward is learned as a Deterministic Finite Automaton (DFA), developers can inspect the state machine during training to understand and debug the agent's logic.

Conclusion

AFRAI-RL demonstrates that active inference of reward structures is significantly more efficient than passive learning for non-Markovian tasks. While the current implementation assumes perfect environmental labeling and a model-free approach, future work could extend this to noisy environments, model-based frameworks, or multi-agent systems. The ability to learn interpretable, complex rules from scratch marks a significant step toward more transparent and efficient AI.

Summary updated

BibTeX
@inproceedings{xu2021active,
  author = {Zhe Xu and Bo Wu and Daniel Neider and Ufuk Topcu},
  title = {{Active Finite Reward Automaton Inference and Reinforcement Learning Using Queries and Counterexamples}},
  booktitle = {CD-MAKE},
  year = {2021},
  doi = {10.1007/978-3-030-84060-0\_8},
}
Figure