Abstract
Reinforcement Learning (RL) agents in text-based environments often face the "sparse reward problem," where feedback is only provided upon task completion. This paper explores the use of sentiment analysis to extract implicit feedback from environmental text descriptions, converting linguistic cues into dense reward signals. By integrating sentiment-aware rewards, agents can learn more efficiently in complex, combinatorially large state spaces.
Introduction
In traditional Reinforcement Learning, agents learn through trial and error, guided by numerical rewards. However, in text-based games or dialogue systems, rewards are often non-existent until a long sequence of actions is successfully completed. For instance, a robot cooking a recipe might only receive a reward after the final dish is served, leaving it blind to the quality of intermediate steps like ingredient preparation.
This research addresses the sparse reward problem by treating the sentiment of environmental text as an intrinsic reward signal. While humans naturally infer progress from descriptions (e.g., "The kitchen smells wonderful"), standard RL agents typically treat such text as neutral observations.
Methodology
The proposed framework augments the standard environment reward ($r_{env}$) with a "sentiment reward" derived from the polarity of the state description: $$r_{total} = r_{env} + \text{scale} \times \text{polarity}$$
Architecture
The system consists of three primary components:
- State Representation: An LSTM encodes the text description of the current game state.
- Decision Making: This encoding is processed by a Deep-Q Network (DQN) to select the optimal action.
- Sentiment Booster: A separate sentiment analyzer processes the same text. The authors evaluated several models, including TextBlob, Naive Bayes, and BERT fine-tuned on movie reviews, game trajectories, and human "banter."
To mitigate noise, a "threshold" mechanism was implemented: sentiment rewards are only applied when the analyzer's confidence (polarity) exceeds a specific magnitude (e.g., $|polarity| > 0.7$).
Experimental Setup
The models were evaluated using TextWorld, a platform for generating text-based games focused on multi-step "cooking" quests. Training data included the Stanford Movie Review Dataset for general sentiment and ClubFloyd, a collection of transcripts from human players that provided realistic "banter" (e.g., "nice!", "yay!").
Results and Discussion
The integration of sentiment-based rewards significantly improved agent performance across multiple metrics.
The BERT-Traj model, fine-tuned specifically on game trajectories, outperformed all other variants, achieving an aggregated score of 33.0 compared to the vanilla baseline of 24.7. Furthermore, BERT-Traj reached a peak score of 5.0, whereas the vanilla agent peaked at 3.0, indicating that sentiment awareness allows agents to solve more complex tasks within the same training duration.
A strong correlation ($r_s = 0.713$) was observed between mean positive sentiment and trajectory success, confirming that linguistic sentiment serves as a reliable proxy for task progress.
Conclusion and Future Work
This research demonstrates that language can serve as a powerful heuristic for RL agents. By "reading between the lines" of environmental prose, agents can develop intrinsic motivation that bridges the gap between sparse external rewards.
Future work will focus on refining the "scale" hyperparameter to prevent "reward hacking" and exploring more advanced NLP models to provide even more nuanced dense rewards. Additionally, "human-in-the-loop" systems, where real-time human sentiment acts as a teacher, represent a promising frontier for this technology.
Summary updated