On the Effects of Fine-tuning Language Models for Text-Based Reinforcement Learning

Maurício Gruppi, Soham Dan, Keerthiram Murugesan, Subhajit Chaudhury

Abstract

Text-based reinforcement learning involves an agent interacting with a fictional environment using observed text and admissible actions in natural language to complete a task. Previous works have shown that agents can succeed in text-based interactive environments even in the complete absence of semantic understanding or other linguistic capabilities. The success of these agents in playing such games suggests that semantic understanding may not be important for the task. This raises an important question about the benefits of LMs in guiding the agents through the game states. In this work, we show that rich semantic understanding leads to efficient training of text-based RL agents. Moreover, we describe the occurrence of semantic degeneration as a consequence of inappropriate fine-tuning of language models in text-based reinforcement learning (TBRL). Specifically, we describe the shift in the semantic representation of words in the LM, as well as how it affects the performance of the agent in tasks that are semantically similar to the training games. We believe these results may help develop better strategies to fine-tune agents in text-based RL scenarios.

Introduction

Text-based games (TBGs), such as the classic interactive fiction Zork, serve as complex environments for evaluating artificial intelligence. These games require agents to process natural language observations and select actions from a vast space of linguistic possibilities. Historically, reinforcement learning (RL) agents have often achieved success in these domains using "hash-based" methods that treat text as arbitrary symbols, effectively ignoring semantic content. This phenomenon raised a critical question: does semantic understanding provide a tangible benefit to RL agents, or is the linguistic depth of Large Language Models (LLMs) superfluous for these tasks?

This research investigates whether the standard practice of fine-tuning an LM's weights based on RL rewards is truly beneficial. The authors hypothesize that this process can lead to "semantic degeneration," a state where the model sacrifices its broad linguistic capabilities to optimize for specific high-reward text strings.

Methodology

The study employs the Deep Reinforcement Relevance Network (DRRN) architecture, which consists of a text encoder for observations and actions, a GRU-based state-action encoder, and an action scorer. The performance of four distinct text encoder types was compared:

  1. Hash Baseline: Maps text to random vectors, providing no semantic knowledge.
  2. Word Embeddings: Utilizes static GloVe embeddings.
  3. Fixed Transformers: Employs pre-trained models (Albert and RoBERTa) with frozen weights.
  4. Fine-tuned Transformers (FT): Updates the weights of pre-trained models based on RL rewards.

The agents were evaluated on two benchmarks: TextWorld Commonsense (TWC), which requires everyday knowledge for household tasks, and Jericho, a suite of complex interactive fiction games. To assess robustness, the researchers introduced text perturbations during evaluation, including BART-based paraphrasing and WordNet-based lexical substitution.

The Phenomenon of Semantic Degeneration

A primary contribution of this work is the characterization of "semantic degeneration." During fine-tuning on RL rewards, an LM may "forget" the general semantic relationships learned during pre-training. For example, if an agent consistently finds a "bloody axe" and then enters a "kitchen" to receive a reward, the fine-tuning process may force the embeddings of these unrelated terms closer together.

Conceptual illustration of semantic degeneration: fine-tuning causes unrelated game elements to cluster together in the embedding space.

As illustrated in Figure 1, the model loses the general concept of what an "axe" or a "kitchen" is, focusing instead on their co-occurrence in a specific winning trajectory. This shift in representation undermines the model's ability to generalize to new contexts.

Experimental Results

Surprisingly, the experiments revealed that agents using fixed pre-trained LMs consistently outperformed those using fine-tuned models. Fixed models provide a stable, rich semantic space that aids the RL agent in generalizing across different rooms and objects without the "moving target" problem created by shifting weights.

Performance comparison between fixed and fine-tuned models across episodes and steps.

As shown in Figure 2, agents with fixed LMs reached significantly higher scores in Zork 1 compared to fine-tuned agents, which often plateaued or declined in performance. Furthermore, fixed LMs exhibited superior robustness to text perturbations. While fine-tuned agents' performance collapsed when faced with synonyms or paraphrased descriptions, fixed LM agents maintained their performance, leveraging their preserved understanding of language. In TWC tasks, fixed RoBERTa models achieved a normalized score of 0.70 on in-distribution tasks and remained strong on out-of-distribution (OOD) tasks (0.53), whereas fine-tuned models struggled to generalize.

Discussion and Conclusion

The findings suggest that while fine-tuning is a powerful tool, its application in text-based RL requires caution. Semantic degeneration can render agents fragile and unable to generalize. Future research should focus on developing better fine-tuning strategies—such as constrained optimization or adapter-based methods—that allow agents to learn task-specific nuances while preserving foundational linguistic knowledge. Additionally, exploring these effects in larger-scale models and diverse languages will be essential for advancing the field of text-based reinforcement learning.

Summary updated

BibTeX
@inproceedings{gruppi2025effects,
  author = {Maurício Gruppi and Soham Dan and Keerthiram Murugesan and Subhajit Chaudhury},
  title = {{On the Effects of Fine-tuning Language Models for Text-Based Reinforcement Learning}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2025},
  url = {https://openreview.net/forum?id=kQBQQV8RtS},
}
Figure