Abstract
Interactive Fiction (IF) games present a unique challenge for Reinforcement Learning (RL) due to their combinatorial action spaces, partial observability, and sparse rewards. This paper introduces two key architectural enhancements: score contextualization, which uses the game score to partition complex tasks into simpler subtasks, and action gating, which filters out inadmissible actions that do not change the environment state. Our results on the SaladWorld benchmark and the classic game Zork I show that these methods significantly improve agent performance and learning efficiency.
Introduction
Text-based games, or Interactive Fiction, require agents to navigate and interact with worlds using natural language. Unlike traditional RL environments with discrete, low-dimensional action spaces, IF environments like Zork offer thousands of possible text commands at any given moment, but only a tiny fraction are meaningful. Furthermore, the agent must maintain a long-term memory of its actions and observations to solve complex puzzles. This paper addresses these hurdles by proposing a modular architecture that leverages game-specific heuristics—score and state change—to guide the learning process without relying on external game-state trackers or pre-defined command lists.
Methodology
The proposed architecture consists of three primary components designed to handle the linguistic and structural complexity of IF games:
- Representation Generator ($\Phi_R$): An LSTM-based encoder that processes the history of observations ($o_t$) and actions ($a_{t-1}$) into a latent representation.
- Score Contextualization (SC): To manage long-term dependencies and sparse rewards, the agent treats the accumulated score as a state variable. The network employs $K$ distinct heads; as the score increases, the agent transitions between these heads, effectively treating the game as a sequence of simpler subtasks.
- Action Gating (Admissibility): An auxiliary classifier ($\Phi_C$) is trained to predict whether a proposed action is "admissible" (i.e., it changes the game state). This allows the agent to prune the action space. We explored several gating mechanisms, including Masking (threshold-based filtering), Dropout (probabilistic inclusion), and CQLH (mathematical penalty for inadmissible actions).
Experimental Results
We evaluated our approach on SaladWorld, a synthetic benchmark with seven levels of increasing difficulty, and ZORK I, the iconic 1980s text adventure.
Performance on SaladWorld
In SaladWorld, the combination of score contextualization and action gating allowed the agent to solve tasks that were previously insurmountable for baseline models. While baseline agents failed completely on Levels 4 through 7, our SC-enabled agents maintained steady progress.
As shown in the learning curves above, the SC model (and its oracle variant) converges to a perfect completion rate much faster than the baseline. The results indicate that while action gating helps refine the search space, score contextualization is the primary driver for solving multi-stage puzzles.
Efficiency in Zork I
In Zork I, the proposed agent reached a score of 35—the threshold for completing the initial "troll quest"—in approximately half the training steps required by previous state-of-the-art models like AE-DQN. This efficiency gain highlights the power of pruning the action space and focusing on state-changing commands.
Conclusion
By incorporating score contextualization and action gating, we have demonstrated that RL agents can effectively navigate the vast action spaces of text-based games. Score contextualization serves as a powerful proxy for progress, allowing the network to focus on relevant subtasks, while action gating reduces the "noise" of non-functional commands. Future work will focus on improving exploration strategies to overcome plateaus in more complex, non-linear segments of games like Zork.
Summary updated