Abstract
When humans perform a particular task, they do so hierarchically: splitting higher-level tasks into smaller sub-tasks. However, most works on natural language (NL) command of situated agents have treated the procedures to be executed as flat sequences of simple actions, or any hierarchies of procedures have been shallow at best. In this paper, we propose a formalism of procedures as programs, a method for representing hierarchical procedural knowledge for agent command and control aimed at enabling easy application to various scenarios. We further propose a modeling paradigm of hierarchical modular networks, which consist of a planner and reactors that convert NL intents to predictions of executable programs and probe the environment for information necessary to complete the program execution. We instantiate this framework on the IQA and ALFRED datasets for NL instruction following. Our model outperforms reactive baselines by a large margin on both datasets. We also demonstrate that our framework is more data-efficient, and that it allows for fast iterative development.
Introduction
Executing complex natural language (NL) commands in situated environments remains a significant challenge for AI agents. Most existing approaches rely on reactive strategies that map high-level instructions directly to flat sequences of low-level motor actions. This "flat" approach suffers from a significant semantic gap between abstract language and atomic controls, leading to data inefficiency and poor generalization in dynamic environments. Humans, by contrast, tackle such tasks hierarchically by decomposing them into manageable sub-tasks.
Methods: Procedures as Programs and HMN
We propose Procedures as Programs (PaP), a framework that represents hierarchical procedural knowledge as executable code. Instead of learning every step from scratch, the system utilizes a library of Python functions. These functions can call other functions to create a hierarchy, use control flow (e.g., if/else, for loops) to handle environment-specific logic, and reuse logic across different tasks. For instance, a "pick up" routine can be shared between "preparing a meal" and "cleaning a room."
To implement PaP, we introduce Hierarchical Modular Networks (HMN). This architecture consists of two primary components:
- The Planner: A sequence-to-sequence model that translates a natural language command into a call to a high-level program within the library.
- The Reactors: Modular neural network classifiers that serve as the agent's perception system. When a program encounters a conditional statement (e.g., checking if a container is open), it invokes a specific Reactor to process visual input and return the necessary state information.
This decoupling allows high-level planning to remain invariant to low-level perceptual details, enhancing the agent's robustness and making the system easier to debug and update.
Experimental Results
The framework was evaluated on the IQA (Interactive Question Answering) and ALFRED benchmarks within the THOR simulated environment.
Performance and Generalization
Our model demonstrates substantial performance gains, particularly in "unseen" environments. In IQA, the PaP-HMN model achieved an 83.8% accuracy rate in new houses, vastly outperforming the 18.9% achieved by reactive baselines. On the ALFRED benchmark, the model nearly doubled baseline performance when paired with an "Oracle" object detector, reaching a 54.5% success rate.
Data Efficiency and Usability
A key advantage of the HMN framework is its data efficiency. Our experiments show that the model trained on only 20% of the available data can outperform a baseline model trained on the full 100% dataset. This efficiency stems from the "hierarchy prior" injected via the Python library, which prevents the agent from needing to relearn basic logical constraints from scratch. Furthermore, the framework supports fast iterative development; a programmer was able to construct a functional procedure library for the complex ALFRED tasks in just 90 minutes.
Conclusion and Future Work
The PaP-HMN framework offers a scalable and interpretable method for commanding situated agents. By leveraging hierarchical programs, we bridge the gap between abstract intent and physical action. While the current library requires manual design, future work will explore automated library induction to mine these procedures from large-scale human action data.
Summary updated