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:
- Membership Queries: "Does this specific sequence of events lead to a reward?"
- Equivalence Queries: "Is my current model of the reward rules correct?"
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