An Analysis of Deep Reinforcement Learning Agents for Text-based Games

Chen Chen, Yue Dai, Josiah Poon, Caren Han

TL;DR

This paper provides a much-needed standardized benchmark for Deep Reinforcement Learning (DRL) agents in text-based games, stripping away the "cheat codes" of hand-crafted rules to see which neural architectures actually perform best. The researchers discovered that while Transformers and CNNs lead the pack in efficiency and performance, massive pre-trained models like BERT surprisingly struggle to learn from scratch in these interactive, low-data environments.

What Problem Does This Paper Address?

Text-based games (TBGs) are essentially "interactive fiction" where an agent must navigate a world, manipulate objects, and solve quests using only text descriptions and commands. For AI, this is a nightmare: the environment is partially observable (you only see the room you're in), and the state and action spaces are theoretically infinite.

Historically, research in this field has been fragmented. Different teams used different games, evaluation metrics, and—most importantly—varying levels of "hand-crafted rules" (like hard-coded maps or specific vocabulary filters). This makes it nearly impossible to tell if a new model is actually smarter or if it just had better human-designed shortcuts. The authors tackle this by creating a standardized environment to compare deep learning modules head-to-head without any manual assistance.

Figure 1: Text-based Game Agent Workflow

Methods

The authors conducted an extensive ablation study using a standardized agent framework. They focused on two main components:

  1. Encoder Types: They tested five architectures to process game text: Recurrent Neural Networks (GRU and LSTM) and non-recurrent models (CNN, Transformer, and BERT).
  2. Word Embeddings: They compared training embeddings from scratch against using pre-trained weights from GloVe, FastText, and BERT.

The agents were trained using Reinforcement Learning (specifically Deep Q-Learning and Actor-Critic frameworks) to map text descriptions to optimal actions. The study tracks the evolution of these methods over time, as shown in their historical overview:

Table 1: Historical overview of text-based game papers

Datasets

The researchers utilized TextWorld, a sandbox for generating TBGs. To test different difficulty levels, they selected three specific game types:

  • Coin Collector (Easy): Simple navigation and a fixed action set.
  • Treasure Hunter (Medium): Increased map size and complexity.
  • Cooking Recipe (Hard): Requires gathering multiple ingredients and performing specific sequences of actions (e.g., "chop onion," "fry onion").

Evaluation was split into two settings: Multiple Games (training and testing on different versions of the same game type) and Generalization (testing on 20 completely unseen games).

Key Insights and Ideas

  • The "BERT Paradox": In traditional NLP, BERT is the gold standard. However, the authors found that without pre-trained weights, BERT "can barely learn anything" in a TBG environment. Its massive parameter count (109M+) makes it too heavy and inefficient for the trial-and-error nature of reinforcement learning in these sparse-data settings.
  • Efficiency vs. Power: The Transformer encoder emerged as a "sweet spot." It achieved performance comparable to a CNN but with roughly 7.7 times fewer parameters (1.7M vs 13.4M). This efficiency allows the agent to explore more states in the same amount of training time.
  • The Generalization Gap: There is a very weak correlation between performing well on "seen" games and "unseen" games. Models that mastered the training set often failed miserably on new games, suggesting they are memorizing specific text patterns rather than learning general strategies.
  • Pre-training Pitfalls: While pre-trained embeddings like GloVe help in some scenarios, they often lead to overfitting in TBGs. Surprisingly, non-pretrained embeddings—which learn directly from the game's rewards—often fit the training data much better.

Key Results

  • Top Performers: CNN and Transformer encoders were the only ones to consistently converge on optimal policies for the Easy and Medium games.
  • Hard Game Failure: On the "Cooking Recipe" game, even the best models could only solve about 50% of the scenarios.
  • Parameter Counts: The study highlighted the massive disparity in model sizes:
  • GRU: 1.25M parameters
    • Transformer: 1.74M parameters
    • CNN: 13.47M parameters
    • BERT: 109.94M parameters
  • Generalization Scores: Performance on unseen games was generally low across all models, typically staying below a 0.4 completion rate.

Limitations and Future Work

The authors identify that current TBG agents lack a "general strategy." They might learn how to move through a specific house, but they don't understand the abstract concept of "gathering all required items before proceeding."

Future research needs to focus on:

  1. Better State Representations: Moving beyond simple text sequences to more structured representations (like knowledge graphs) that generalize better to unseen environments.
  2. Transfer Learning: Training agents on simpler tasks (like Coin Collector) and successfully transferring that knowledge to complex ones (like Cooking).
  3. Strategy-wise Rewards: Designing reward functions that encourage high-level strategic thinking rather than just immediate point-scoring.

Summary updated

BibTeX
@misc{chen2022analysis,
  author = {Chen Chen and Yue Dai and Josiah Poon and Caren Han},
  title = {{An Analysis of Deep Reinforcement Learning Agents for Text-based Games}},
  year = {2022},
  eprint = {2209.04105},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2209.04105},
}
Figure