Efficient Text-based Reinforcement Learning by Jointly Leveraging State and Commonsense Graph Representations

Keerthiram Murugesan, Mattia Atzeni, Pavan Kapanipathi, Kartik Talamadupula, Mrinmaya Sachan, Murray Campbell

Abstract

Reinforcement Learning (RL) agents operating in text-based environments face significant hurdles due to combinatorially large action spaces and a fundamental lack of world logic. We introduce BiKE (Bidirectional Knowledge graph attEntion), a novel framework that jointly leverages a dynamic State Graph for environment tracking and an external Commonsense Graph for general world knowledge. By facilitating bidirectional communication between these representations, BiKE enables agents to ground abstract logic into specific game states. Our evaluation on the TextWorld Commonsense (TWC) benchmark demonstrates that BiKE achieves superior sample efficiency and generalizes more effectively to unseen objects compared to state-of-the-art baselines.

Introduction

Text-based games (TBGs), such as Zork, require agents to process natural language observations and generate text commands (e.g., put the red apple in the fridge). These environments present two primary challenges: partial observability, where the agent must maintain a mental model of the world from textual descriptions, and a lack of world logic, where the agent does not inherently know that a "dirty plate" belongs in a "dishwasher."

Conceptual overview of BiKE, showing the construction of State and Commonsense graphs to solve a kitchen cleanup task.

While previous research has explored state tracking or external knowledge retrieval in isolation, BiKE addresses the critical gap of jointly reasoning across both. By allowing these two symbolic representations to "talk" to each other, the agent can more effectively navigate complex, multi-room environments and perform goal-oriented tasks.

Methodology

Graph Representations

The BiKE architecture fuses two distinct symbolic representations to inform the agent's decision-making:

  1. State Graph (SG): A dynamic representation built during gameplay using Open Information Extraction (OpenIE) and manual heuristics. It tracks entities and their current relations (e.g., apple — on — table).
  2. Commonsense Graph (CG): A static sub-graph extracted from ConceptNet, providing general world knowledge (e.g., apple — AtLocation — fridge).

Both graphs are processed using Graph Attention Networks (GAT), which allow nodes to aggregate information from their local neighborhoods, creating rich, context-aware embeddings.

Bidirectional Knowledge Graph Attention (BiKE)

The core innovation of this work is the BiKE module, inspired by bidirectional attention mechanisms used in machine reading comprehension. BiKE computes a similarity matrix between the nodes of the SG and the CG to facilitate two-way information flow:

  • State-to-Commonsense: Identifies which parts of the agent's general knowledge are most relevant to the current observed game state.
  • Commonsense-to-State: Uses general logic to "re-contextualize" the agent's understanding of the current room, highlighting potential interactions.
The BiKE architecture, highlighting the bidirectional attention mechanism between state and commonsense representations.

The resulting fused features are integrated with textual observation embeddings and fed into an Actor-Critic framework to predict the optimal next action.

Experimental Evaluation

We evaluated BiKE using the TextWorld Commonsense (TWC) framework across three difficulty levels (Easy, Medium, and Hard). To test robustness, we utilized two distinct setups:

  • In-Distribution (IN): Entities seen during training are reused in testing.
  • Out-of-Distribution (OUT): Testing involves entities never encountered during training, forcing the agent to rely on its external commonsense knowledge to generalize.

Results and Discussion

Performance and Efficiency

BiKE consistently outperformed all baselines, including DRRN and KG-A2C, across all difficulty levels. In the "Hard" (IN) setting, BiKE achieved a Normalized Score of 0.34, surpassing the text-only baseline's score of 0.30. Furthermore, BiKE demonstrated higher efficiency, completing tasks in approximately 47 steps compared to the baseline's 50.

Zero-Shot Generalization

A key finding was BiKE's performance on the "OUT" test set. While text-only agents suffered significant performance degradation when encountering novel objects, BiKE maintained high performance. This suggests that the joint graph representation is essential for handling novel scenarios by grounding new objects in existing commonsense logic.

Qualitative Insights

Analysis of the attention weights revealed that the agent utilizes the graphs for different functional needs. It relies more heavily on the State Graph for navigation and exploration (e.g., go north) and shifts its attention to the Commonsense Graph for specific goal-oriented placements (e.g., put apple in fridge). This synergy is vital for solving "Hard" levels where navigation and logic must occur simultaneously.

Conclusion

BiKE demonstrates that the bidirectional integration of dynamic state tracking and static commonsense knowledge significantly enhances RL performance in text-based games. Future work will focus on reducing the reliance on manual heuristics for graph construction and exploring more sophisticated retrieval methods to scale the commonsense knowledge base for massive open-world environments.

Summary updated

BibTeX
@inproceedings{murugesan2021efficient,
  author = {Keerthiram Murugesan and Mattia Atzeni and Pavan Kapanipathi and Kartik Talamadupula and Mrinmaya Sachan and Murray Campbell},
  title = {{Efficient Text-based Reinforcement Learning by Jointly Leveraging State and Commonsense Graph Representations}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-short.91},
}
Figure