Instruction following is a cornerstone of human-robot interaction. However, if you’ve ever tried to follow a poorly written IKEA manual or a vague recipe, you know that natural language is often messy, ambiguous, and lacks the logical structure needed for complex, multi-step tasks.
In their ICLR 2020 paper, Program Guided Agent, researchers propose a fundamental shift in how we instruct autonomous agents. Instead of relying on the "fuzzy" nature of human speech, they suggest using structured programs as a precise, expressive, and unambiguous way to specify tasks.
By decoupling program interpretation from perception and action, their "Program Guided Agent" achieves near-perfect zero-shot generalization to complex tasks that are twice as long as those seen during training—far outperforming standard natural language models.
The Problem with Natural Language
Most current agents learn from natural language instructions or expert demonstrations. While user-friendly, these methods have significant drawbacks when applied to complex environments:
- Ambiguity: An instruction like "Pick up the block" might be unclear if there are multiple blocks or if the action depends on a hidden condition.
- Lack of Logic: Natural language struggles to represent complex control flows. Expressing concepts like "Repeat this until the chest is full, but if you see a river, build a bridge first" is prone to misinterpretation by standard models.
- Generalization Failures: End-to-end models (like LSTMs or Transformers) often fail catastrophically when asked to perform a task that is significantly longer or more complex than what they saw during training.
The authors argue that formal programs provide the necessary structure to solve these issues, acting as a robust bridge between high-level human intent and low-level robot actions.
A Modular Framework
To execute tasks specified by formal programs (complete with loops and if/else logic), the researchers developed a modular framework consisting of three distinct components:
- Program Interpreter (Rule-based): Unlike the other modules, this component is not learned. It uses a Domain Specific Language (DSL) to parse a program into a tree structure. It traverses this tree to decide whether the agent needs to "perceive" something (check a condition) or "act" (execute a subtask).
- Perception Module (Learned): This module grounds symbolic queries into the environment. For example, if the program asks
is_there[River], this neural network evaluates the current state and returns a Booleantrueorfalse. - Policy/Action Module (Learned): This is a multitask policy trained via Reinforcement Learning (A2C). It takes a specific subtask (like
mine(Wood)) and executes the low-level motor actions (move, pick up) required to achieve it.
The Secret Sauce: Feature Modulation
To make the policy more efficient, the authors utilized a modulation mechanism (similar to FiLM). Instead of simply concatenating the goal onto the state representation, the goal generates parameters that mathematically scale and shift the agent's visual features. This allows the goal to act as a "filter" on the environment, highlighting only the information relevant to the current subtask and ignoring distractions.
Experimental Setup and Key Results
The framework was evaluated in a 2D Minecraft-inspired gridworld where agents navigate terrains, collect resources, build tools, and interact with NPCs. The researchers generated 4,500 programs via the DSL. To test the limits of generalization, they created a "test-complex" set featuring programs that were twice as long and had significantly more branching logic than the training set.
The Program Guided Agent dominated the benchmarks, particularly in zero-shot generalization:
- High Task Completion: On the standard test set, the agent achieved 94.0% accuracy.
- Robust Zero-Shot Generalization: On the "test-complex" set, the agent maintained an impressive 91.8% accuracy. In contrast, natural language models saw their performance plummet, with some dropping by over 40%.
- Tiny Generalization Gap: The proposed method had a performance gap of only 2.3% between simple and complex tasks. The best natural language baseline (a Transformer) suffered a massive gap of 27.2%.
Why Does This Work So Well?
The secret to this success lies in modularity. Because the interpreter is rule-based and the policy only focuses on one subtask at a time, the agent is entirely agnostic to the overall length of the program. It treats a 100-line program the exact same way it treats a 5-line program.
Furthermore, by using a hard-coded interpreter for the program logic, the researchers avoided the "black box" problem where neural networks struggle to learn basic programming concepts like loops or nested if-statements from scratch.
Limitations and Future Work
While powerful, the framework has limitations. The agent requires a predefined formal language, and writing code is inherently less accessible to average users than speaking naturally. The authors acknowledge that the ultimate goal is to bridge these two worlds—perhaps by training a semantic parser to translate messy natural language into these highly structured, executable programs. Additionally, scaling the perception module from simple Boolean checks to complex, high-dimensional environments with many object attributes remains an open challenge for future research.
Paper Citation: Sun, S. H., Wu, T. L., & Lim, J. J. (2020). Program Guided Agent. International Conference on Learning Representations (ICLR).
Summary updated