Language Model-In-The-Loop: Data Optimal Approach to Learn-To-Recommend Actions in Text Games

Arjun Vaithilingam Sudhakar, Prasanna Parthasarathi, Janarthanan Rajendran, Sarath ChandararXiv 2023

Abstract

Large Language Models (LLMs) have demonstrated superior performance in language understanding benchmarks. CALM, a popular approach, leverages linguistic priors of LLMs -- GPT-2 -- for action candidate recommendations to improve the performance in text games in Jericho without environment-provided actions. However, CALM adapts GPT-2 with annotated human gameplays and keeps the LLM fixed during the learning of the text based games. In this work, we explore and evaluate updating LLM used for candidate recommendation during the learning of the text based game as well to mitigate the reliance on the human annotated gameplays, which are costly to acquire. We observe that by updating the LLM during learning using carefully selected in-game transitions, we can reduce the dependency on using human annotated game plays for fine-tuning the LLMs. We conducted further analysis to study the transferability of the updated LLMs and observed that transferring in-game trained models to other games did not result in a consistent transfer.

Introduction

Text-based games, such as Zork, present a significant challenge for Reinforcement Learning (RL) agents due to their combinatorial action spaces. At any given state, the number of possible text commands is virtually infinite. Recent state-of-the-art approaches like CALM address this by using Large Language Models (LLMs) to "prune" the action space, suggesting a small set of contextually relevant actions. However, these methods typically rely on static LLMs pre-trained on expensive human-annotated datasets (e.g., ClubFloyd) and do not adapt to the specific game environment during training. This paper introduces LM-in-the-Loop, a framework that fine-tunes the LLM dynamically using the agent's own experiences, reducing data dependency and improving performance.

Methodology

The LM-in-the-Loop framework integrates a GPT-2 model as a recommender with a Deep Reinforcement Relevance Network (DRRN) as the player. Unlike previous static approaches, the LLM is periodically updated using transitions collected during the RL agent's training.

The LM-in-the-Loop architecture combines an LLM recommender with a DRRN player, featuring a feedback loop for dynamic model updates.

The core innovation is the selection of "useful" transitions for LLM fine-tuning. The authors evaluated several heuristics:

  • Uncategorized Transitions (UT): All transitions are used for training.
  • State Feature Categorized (OC): An "Oracle" heuristic that labels actions as useful if they result in a reward or a change in the agent's location (e.g., moving to a new room).
  • Reward Trajectories (RT): Actions are selected based on whether they eventually lead to a positive reward.
  • Advantage-based Weighting: Using the RL agent's advantage function to weight the LLM's loss, prioritizing actions the agent found beneficial.

Experimental Setup

The models were evaluated on the Jericho Benchmark, a suite of 10 classic interactive fiction games known for sparse rewards and linguistic complexity. For initial pre-training, the authors used varying portions of the ClubFloyd dataset, which contains approximately 217,000 human-played transitions.

Results and Analysis

The experimental results demonstrate that the State Feature Categorized (OC) heuristic is the most effective, achieving a 53% relative improvement in average normalized scores over the CALM baseline. This suggests that understanding environmental progress (like room changes) is crucial for effective action recommendation.

Comparison of different data selection heuristics shows that the State Feature Categorized (OC) approach leads to the highest performance and fastest convergence.

A key finding is the framework's data efficiency. An agent using the OC method with only 10% of the human-annotated data outperformed a static model trained on 100% of the data. Furthermore, the "in-the-loop" agents reached baseline peak performance in roughly half the training steps, representing a 2x acceleration in convergence.

Ablation studies confirmed that the LLM acts best as a recommender rather than a standalone player. When the LLM's top-ranked action was used directly without the DRRN, performance dropped significantly, highlighting the LLM's lack of long-term strategic planning compared to dedicated RL modules.

Conclusion

LM-in-the-Loop significantly improves the efficiency and performance of agents in text-based games by allowing the action recommender to learn from environment-specific transitions. While the method reduces reliance on human data, challenges remain regarding the generalizability of "in-the-loop" models across different games and the computational cost of frequent transformer updates. Future work will focus on developing automated metrics for transition importance to replace oracle-based heuristics.

Summary updated

BibTeX
@misc{sudhakar2023language,
  author = {Arjun Vaithilingam Sudhakar and Prasanna Parthasarathi and Janarthanan Rajendran and Sarath Chandar},
  title = {{Language Model-In-The-Loop: Data Optimal Approach to Learn-To-Recommend Actions in Text Games}},
  year = {2023},
  eprint = {2311.07687},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.07687},
}
Figure