Abstract
Language model (LM) pre-training is useful in many language processing tasks. But can pre-trained LMs be further leveraged for more general machine learning problems? We propose an approach for using LMs to scaffold learning and generalization in general sequential decision-making problems. In this approach, goals and observations are represented as a sequence of embeddings, and a policy network initialized with a pre-trained LM predicts the next action. We demonstrate that this framework enables effective combinatorial generalization across different environments and supervisory modalities. We begin by assuming access to a set of expert demonstrations, and show that initializing policies with LMs and fine-tuning them via behavior cloning improves task completion rates by 43.6% in the VirtualHome environment. We then examine how our framework may be used in environments without pre-collected expert data. To do this, we integrate an active data gathering procedure into pre-trained LMs. The agent iteratively learns by interacting with the environment, relabeling the language goal of past 'failed' experiences, and updating the policy in a self-supervised loop. The active data gathering procedure also enables effective combinatorial generalization, outperforming the best baseline by 25.1%. Finally, we explain these results by investigating three possible factors underlying the effectiveness of the LM-based policy. We find that sequential input representations (vs. fixed-dimensional feature vectors) and favorable weight initialization are both important for generalization. Surprisingly, however, the format of the policy inputs encoding (e.g. as a natural language string vs. an arbitrary sequential encoding) has little influence. Together, these results suggest that language modeling induces representations that are useful for modeling not just language, but also goals and plans.
Introduction
In sequential decision-making tasks, such as robotics or complex virtual environments, agents frequently struggle with combinatorial generalization. This is the ability to recombine learned concepts to solve novel, unseen tasks. While standard reinforcement learning (RL) and imitation learning (IL) methods often fail to generalize beyond their training distribution, pre-trained Language Models (LMs) have demonstrated remarkable zero-shot and few-shot capabilities in natural language processing. This research explores whether the sequence-modeling inductive biases of LMs can be repurposed to solve general, non-linguistic decision-making problems.
The LID Framework
The proposed framework, LID (Language Models for Interactive Decision-Making), treats Partially Observable Markov Decision Processes (POMDPs) as sequence prediction tasks.
The architecture consists of three main components:
- Sequential Encoding: Observations, goals, and action histories are converted into a sequence of embeddings.
- LM Policy Initialization: These embeddings are processed by a pre-trained LM (specifically, GPT-2). The output tokens are pooled into a context feature, which a task-specific decoder uses to predict the next action $a_t$.
- Active Data Gathering (LID-ADG): For scenarios lacking expert data, a self-supervised loop is employed. The agent explores the environment and uses hindsight relabeling to turn "failed" trajectories into successful examples of alternative sub-goals, which are then used to update the policy.
Experimental Setup
The models were evaluated in two distinct environments:
- VirtualHome: A 3D embodied environment for household tasks. A new imitation learning dataset of 20,000 expert trajectories was generated for this study.
- BabyAI: A 2D grid-world benchmark for instruction-following, focusing on tasks like GoToRedBall and PutNextLocal.
Results and Analysis
LID demonstrates significant improvements in combinatorial generalization:
- VirtualHome Performance: LID-Text improved task completion rates on novel tasks by 43.6% compared to MLP and LSTM baselines.
- Sample Efficiency: In BabyAI, LID achieved near-perfect success rates with far fewer demonstrations than traditional baselines.
- Active Learning Success: In the absence of expert data, LID-ADG achieved a 25.5% success rate on novel tasks, whereas standard RL algorithms (PPO, DQN+HER) failed completely. Furthermore, initializing a PPO agent with a policy learned by LID-ADG boosted in-distribution success rates from 0% to 53.7%.
Why does it work?
Ablation studies revealed three key insights:
- Sequence Modeling > Natural Language: Converting inputs to natural language is not strictly necessary. Using arbitrary indices or random strings still yielded strong generalization, suggesting the LM's strength lies in its general sequence-processing capabilities.
- Pre-trained Weights are Essential: Training the same transformer architecture from scratch resulted in a significant drop in generalization, highlighting the value of the pre-trained inductive bias.
- Sequential Structure is Critical: Replacing the sequential input with a fixed-size vector caused the model's ability to generalize to collapse, underscoring the importance of the attention mechanism's ability to parse relationships over time.
Conclusion and Future Work
LID provides a powerful scaffold for interactive decision-making by leveraging the sequence-modeling prowess of pre-trained LMs. While highly effective, the current implementation of LID-ADG relies on hand-crafted relabeling rules, which may limit scalability. Future work could explore using larger LMs to mitigate grounding and policy errors in long-horizon tasks and investigate the potential transfer of biases from the LM's original training data.
Summary updated