TL;DR
Teaching a reinforcement learning (RL) agent to complete a set of errands in any order usually triggers an exponential explosion in state-space complexity, causing standard structured-reward methods to choke as the to-do list grows. This paper introduces QCoRM, an algorithm that decouples how to do each individual errand from which order to do them in—scaling low-level policy learning linearly rather than exponentially while preserving global optimality guarantees.
What Problem Does This Paper Address?
Reinforcement learning agents struggle when rewards are sparse and depend on past history (non-Markovian tasks)—like "pick up all packages, then go to the drop-off station." Reward Machines (RMs) help by giving the agent a finite-state automaton—essentially a flowchart of task progress—so it knows what stage of the mission it's in.
However, standard Boolean RMs hit a massive combinatorial wall when subtasks can be completed in any order. If an agent needs to collect $N$ boxes, tracking every possible completion sequence creates up to $N!$ branches, or at minimum $2^N$ states to track completed subsets. Not only is manually writing such a massive flowchart miserable for humans, the agent is forced to re-learn policies across an exponentially growing state space.
Methods
To tame this exponential blowup, the authors rethink both how tasks are represented and how the agent learns from them, progressing through three new types of Reward Machines into a novel learning algorithm:
- Numeric RMs (Compact Specification): Instead of writing out exponentially many states by hand, users specify unordered subtasks using discrete numeric counters (e.g., counting down remaining uncollected boxes).
- Agenda RMs (Merging Symmetric States): Numeric RMs can't be used for learning directly because states get revisited at different stages of progress. Unfolding them into standard Boolean RMs creates redundant branches. Agenda RMs annotate states with the remaining subtasks (the "agenda") and state depth. Because RL backs up value from the future, states with the exact same remaining work share identical optimal $Q$-functions and are merged—shrinking 219,201 Boolean RM states for an 8-box task down to 511.
- Coupled RMs (Parallel Subtask Sharing): Agenda RM states still represent sets of possible next subtasks. A Coupled RM splits a multi-choice state into parallel, coupled states—one per individual subtask. Conceptually, the agent occupies all coupled states simultaneously.
- QCoRM ($Q$-learning with Coupled RMs): Because each coupled state maps to one specific subtask, the agent learns a single reusable low-level policy per subtask in parallel (linear scaling!). Meanwhile, a high-level policy treats choosing the next subtask like a multi-armed bandit, tracking expected steps-to-goal ($\eta$) to pick the best order. Crucially, the authors introduce a reshaped final reward incorporating total episode length, preventing low-level policies from finishing their own subtask greedily in a way that ruins the agent's positioning for the next subtask.
Datasets
Because this is an online RL paper, evaluation is conducted across four simulated environments rather than static datasets:
- Delivery (Tabular, discrete): A newly introduced variant of a $10 \times 10$ grid world where an agent collects 2–8 boxes one at a time and delivers them to a station, with collected boxes disappearing from the map.
- Office (Tabular, discrete): An existing grid-world benchmark delivering coffee to 2–6 offices while avoiding decorations.
- Water (Continuous state, discrete action via DDQN): A 2D physics arena where a ball-agent adjusts velocity to touch 2–5 moving, colored balls in any order without hitting wrong ones.
- MuJoCo HalfCheetah (Continuous state and action via TD3): Controlling a 2D bipedal robot to reach 2–6 horizontal waypoints in any order.
Key Insights and Ideas
- Track what's left, not what's done: Labelling RM states by remaining subtasks aligns naturally with Bellman backups. Whether you delivered Box 1 then Box 2, or Box 2 then Box 1, your future looks identical—allowing massive state-merging and better counterfactual experience replay even when completed objects vanish from the environment.
- Local greediness breaks global optimality: In physics-based domains like Water or HalfCheetah, sprinting full-speed into Target A might overshoot and put you terribly out of position for Target B. Shaping subtask completion rewards using the global minimum episode length forces low-level policies to decelerate and set up future transitions, preserving tabular $Q$-learning's global optimality guarantee.
- Push the exponential cost to a cheap lookup table: While the Coupled RM still has $\Theta(2^N)$ states tracked by the high-level controller, each entry is just a single scalar ($\eta$, steps-to-go) updated in $O(1)$ time without environment interaction. Heavy neural network or $Q$-table learning scales strictly linearly with the number of subtasks.
Key Results
Tested up to $10^6$ steps (and 40-hour limits) against RM baselines (QRM, CRM, HRM) and a specification-based compositional method (DiRL):
- Superior Scalability: In Delivery, Boolean RM baselines ran out of memory (16 GiB) past 5 boxes, while QCoRM converged to optimal policies all the way to 8 boxes. In HalfCheetah, only QCoRM variants succeeded in reaching 6 unordered waypoints within the step/time limits.
- Linear Runtime: While state-of-the-art counterfactual (CRM) and hierarchical (HRM) baselines showed exponential runtime growth due to simulating experiences across all RM states, QCoRM’s runtime scaled linearly with the number of subtasks.
- Ablation Validates Joint Optimization: Removing the global episode-length reward shaping (
QCoRM-0) caused agents in Water and HalfCheetah to converge to sub-optimal policies (e.g., failing to decelerate at waypoints).
Limitations and Future Work
- Residual Memory Bottleneck: Although low-level policy learning is linear, the high-level $\eta$ lookup table still grows exponentially ($\Theta(2^N)$) to represent subset orderings. Avoiding this memory ceiling while keeping global optimality remains an open question.
- Deterministic & Fixed-Start Assumptions: All experiments used deterministic environments with fixed initial agent positions (varied starts would require conditioning $\eta$ on the starting state). Extending optimality proofs to stochastic dynamics is left for future work.
- Structural Constraints: Numeric variables cannot increase (which would create cycles and break depth-based state merging), features must be fully observable, and the agent can only complete one subtask per timestep and one unordered group sequentially. Future work could support simultaneous subtask completions and non-$Q$-learning backbones.
Summary updated