ProTo: Program-Guided Transformer for Program-Guided Tasks

Zelin Zhao, Karan Samel, Binghong Chen, Le Song

Abstract

Executing complex, multi-step instructions remains a significant challenge in artificial intelligence, particularly when bridging the gap between symbolic reasoning and neural perception. This paper introduces the Program-Guided Transformer (ProTo), a novel architecture designed to execute symbolic programs within a learned latent space. By disentangling a program's semantic meaning from its control-flow structure, ProTo provides a general-purpose framework for tasks ranging from visual question answering to robotic policy learning. Experimental results demonstrate that ProTo outperforms existing neural-symbolic models in generalization and robustness, particularly when handling complex, human-written instructions.

Introduction

While deep learning has achieved remarkable success in perception, getting agents to follow structured, multi-step instructions is often hindered by the ambiguity of natural language. Programs offer a cleaner, compositional alternative, yet previous "program-guided" models typically relied on ad-hoc, hard-coded executors that struggle to scale or generalize to novel logic.

ProTo addresses this by serving as a general program executor that unifies perception, reasoning, and decision-making. It is evaluated across two primary domains: visual reasoning (GQA) and policy learning (2D Minecraft), as shown in the task overview below.

Overview of Program-guided Visual Reasoning and Policy Learning tasks.

Methods

The core innovation of ProTo is its ability to treat a program as a set of interacting "objects" or routines rather than a simple sequence of tokens. This is achieved through a disentangled program representation and a specialized inference cycle.

Disentangled Program Representation

ProTo splits a program into two distinct components to manage complexity:

  • Semantic Guidance ($P^s$): An embedding matrix representing the "what" of each routine (e.g., the meaning of Filter(girl) or Mine(gold)).
  • Structural Guidance ($P^t$): A transition mask that defines the "how" of the program flow. This acts as a roadmap, directing the model to relevant previous routine results for the current step.
Disentangled representation of programs into semantic and structural guidance.

The ProTo Inference Cycle

At each execution step, the model performs three operations:

  1. Semantic Injection: Maps the routine's meaning into a result embedding matrix via cross-attention.
  2. Structural Message Passing: Uses masked self-attention, guided by the transition mask, to pass information from "parent" routines to "child" routines, handling logical dependencies.
  3. Grounding: A second cross-attention layer connects internal logic to the external "specification" (e.g., image pixels or environment state).

Unlike symbolic executors that produce discrete outputs, ProTo operates in a learned latent space. This allows it to maintain high-dimensional representations of intermediate results, preserving nuanced information that might be lost in strictly Boolean or categorical systems.

Experimental Evaluation

Datasets

The model was tested on three key benchmarks:

  • GQA (Visual Reasoning): 22 million questions about real-world images converted into programs.
  • 2D Minecraft (Policy Learning): A grid-world where agents follow programs with loops (While) and conditionals (If).
  • GQA-Human-Program: A validation set of 500 programs written by human volunteers to test robustness against non-synthetic, "awkward" logic.

Key Results

ProTo achieved state-of-the-art (SOTA) performance on the GQA test server with 65.14% accuracy, a 4.31% improvement over the previous leading program-based model (MMN). In the Minecraft environment, ProTo maintained a 95.0% success rate on complex programs, significantly outperforming vanilla Transformers (40.8%) and specialized agents (89.7%).

Notably, ProTo showed a 10-point lead over previous models when following human-written programs, suggesting it is far more robust to the variations in human logical expression than its predecessors.

Discussion and Future Work

ProTo demonstrates that treating a Transformer as a dynamic graph—where the topology is defined by the program's structure—enables superior compositional generalization. By learning to execute individual routines and their relationships, the model excels at "Unseen Programs" that it never encountered during training.

However, limitations remain. ProTo currently requires dense supervision or program annotations, which are costly to produce. Future research will focus on reducing these supervision requirements, extending the architecture to 3D embodied reasoning, and improving the efficiency of the Transformer for even longer, more hierarchical programs. Additionally, ensuring the safety and adversarial robustness of learned executors remains a priority for real-world robotic applications.

Summary updated

BibTeX
@inproceedings{zhao2021proto,
  author = {Zelin Zhao and Karan Samel and Binghong Chen and Le Song},
  title = {{ProTo: Program-Guided Transformer for Program-Guided Tasks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
}
Figure