Abstract
Text-based games are simulations in which an agent interacts with the world purely through natural language. They typically consist of a number of puzzles interspersed with interactions with common everyday objects and locations. Deep reinforcement learning agents can learn to solve these puzzles. However, the everyday interactions with the environment, while trivial for human players, present as additional puzzles to agents. We explore two techniques for incorporating commonsense knowledge into agents: inferring possibly hidden aspects of the world state with either a commonsense inference model (COMET) or a language model (BERT), and biasing an agent's exploration according to common patterns recognized by a language model. We test our technique in the 9:05 game, which is an extreme version of a text-based game that requires numerous interactions with common, everyday objects in common, everyday scenarios. We conclude that agents that augment their beliefs about the world state with commonsense inferences are more robust to observational errors and omissions of common elements from text descriptions.
Introduction
Text-based games, or interactive fiction, present a unique challenge for Reinforcement Learning (RL) agents. Unlike traditional video games with visual inputs, these environments require an agent to understand and interact with a world described entirely in natural language. While deep RL has seen success in these domains, agents often struggle with tasks that are intuitive to humans. This is primarily due to a lack of "common sense." For instance, a human player knows that a bathroom likely contains a sink, even if the game text fails to mention it. A standard RL agent, starting as a tabula rasa, cannot make such inferences, leading to observational gaps and inefficient exploration in vast action spaces.
Methodology
To bridge this gap, we build upon the KG-A2C baseline, which utilizes a Knowledge Graph (KG) to maintain a persistent state of the world. We propose three augmented architectures designed to inject background knowledge into the agent's decision-making process:
- The Q*BERT Agent: This model employs ALBERT (a BERT variant) to generate and answer questions about the environment. The resulting answers are converted into (subject, relation, object) triples and integrated into the Knowledge Graph, effectively "filling in" details omitted from the game's explicit text.
- The COMET-A2C Agent: This agent utilizes COMET, a model trained on ConceptNet, to perform commonsense inference. It specifically leverages the
HasArelation to infer objects likely present in a room (e.g., inferring a "Sink" in a "Bathroom"). - KG-A2C-BERT (Policy Shaping): Unlike the previous two, this agent uses BERT’s Next Sentence Prediction (NSP) to rank potential commands. It biases the agent toward actions that logically follow the history of previous commands based on patterns learned from large-scale text corpora.
Experimental Evaluation
We evaluated these agents using 9:05, a "slice-of-life" game from the Jericho suite. The game requires mundane but logically sequenced tasks: waking up, washing, dressing, and driving to work. To test robustness, we also created a Modified Observation version of the game where all textual references to the sink, toilet, and shower were removed from the bathroom description.
Key Results and Analysis
Our experiments demonstrate that augmenting an agent's belief about the world state is significantly more effective than simply biasing its exploration policy.
In the Full Observation scenario, the baseline KG-A2C failed to progress past the bathroom. In contrast, both COMET-A2C and QBERT successfully navigated the sequence. More importantly, in the Modified Observation scenario, the baseline and the BERT-exploration agent failed completely, while QBERT and COMET-A2C maintained their success. This proves that commonsense-equipped agents can "see" and interact with necessary objects through inference, even when they are missing from the text.
Q*BERT showed the most consistent convergence, likely because it can infer a more diverse set of attributes and relations compared to the more limited HasA link used by COMET-A2C. This highlights the importance of declarative knowledge (what exists) over procedural knowledge (what to do next) in sparse-reward environments.
Conclusion
Incorporating commonsense knowledge through state augmentation makes RL agents more robust to noisy or incomplete observations. While these models currently rely on human-centric, real-world data, they represent a significant step toward agents that can navigate complex, everyday scenarios. Future work will explore the scalability of these inferences to larger, more open-ended worlds and the potential to reduce reliance on manual reward engineering.
Summary updated