Behavior Cloned Transformers are Neurosymbolic Reasoners

Ruoyao Wang, Peter A. Jansen, Marc-Alexandre Côté, Prithviraj Ammanabrolu

Abstract

In this work, we explore techniques for augmenting interactive agents with information from symbolic modules, much like humans use tools like calculators and GPS systems to assist with arithmetic and navigation. We test our agent's abilities in text games -- challenging benchmarks for evaluating the multi-step reasoning abilities of game agents in grounded, language-based environments. Our experimental study indicates that injecting the actions from these symbolic modules into the action space of a behavior cloned transformer agent increases performance on four text game benchmarks that test arithmetic, navigation, sorting, and common sense reasoning by an average of 22%, allowing an agent to reach the highest possible performance on unseen games. This action injection technique is easily extended to new agents, environments, and symbolic modules.

Introduction

While Large Language Models (LLMs) are impressively fluent, they frequently stumble on tasks requiring precise, multi-step logic, such as arithmetic, complex navigation, or sorting items by specific attributes. In the context of text games (interactive fiction), agents must reason through textual descriptions to solve puzzles. Current agents typically solve only about 30% of classic text games because they are "monolithic"—attempting to handle language understanding, math, and spatial reasoning entirely within their neural weights.

Humans, by contrast, are neurosymbolic: we use neural intuition for language but reach for symbolic tools like calculators or maps for precise tasks. This paper explores how to give AI agents that same modular advantage by augmenting interactive agents with information from symbolic modules.

Methodology: Action Injection

The core contribution of this work is a technique called Action Injection. Instead of forcing the model to perform all computations internally, the authors expand the agent's action space to include outputs from specialized symbolic modules.

The Action Injection process: the agent reads a problem, queries a symbolic module (e.g., for division), and uses the result to perform a grounded action in the environment.

Symbolic Modules and Training

Four Python-based modules were developed to assist the agent:

  1. Arithmetic: A calculator for basic operations.
  2. Navigation: A pathfinder providing the next step toward a destination.
  3. Sorting: A module that orders objects by quantity or weight.
  4. Knowledge Base: A lookup tool for common-sense facts (e.g., object locations).

The agent, based on a T5-base transformer, is trained via Behavior Cloning (BC). By providing the model with "gold trajectories"—expert sequences that demonstrate exactly when and how to use these symbolic tools—the transformer learns to treat symbolic commands like any other valid action.

Experimental Setup

The approach was evaluated on four pick-and-place benchmarks in the TextWorldExpress engine:

  • Text World Common Sense (TWC): Tidying a house by placing objects in canonical locations.
  • MapReader: Navigating a map to find and store a coin.
  • Arithmetic: Solving word problems to identify the correct object to pick up.
  • Sorting: Placing 3–5 objects in a box in increasing order of weight or quantity.

Results and Discussion

The neurosymbolic approach yielded significant improvements in both accuracy and efficiency. As shown in the experimental results, the Neurosymbolic Behavior Cloned Transformer (BCT) achieved an average score of 0.99, effectively solving the benchmarks where the baseline BCT scored 0.72.

Performance comparison across benchmarks showing that the Neurosymbolic BCT achieves near-perfect scores and requires fewer steps than baseline models.

Key Findings

  • Imitation is Key for Tool-Use: Transformers excel at learning when to use a tool if shown expert demonstrations. Once a symbolic action is available, the transformer integrates it seamlessly into its strategy.
  • RL Struggles with Discovery: Standard Reinforcement Learning (RL) agents like DRRN did not benefit from symbolic modules. Without expert trajectories, the RL agent failed to discover the logical "recipe" for using tools within the expanded action space.
  • Efficiency: The neurosymbolic agent matched the efficiency of an "oracle" agent, reducing the average steps to completion from 11 to 7.

Conclusion

Injecting symbolic actions into a behavior cloned transformer allows agents to overcome the reasoning limitations of monolithic neural architectures. While this method currently relies on high-quality "gold trajectories," it demonstrates a clear path toward more capable, tool-using AI. Future work will focus on reinforcement learning methods that can learn to use these tools through exploration rather than pure imitation.

Summary updated

Abstract

In this work, we explore techniques for augmenting interactive agents with information from symbolic modules, much like humans use tools like calculators and GPS systems to assist with arithmetic and navigation. We test our agent's abilities in text games -- challenging benchmarks for evaluating the multi-step reasoning abilities of game agents in grounded, language-based environments. Our experimental study indicates that injecting the actions from these symbolic modules into the action space of a behavior cloned transformer agent increases performance on four text game benchmarks that test arithmetic, navigation, sorting, and common sense reasoning by an average of 22%, allowing an agent to reach the highest possible performance on unseen games. This action injection technique is easily extended to new agents, environments, and symbolic modules.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
Four text-game benchmarks: MapReader, Arithmetic, Sorting, and TWCBehavior cloned T5 model (without symbolic modules)average task performance0.72Text Game Playing · backbone=T5 · training=behavior-cloning · symbolic-modules=without
Source quote
L97: The results of both DRRN and behavior cloning experiments across each benchmark are shown in Table~\ref{tab:results}. The DRRN achieves a low average performance of 0.20 without modules, while adding symbolic modules into the action space does not improve performance. In contrast, the behavior cloned T5 model has a moderate average performance of 0.72 without modules, while adding symbolic modules increases average task performance to 0.99, nearly solving each task. Symbolic modules also make the behavior cloned agent more efficient, reducing the average steps required to complete the tasks from 11 to 7, matching oracle agent efficiency.
Four text-game benchmarks: MapReader, Arithmetic, Sorting, and TWCBehavior cloned T5 model (with symbolic modules)average task performance0.99Text Game Playing · backbone=T5 · training=behavior-cloning · symbolic-modules=with
Source quote
L97: The results of both DRRN and behavior cloning experiments across each benchmark are shown in Table~\ref{tab:results}. The DRRN achieves a low average performance of 0.20 without modules, while adding symbolic modules into the action space does not improve performance. In contrast, the behavior cloned T5 model has a moderate average performance of 0.72 without modules, while adding symbolic modules increases average task performance to 0.99, nearly solving each task. Symbolic modules also make the behavior cloned agent more efficient, reducing the average steps required to complete the tasks from 11 to 7, matching oracle agent efficiency.
Four text-game benchmarks: MapReader, Arithmetic, Sorting, and TWCBehavior cloned T5 model (without symbolic modules)average steps required to complete tasks11 stepsText Game Playing · backbone=T5 · training=behavior-cloning · symbolic-modules=without
Source quote
L97: The results of both DRRN and behavior cloning experiments across each benchmark are shown in Table~\ref{tab:results}. The DRRN achieves a low average performance of 0.20 without modules, while adding symbolic modules into the action space does not improve performance. In contrast, the behavior cloned T5 model has a moderate average performance of 0.72 without modules, while adding symbolic modules increases average task performance to 0.99, nearly solving each task. Symbolic modules also make the behavior cloned agent more efficient, reducing the average steps required to complete the tasks from 11 to 7, matching oracle agent efficiency.
Four text-game benchmarks: MapReader, Arithmetic, Sorting, and TWCBehavior cloned T5 model (with symbolic modules)average steps required to complete tasks7 stepsText Game Playing · backbone=T5 · training=behavior-cloning · symbolic-modules=with
Source quote
L97: The results of both DRRN and behavior cloning experiments across each benchmark are shown in Table~\ref{tab:results}. The DRRN achieves a low average performance of 0.20 without modules, while adding symbolic modules into the action space does not improve performance. In contrast, the behavior cloned T5 model has a moderate average performance of 0.72 without modules, while adding symbolic modules increases average task performance to 0.99, nearly solving each task. Symbolic modules also make the behavior cloned agent more efficient, reducing the average steps required to complete the tasks from 11 to 7, matching oracle agent efficiency.
Reported baseline / comparator measurements (1)
BenchmarkMethodMetricScoreProtocol / Evidence
Four text-game benchmarks: MapReader, Arithmetic, Sorting, and TWCDRRN (without symbolic modules) baselineaverage performance0.20Text Game Playing · method=DRRN · symbolic-modules=without
Source quote
L97: The results of both DRRN and behavior cloning experiments across each benchmark are shown in Table~\ref{tab:results}. The DRRN achieves a low average performance of 0.20 without modules, while adding symbolic modules into the action space does not improve performance. In contrast, the behavior cloned T5 model has a moderate average performance of 0.72 without modules, while adding symbolic modules increases average task performance to 0.99, nearly solving each task. Symbolic modules also make the behavior cloned agent more efficient, reducing the average steps required to complete the tasks from 11 to 7, matching oracle agent efficiency.
BibTeX
@inproceedings{wang2023behavior,
  author = {Ruoyao Wang and Peter A. Jansen and Marc-Alexandre Côté and Prithviraj Ammanabrolu},
  title = {{Behavior Cloned Transformers are Neurosymbolic Reasoners}},
  booktitle = {EACL},
  year = {2023},
  url = {https://openreview.net/forum?id=3wu1TYTMU2},
}
Figure