Abstract
Hierarchical Reinforcement Learning algorithms have successfully been applied to temporal credit assignment problems with sparse reward signals. However, state-of-the-art algorithms require manual specification of sub-task structures, a sample inefficient exploration phase or lack semantic interpretability. Humans, on the other hand, efficiently detect hierarchical sub-structures induced by their surroundings. It has been argued that this inference process universally applies to language, logical reasoning as well as motor control. Therefore, we propose a cognitive-inspired Reinforcement Learning architecture which uses grammar induction to identify sub-goal policies. By treating an on-policy trajectory as a sentence sampled from the policy-conditioned language of the environment, we identify hierarchical constituents with the help of unsupervised grammatical inference. The resulting set of temporal abstractions is called action grammar (Pastra & Aloimonos, 2012) and unifies symbolic and connectionist approaches to Reinforcement Learning. It can be used to facilitate efficient imitation, transfer and online learning.
Introduction
Reinforcement Learning (RL) often struggles with the "credit assignment problem"—determining which specific action in a long sequence led to a distant reward. Hierarchical RL (HRL) attempts to mitigate this by decomposing tasks into sub-goals. However, existing HRL methods face significant challenges: they often require manual definition of sub-task structures, suffer from sample inefficiency due to extensive exploration requirements, and produce sub-policies that lack semantic interpretability.
Inspired by cognitive neuroscience, which suggests humans naturally infer hierarchical structures across language and motor control, this work introduces the Action Grammar framework. This approach treats an agent's actions as a "language," using unsupervised grammar induction to discover interpretable macro-actions that improve learning efficiency.
Methods: The Action Grammar Framework
The core of the proposed architecture is a two-stage alternating loop between grammar induction and action learning.
- Grammar Learning: The agent treats its action trajectories as "sentences." It employs unsupervised grammar induction algorithms—specifically Sequitur (identifying repeating bigrams) and G-Lexis (optimizing for a directed acyclic graph of strings)—to identify recurring patterns. These patterns are "flattened" into macro-actions, which are temporally extended actions representing discovered skills.
- Action Learning: These new macro-actions are added to the agent's available action space. The agent then utilizes Semi-Markov Decision Process (SMDP) Q-Learning to update value estimates. By operating with macro-actions that span multiple time steps, reward information propagates significantly faster across the temporal dimension.
Evaluation and Results
The framework was evaluated on two primary environments: the Towers of Hanoi (ToH), a recursive puzzle with sparse rewards, and a Hierarchically-Structured Gridworld, a complex navigation task requiring the agent to collect items while avoiding dynamic obstacles.
Key Insights
- Compression is Discovery: The framework posits that the most efficient way to find a task's hierarchy is to find the most efficient way to compress successful trajectories. Grammar rules act as both compression mechanisms and skill discoveries.
- Symbolic-Connectionist Integration: By augmenting a Deep Q-Network (DQN) with symbolic grammar induction, the architecture bridges symbolic AI and modern deep learning.
- Interpretability: Unlike standard HRL "options," action grammars produce literal parse trees. Production rules (e.g.,
Rule B -> C + E + d) provide a transparent view of the sequences the agent has grouped into skills.
Experimental results demonstrate that agents using expert-derived grammars in Towers of Hanoi learned significantly faster and with lower variance than standard RL baselines. In online learning scenarios, the "Online Grammar-DQN" outperformed $TD(\lambda)$ baselines by iteratively refining its grammar. Furthermore, G-Lexis generally provided superior hierarchical compression compared to Sequitur, leading to more useful macro-actions.
Conclusion
The Action Grammar framework offers a promising path toward data-efficient and interpretable HRL. While current limitations include the reliance on discrete action spaces and sensitivity to update frequencies, the ability to perform zero-shot transfer—where a grammar learned on a simple task provides a head start on a complex one—highlights the power of this approach. Future research will explore scaling these grammars to high-dimensional visual inputs and continuous control environments.
Summary updated