Abstract
Generalization to out of distribution tasks in reinforcement learning is a challenging problem. One successful approach improves generalization by conditioning policies on task or environment descriptions that provide information about the current transition or reward functions. Previously, these descriptions were often expressed as generated or crowd sourced text. In this work, we begin to tackle the problem of extracting useful information from natural language found in the wild (e.g. internet forums, documentation, and wikis). These natural, pre-existing sources are especially challenging, noisy, and large and present novel challenges compared to previous approaches. We propose to address these challenges by training reinforcement learning agents to learn to query these sources as a human would, and we experiment with how and when an agent should query. To address the how, we demonstrate that pretrained QA models perform well at executing zero-shot queries in our target domain. Using information retrieved by a QA model, we train an agent to learn when it should execute queries. We show that our method correctly learns to execute queries to maximize reward in a reinforcement learning setting.
Introduction
Reinforcement Learning (RL) agents typically excel at specific, narrow tasks but struggle to generalize when faced with novel environments or mechanics. While providing agents with text-based task descriptions can improve generalization, most existing research relies on "templated" text—highly structured sentences generated specifically for machine consumption.
In contrast, real-world information exists "in the wild" within noisy internet forums, dense documentation, and sprawling wikis. This paper introduces a framework for agents to "read the manual" by querying these pre-existing, unstructured text sources. By leveraging a pretrained Question Answering (QA) model, agents can learn both how to extract relevant information and when it is strategically beneficial to do so.
Methodology
The authors decompose the challenge into two primary components: information extraction and action integration.
How to Query: Information Extraction
Rather than training a language model from scratch, the framework utilizes a massive, pretrained UnifiedQA model (3 billion parameters). The agent treats "wild" text—specifically NetHack wiki pages—as context and prompts the model with targeted questions (e.g., "What is this monster resistant to?"). This allows the agent to convert unstructured text into structured data, such as a binary vector of monster attributes, without requiring domain-specific language training.
When to Query: Action Integration
Querying is integrated directly into the agent's action space. However, querying is not "free"; it consumes a turn, incurring the same time penalty as moving or attacking. To help the agent discover the value of querying, the authors implemented a +Explore strategy. This forces the agent to query with a 25% probability early in training, which gradually decays as the agent learns the utility of the information retrieved.
Results and Key Insights
Zero-Shot Extraction and Generalization
The UnifiedQA model significantly outperformed keyword-search baselines, achieving an F1 score of 0.76 for monster resistances and 0.62 for attack types. Crucially, the QA-based approach demonstrated superior generalization. While standard language encoders (like LSTMs) often overfit to training text, the QA model's structured representation allowed the agent to maintain performance when encountering novel, unseen monsters.
Agent Performance and Efficiency
In the full RL task, the Query+Explore Agent achieved a reward of 2.28, nearly matching the performance of an "Oracle Agent" (2.34) that possessed perfect information from the start. This significantly outperformed the baseline agent, which achieved only 2.16 without text access.
Furthermore, the agent learned to be selective. Its "Query Relevance" score reached 0.67, indicating it learned to prioritize querying monsters where the resulting information was actually necessary for survival or success.
Conclusion and Future Work
This work demonstrates that RL agents can successfully leverage "wild" internet text to inform their decision-making. However, several challenges remain. Currently, the questions the agent asks are pre-defined by researchers; a major next step is teaching agents to formulate their own queries based on environmental context. Additionally, while the NetHack wiki is a rich source, scaling this to the open internet presents significant computational and noise-filtering challenges. Future research will focus on optimizing the cost of running large QA models within RL loops and expanding the diversity of text sources.
Summary updated