Learning Task Specifications from Demonstrations
Traditional Inverse Reinforcement Learning (IRL) typically seeks to uncover a scalar reward function that makes a teacher's demonstrated behavior appear optimal. However, this paper proposes a paradigm shift: learning Boolean specifications (logical rules) instead of scalar rewards. By treating tasks as logical constraints rather than numbers, robots can learn complex, history-dependent behaviors that are safely composable and robust to environmental changes.
The Problem with Scalar Rewards
Most "Learning from Demonstration" (LfD) methods that rely on scalar reward functions suffer from three major flaws:
- The Curse of History: Standard rewards are "Markovian," meaning they only evaluate the current state. They struggle with sequential constraints like "do not do X if you did Y ten steps ago" unless the state space is exponentially expanded to track history.
- Ad-hoc Composition: Combining a reward for "avoiding lava" with one for "reaching the goal" by simply adding them often yields unintended behaviors. There is no mathematical guarantee that the combined scalar reward will respect both original constraints.
- Brittleness: A reward function tuned for a specific gridworld layout might fail catastrophically if a single tile is moved, as the relative "value" of different paths shifts.
The authors argue that Boolean non-Markovian rewards (specifications) offer a robust alternative. A specification provides a binary "pass/fail" evaluation for an entire trajectory, making it naturally suited for logical composition (using AND/OR operations) and temporal dependencies.
A Logical Approach to Inference
The authors formulate specification inference as a Maximum a Posteriori (MAP) problem, introducing several novel components to make the search tractable:
- Maximum Entropy Likelihood: They derive an analytic demonstration likelihood model based on the principle of maximum entropy. Crucially, this model depends only on the probability that a task is satisfied by an agent taking random actions, avoiding the need to unroll the entire history.
- Lattice-Based Search: Instead of exhaustively checking every possible logical rule, candidate specifications are organized into a partial order lattice (a Hasse Diagram). The authors prove that "information gain" follows monotonic properties along the chains of this lattice.
- Efficient Inference: Two algorithms,
CHAIN_INFERENCEandPARTIALORDER_INFERENCE, use binary search-like logic to skip large sections of the candidate pool, drastically reducing computation time. - Symbolic Computation: To calculate the probability of a random agent satisfying a complex rule, the system uses Binary Decision Diagrams (BDDs), which compactly represent the environment's dynamics and logical constraints.
Gridworld Evaluation
The approach is evaluated using a custom Gridworld benchmark specifically designed to highlight non-Markovian constraints.
The environment features "lava" (red), "recharge" (yellow), "water" (blue), and "drying" (brown) tiles. The agent's primary task is to reach a recharge tile without hitting lava. However, there is a hidden temporal constraint: if the agent touches water, it must touch a drying tile before it is allowed to recharge. The model was tested on a small set of just 5 expert demonstrations to see if it could infer this complex rule.
Key Results and Insights
- Logic over Scalars: Boolean specifications are inherently compositional. The logical AND of "avoid lava" and "recharge" is guaranteed to satisfy both constraints, unlike a sum of two scalar rewards.
- Information Gain as a Metric: The "best" specification is the one providing the most information relative to a random agent. If a task is extremely difficult for a random agent to complete by chance, a human demonstration of that task is highly informative.
- Accuracy and Efficiency: The algorithm successfully identified the complex "Blue-Brown-Yellow" temporal constraint from just 5 demonstrations. In a concept class of 930 possible logical specifications, the algorithm only had to query 172 (about 18%), representing a 5.5x speedup over brute-force search.
- Robustness: Unlike scalar IRL—which failed and caused the agent to dive into lava when a single charging tile was removed—the specification-based agent remained safe. Because the rule "Avoid Lava" is an absolute Boolean constraint, the agent will never choose a path through lava regardless of how the environment changes.
Limitations and Future Work
While promising, the current framework has a few limitations:
- Finite Horizon: The approach currently focuses on "finite traces" (tasks with a clear beginning and end within a fixed time window).
- Predefined Grammar: The system requires a predefined "concept class" of potential rules. If the true task falls outside this grammar, it cannot be learned.
- Discrete Spaces: Evaluation was limited to discrete gridworlds; extending this logic to continuous robotic control remains an open challenge.
- Scalability: Although BDDs are efficient, highly complex environments could still cause computational bottlenecks during the symbolic encoding phase.
Summary updated