Projects / HiPO

IEEE ICASSP 2025

Hybrid Offline Passive Grammatical Inference and Online Planning for Non-Markovian Tasks

HiPO

Mahyar Alinejad1,  Alvaro Velasquez2,  Yue Wang1,  George Atia1

1University of Central Florida  ·  2University of Colorado Boulder

TL;DR  Learn what the task is from offline data, then learn how to do it online. HiPO infers the task's automaton passively with RPNI from logged successes and failures, so it needs no environment queries to discover the task, and then plans on the product of the environment and the learned automaton.

OFFLINE: LEARN WHAT THE TASK IS ONLINE: LEARN HOW TO DO IT Offline trajectorieslogged once Label tracespositive / negative RPNIpassive Learned DFAtask automaton Environmentlabelled states Product MDP(s, q) states Q-learningpolicy π(s, q) L(s) ⊗
The HiPO pipeline. The automaton is learned once from data; only the policy is learned online.

Abstract

Planning in non-Markovian environments often requires inferring task structures, such as reward machines, through interactions with the environment. Traditional active grammatical inference methods, like Angluin's L* algorithm, depend on continuous querying to learn task structures for the underlying planning objectives. In contrast, we propose a hybrid approach that combines passive grammatical inference, using the Regular Positive and Negative Inference (RPNI) algorithm, with online planning. By leveraging pre-collected positive and negative trajectories, RPNI learns a deterministic finite automaton (DFA) that captures the task structure, significantly reducing the need for real-time interactions. Subsequently, online planning is conducted over the product MDP, which integrates the environment with the learned DFA. This hybrid methodology minimizes the cost of online interactions and improves learning efficiency in complex environments. Our approach outperforms baseline algorithms in terms of runtime and sample complexity, and is well-suited for real-world scenarios where task structures are implicit, and interactions with the environment are expensive.

How it works

In a non-Markovian task the reward depends on the history, not only on the current state: in "get coffee, then the mail, then go to the office", standing in the office pays off only if the coffee and the mail were collected first, in that order. Representing the task as a deterministic finite automaton (DFA) makes it Markovian again, but the automaton is usually unknown, and active learners such as L* discover it by querying the environment over and over.

  1. Offline automaton learning. Logged trajectories are turned into label sequences (e.g. coffee mail office) and split into successes and failures. RPNI builds a prefix-tree acceptor from the successes and merges states as long as every failure stays rejected.
  2. Product MDP. The environment and the learned DFA are combined: (s, q) → (s′, δ(q, L(s′))), so the state now records which sub-goals are done.
  3. Online planning. Q-learning on the product MDP learns the policy; advancing the automaton is rewarded, so the learned task structure guides exploration.
q0 q1 q2 q3 coffee mail office
The automaton RPNI recovers for the Office task from offline data (other labels self-loop). It is exact in every run.

Environments

Office grid world with 3 by 3 rooms, doors, coffee, mail and office cells
Office world (9×12): rooms joined by doors. Task: coffee → mail → office.
Minecraft grid world with wood, iron, factory and bridge cells
Minecraft world (15×15). Task: wood → iron → factory → bridge.

Results

0 queries
to learn the task automaton
~70 episodes
to converge in the Office world (< 0.1 s)
exact DFA
recovered by RPNI in every run

Much faster than active automaton learning

Active baselines (AGI / L*, JIRP, AFRAI) query the environment to learn the automaton and need tens of seconds to reach maximum reward; HiPO gets there in a fraction of a second.

HiPO reward over time in the Office world
HiPO, Office
AGI, JIRP and AFRAI reward over time in the Office world
AGI, JIRP, AFRAI, Office
HiPO reward over time in the Minecraft world
HiPO, Minecraft
AGI, JIRP and AFRAI reward over time in the Minecraft world
AGI, JIRP, AFRAI, Minecraft

Fewer episodes than an augmented state space

QAS gives Q-learning one "visited" bit per sub-goal instead of an automaton. HiPO converges in far fewer episodes.

HiPO versus QAS reward per episode in the Office world
Office
HiPO versus QAS reward per episode in the Minecraft world
Minecraft

Reproduced with the open-source code (5 seeds)

Reproduced reward per episode in the Office world, HiPO versus QAS
Office, mean ± std
Reproduced reward per episode in the Minecraft world, HiPO versus QAS
Minecraft, mean ± std
EnvironmentMethodEpisodes to converge (median)Final normalized rewardTraining time
OfficeHiPO731.000.09 s
OfficeQASnot within 5000.880.29 s
MinecraftHiPO1320.990.24 s
MinecraftQASnot within 10000.890.57 s

Normalized reward = optimal steps / episode steps for successful episodes (1.0 = shortest path), 0 otherwise. Converged = 20-episode moving average ≥ 0.95.

Learned greedy HiPO policy drawn on the Office grid
Learned policy, Office (32 steps, optimal)
Learned greedy HiPO policy drawn on the Minecraft grid
Learned policy, Minecraft (49 steps, optimal)

Poster

Conference poster for this paper
Presented at IEEE ICASSP 2025, Hyderabad, India. Download the poster (PDF).

Try it

git clone https://github.com/mahyar333/HiPO.git && cd HiPO
pip install -e ".[dev]"
python -m hipo.run --config configs/office.yaml      # learn the DFA, then plan
python -m hipo.plot results/office                   # figures

Python 3.9+, MIT license. See the repository for the full documentation.

BibTeX

@inproceedings{alinejad2025hipo,
  title     = {Hybrid Offline Passive Grammatical Inference and Online Planning for Non-Markovian Tasks},
  author    = {Alinejad, Mahyar and Velasquez, Alvaro and Wang, Yue and Atia, George},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
  year      = {2025},
  url       = {https://ieeexplore.ieee.org/document/10889467}
}