Deep reinforcement learning (RL) agents are excellent at pattern matching, but they often struggle with abstract relational reasoning and causal inference. This paper explores a fundamental question in Artificial Intelligence: Can language help agents learn the underlying "logic" of the world?
The researchers demonstrate that by training RL agents to predict natural language explanations as an auxiliary task, these agents become significantly better at mastering complex tasks, overcoming "shortcut" biases, and even learning how to perform scientific experiments to uncover causal rules.
The Problem: "Lazy" Agents and Shortcut Biases
Standard RL agents are notoriously "lazy." When tasked with a goal, they often latch onto the easiest available features—like a specific color or position—to maximize their reward, rather than learning the true underlying principle of the task. This leads to poor generalization; if the "shortcut" feature changes in a new environment, the agent fails.
Humans, by contrast, use language and explanations to build robust mental models. Explanations link concrete observations to abstract concepts (e.g., "I picked this because it's the only triangle"). The authors address the gap between high-bandwidth sensory input (pixels) and abstract reasoning by using language as a "scaffold" to shape the agent's internal representations.
Methods: The Explanation Head
The researchers used the IMPALA RL framework, equipping their agents with a visual encoder, a powerful memory module (GTrXL), and several output "heads." The core innovation of this architecture is the Explanation Head.
During training, the agent is required to predict a language string explaining the scene or its reward. Crucially, this is an auxiliary task—the language is never used as an input at test time. The agent must "imagine" the explanation internally. The agent is trained using a combination of standard RL losses and a supervised cross-entropy loss for language generation.
The system utilizes two primary types of explanations:
- Property Explanations: Describing the object the agent is looking at (e.g., "This is a large, striped, purple pentagon").
- Reward Explanations: Explaining the logic of the success or failure (e.g., "Correct, it is uniquely green").
Experimental Datasets and Tasks
The study utilizes two custom-built RL environments: a 2D Grid World (Pycolab) and a 3D Room (Unity). The 3D environment is particularly challenging because the agent cannot see all objects at once and must rely on memory to navigate and "grab" objects.
Within these environments, agents are evaluated on two main tasks:
- Odd-One-Out: Identifying the unique object in a set based on a single dimension (e.g., the only green object among red ones).
- Causal Intervention: A "meta-learning" setup where the agent is given a "magic wand" to change object properties. It must experiment with the wand to figure out which feature dimension currently determines the reward.
Key Insights and Results
Adding the explanation requirement yielded dramatic improvements across the board:
- 3D Performance: In the 3D odd-one-out task, agents trained with explanations reached ~93% accuracy, while reward-only agents performed near chance (~30%).
- Causal Reasoning: In the "hard" version of the magic wand task, explanation-trained agents achieved ~90% success, whereas standard RL agents failed to learn the task at all (~25%).
- Prediction is Better than Input: Surprisingly, giving the agent the explanation as a text input is less effective than making the agent predict the explanation itself. Prediction forces the agent to develop internal features that represent the "why," whereas text input allows the agent to "pass through" the information without truly understanding the visual scene.
- Language as a Deconfounder: In "confounded" training scenarios (e.g., the odd-one-out is always both the only triangle and the only green object), standard agents get confused. Agents trained to explain that they are looking for "shape" learn to ignore irrelevant color cues, leading to much higher accuracy on new, deconfounded tests.
- Learning Speed: Language prediction is learned much faster than the RL task itself. This suggests that language provides a "stable signal" that helps the agent organize its visual world long before it figures out how to maximize reward.
Limitations and Future Work
While promising, the current approach relies on synthetic language generated from templates. Real-world human explanations are far more diverse, ambiguous, and context-dependent. Furthermore, the training process currently requires the environment to "know" the correct explanation to provide the target for the agent. Scaling this to environments where ground truth isn't available would likely require human-in-the-loop training or more advanced self-supervised language models. Nonetheless, learning from explanations offers a powerful principle for training more robust and general machine learning systems.
Summary updated