Introduction
Reinforcement Learning (RL) agents typically learn through trial and error, guided by reward functions. In complex environments like StarCraft II, however, rewards are notoriously "sparse." An agent might perform thousands of actions over 20 minutes only to receive a single binary reward (win or loss) at the end. This lack of intermediate feedback often results in agents taking random actions indefinitely without ever reaching a goal.
While manual "reward shaping" can provide intermediate feedback, it requires expert programmers to hard-code logic for every sub-goal. This research proposes a more intuitive alternative: Narration-Guided RL. By allowing a human to provide natural language commands like "build a supply depot," and training an agent to recognize when game states match these commands, we can provide the frequent, intuitive feedback necessary for efficient learning.
Methodology: The Mutual-Embedding Model (MEM)
The core of this approach is the Mutual-Embedding Model (MEM), designed to bridge the semantic gap between raw pixels and natural language. The architecture maps both modalities into a shared 256-dimensional representation space.
The model consists of two primary branches:
- The Language Branch: Utilizes a pre-trained
word2vecmodel to vectorize words, which are then processed by a Long Short-Term Memory (LSTM) network to capture the sequential meaning of full commands. - The State Branch: Processes multi-modal StarCraft II data, including 2D mini-maps, screen views, and non-spatial numerical data (e.g., resource counts). Convolutional Neural Networks (CNNs) handle visual inputs, while Fully Connected Layers process numerical data.
The branches converge at a "meeting point" where the model is trained using a contrastive loss function. This training "pushes" matching command-state pairs closer together in the embedding space while "pulling" mismatched pairs apart.
Dataset and Training
The study utilized the StarCraft II: BuildMarines mini-game. To train the MEM without exhaustive human play, the authors generated a dataset of 150,000 samples using a random agent and rule-based labeling. This dataset included:
- 50,000 game states across five specific commands (e.g., "build a supply depot").
- 100,000 labeled pairs for contrastive training (50% match, 50% mismatch).
- 50,000 "null" states representing random gameplay that does not correspond to any specific command.
Results and Semantic Grounding
The MEM achieved a high degree of accuracy and semantic organization. Quantitatively, the model reached a test accuracy of 80.40% in correctly matching commands to their corresponding game states.
Qualitative analysis using t-SNE projections reveals that the model naturally organizes game states into distinct, separable clusters based on the underlying goal. Crucially, the command embeddings (e.g., "train a marine unit") land in the center of their respective state clusters. This demonstrates that the model successfully "grounds" language in the high-dimensional, noisy state space of the game. Furthermore, the model's ability to distinguish "null" states from goal-oriented states is vital for preventing false-positive rewards during subsequent RL training.
Conclusion and Future Work
This research demonstrates that natural language can be successfully linked to complex RTS game states through mutual embeddings. By leveraging word2vec and LSTMs, the model exhibits semantic generalization, potentially allowing it to handle variations in human phrasing (e.g., "construct" vs. "build").
The current work focuses on the embedding model itself. The next critical step is integrating this MEM into a live RL loop to evaluate how effectively narration-guided rewards accelerate learning in the full StarCraft II environment. Future iterations may also move away from rule-based labeling toward human demonstrations or unsupervised methods for generating training pairs.
Summary updated