ALFW ORLD : A LIGNING T EXT AND E MBODIED E NVIRONMENTS FOR I NTERACTIVE L EARNING
ALFWorld.github.io
A BSTRACT
Given a simple request like Put a washed apple in the kitchen fridge , humans can reason in purely abstract terms by imagining action sequences and scoring their likelihood of success, prototypicality, and efﬁciency, all without moving a muscle.
Once we see the kitchen in question, we can update our abstract plans to ﬁt the scene.
Embodied agents require the same abilities, but existing work does not yet provide the infrastructure necessary for both reasoning abstractly and executing concretely.
We address this limitation by introducing ALFWorld, a simulator that enables agents to learn abstract, text-based policies in TextWorld (Côté et al., 2018) and then execute goals from the ALFRED benchmark (Shridhar et al., 2020) in a rich visual environment.
ALFWorld enables the creation of a new BUTLER agent whose abstract knowledge, learned in TextWorld, corresponds directly to concrete, visually grounded actions.
In turn, as we demonstrate empirically, this fosters better agent generalization than training only in the visually grounded environment.
BUTLER’s simple, modular design factors the problem to allow researchers to focus on models for improving every piece of the pipeline (language understanding, planning, navigation, and visual scene understanding).
I NTRODUCTION
TextWorld
Embodied
[Figure]
Consider helping a friend prepare dinner in an unfamiliar house: when your friend asks you to clean and slice an apple for an appetizer, how would you approach the task?
Intuitively, one could reason abstractly: (1) ﬁnd an apple (2) wash the apple in the sink (3) put the clean apple on the cutting board (4) ﬁnd a knife (5) use the knife to slice the apple (6) put the slices in a bowl.
Even in an unfamiliar setting, abstract reasoning can help accomplish the goal by leveraging semantic priors.
Priors like locations of objects – apples are commonly found in the kitchen along with implements for cleaning and slicing, object affordances – a sink is useful for washing an apple unlike a refrigerator, pre-conditions – better to wash an apple before slicing it, rather than the converse.
We hypothesize that, learning to solve tasks using abstract language, unconstrained by the particulars of the physical world, enables agents to complete embodied tasks in novel environments by leveraging the kinds of semantic priors that are exposed by abstraction and interaction
To test this hypothesis, we have created the novel ALFWorld framework, the ﬁrst interactive, parallel environment that aligns text descriptions and commands with physically embodied robotic simulation.
We build ALFWorld by extending two prior works: TextWorld (Côté et al., 2018) - an engine for interactive text-based games, and ALFRED (Shridhar et al., 2020) - a large scale dataset for visionlanguage instruction following in embodied environments.
ALFWorld provides two views of the same underlying world and two modes by which to interact with it: TextWorld, an abstract, text-based environment, generates textual observations of the world and responds to high-level text actions;
ALFRED, the embodied simulator, renders the world in high-dimensional images and responds to low-level physical actions as from a robot (Figure 1).
1 Unlike prior work on instruction following (MacMahon et al., 2006; Anderson et al., 2018a), which typically uses a static corpus of cross-modal expert demonstrations, we argue that aligned parallel environments like ALFWorld offer a distinct advantage: they allow agents to explore, interact , and learn in the abstract environment of language before encountering the complexities of the embodied environment.
While ﬁelds such as robotic control use simulators like MuJoCo (Todorov et al., 2012) to provide inﬁnite data through interaction, there has been no analogous mechanism – short of hiring a human around the clock – for providing linguistic feedback and annotations to an embodied agent.
TextWorld addresses this discrepancy by providing programmatic and aligned linguistic signals during agent exploration.
This facilitates the ﬁrst work, to our knowledge, in which an embodied agent learns the meaning of complex multi-step policies, expressed in language, directly through interaction.
Empowered by the ALFWorld framework, we introduce BUTLER ( B uilding U nderstanding in
T extworld via L anguage for E mbodied R easoning), an agent that ﬁrst learns to perform abstract tasks in TextWorld using Imitation Learning (IL) and then transfers the learned policies to embodied tasks in ALFRED.
When operating in the embodied world, BUTLER leverages the abstract understanding gained from TextWorld to generate text-based actions; these serve as high-level subgoals that facilitate physical action generation by a low-level controller.
Broadly, we ﬁnd that BUTLER is capable of generalizing in a zero-shot manner from TextWorld to unseen embodied tasks and settings.
Our results show that training ﬁrst in the abstract text-based environment is not only 7 × faster, but also yields better performance than training from scratch in the embodied world.
These results lend credibility to the hypothesis that solving abstract language-based tasks can help build priors that enable agents to generalize to unfamiliar embodied environments.
Our contributions are as follows:
§ 2 ALFWorld environment :
The ﬁrst parallel interactive text-based and embodied environment.
§ 3 BUTLER architecture :
An agent that learns high-level policies in language that transfer to low-level embodied executions, and whose modular components can be independently upgraded.
§ 4 Generalization : We demonstrate empirically that BUTLER, trained in the abstract text domain, generalizes better to unseen embodied settings than agents trained from corpora of demonstrations or from scratch in the embodied world.
A LIGNING ALFRED AND T EXT W ORLD
[Table]
The ALFRED dataset (Shridhar et al., 2020), set in the THOR simulator (Kolve et al., 2017), is a benchmark for learning to complete embodied household tasks using natural language instructions and egocentric visual observations.
As shown in Figure(right), ALFRED tasks pose challenging interaction and navigation problems to an agent in a high-ﬁdelity simulated environment.
Tasks are annotated with a goal description that describes the objective (e.g., “put a pan on the dining table”).
We consider both template-based and human-annotated goals; further details on goal speciﬁcation can be found in Appendix H. Agents observe the world through high-dimensional pixel images and interact using low-level action primitives:
[Table]
The ALFRED dataset also includes crowdsourced language instructions like “turn around and walk over to the microwave” that explain how to complete a goal in a step-by-step manner.
We depart from the ALFRED challenge by omitting these step-by-step instructions and focusing on the more diffcult problem of using only on goal descriptions specifying what needs to be achieved.
Our aligned ALFWorld framework adopts six ALFRED task-types (Table 1) of various difﬁculty levels.
2 Tasks involve ﬁrst ﬁnding a particular object , which often requires the agent to open and search receptacles like drawers or cabinets.
Subsequently, all tasks other than Pick & Place require some interaction with the object such as heating (place object in microwave and start it) or cleaning (wash object in a sink).
To complete the task, the object must be placed in the designated location.
Within each task category there is signiﬁcant variation: the embodied environment includesrooms (30 kitchens, 30 bedrooms, 30 bathrooms, 30 living rooms), each dynamically populated with a set of portable objects (e.g., apple, mug), and static receptacles (e.g., microwave, fridge).
For each task type we construct a larger train set, as well as seen and unseen validation evaluation sets: (1)
: seen consists of known task instances
task
type
object
, receptacle , room } in rooms seen during training, but with different instantiations of object locations, quantities, and visual appearances (e.g. two blue pencils on a shelf instead of three red pencils in a drawer seen in training).
unseen consists of new task instances with
possibly known
object
receptacle
pairs, but always in unseen rooms with different receptacles and scene layouts than in training tasks.
The seen set is designed to measure in-distribution generalization, whereas the unseen set measures out-of-distribution generalization.
The scenes in ALFRED are visually diverse, so even the same task instance can lead to very distinct tasks, e.g., involving differently colored apples, shaped statues, or textured cabinets.
For this reason, purely vision-based agents such as the unimodal baselines in
Section 5.2 often struggle to generalize to unseen environments and objects.
The TextWorld framework (Côté et al., 2018) procedurally generates text-based environments for training and evaluating language-based agents.
In order to extend TextWorld to create text-based analogs of each ALFRED scene, we adopt a common latent structure representing the state of the simulated world.
ALFWorld uses PDDL - Planning Domain Deﬁnition Language (McDermott et al., 1998) to describe each scene from ALFRED and to construct an equivalent text game using the
TextWorld engine.
The dynamics of each game are deﬁned by the PDDL domain (see Appendix C for additional details).
Textual observations shown in Figure 1 are generated with templates sampled from a context-sensitive grammar designed for the ALFRED environments.
For interaction, TextWorld environments use the following high-level actions: goto {recep} take {obj} from {recep} put {obj} in/on {recep} open {recep} close {recep} toggle {obj}{recep} clean {obj} with {recep} heat {obj} with {recep} cool {obj} with {recep} where {obj} and {recep} correspond to objects and receptacles.
Note that heat , cool , clean , and goto are high-level actions that correspond to several low-level embodied actions.
ALFWorld , in summary, is an cross-modal framework featuring a diversity of embodied tasks with analogous text-based counterparts.
Since both components are fully interactive, agents may be trained in either the language or embodied world and evaluated on heldout test tasks in either modality.
We believe the equivalence between objects and interactions across modalities make ALFWorld an ideal framework for studying language grounding and cross-modal learning.
I NTRODUCING BUTLER: A N E MBODIED M ULTI - TASK A GENT
We investigate learning in the abstract language modality before generalizing to the embodied setting.
The BUTLER agent uses three components to span the language and embodied modalities:
BUTLER::B RAIN – the abstract text agent, BUTLER::V ISION – the language state estimator, and
BUTLER::B
ODY – the low-level controller.
An overview of BUTLER is shown in Figure 2 and each component is described below
[Figure]
BUTLER
[Figure]
(Sharma et al., 2017) and summarization (Gehrmann et al., 2018).
An overview of the agent’s architecture is shown in Figure 3.
At game step t , the encoder takes the initial text observation o 0 , current observation o t , and the goal description g as input and generates a contextaware representation of the current observable game state.
The observation o 0 explicitly lists all the navigable receptacles in the scene, and goal g is sampled from a set of language templates (see
Appendix H).
Since the games are partially observable, the agent only has access to the observation describing the effects of its previous action and its present location.
Therefore, we incorporate two memory mechanisms to imbue the agent with history: (1) a recurrent aggregator, adapted from Yuan et al.
(2018), combines the encoded state with recurrent state h t − 1 from the previous game step; (2) an observation queue feeds in the k most recent, unique textual observations.
The decoder generates an action sentence a t token-by-token to interact with the game.
The encoder and decoder are based on a
Transformer Seq2Seq model with pointer softmax mechanism (Gulcehre et al., 2016).
We leverage pre-trained BERT embeddings (Sanh et al., 2019), and tie output embeddings with input embeddings (Press and Wolf, 2016).
The agent is trained in an imitation learning setting with DAgger (Ross et al., 2011) using expert demonstrations.
See Appendix A for complete details.
When solving a task, an agent might get stuck at certain states due to various failures (e.g., action is grammatically incorrect, wrong object name).
The observation for a failed action does not contain any useful feedback, so a fully deterministic actor tends to repeatedly produce the same incorrect action.
To address this problem, during evaluation in both TextWorld and ALFRED, BUTLER::B RAIN uses
Beam Search (Reddy et al., 1977) to generate alternative action sentences in the event of a failed action.
But otherwise greedily picks a sequence of best words for efﬁciency.
Note that Beam Search is not used to optimize over embodied interactions like prior work (Wang et al., 2019).
but rather to simply improve the generated action sentence during failures.
3. BUTLER::V ISION (S TATE E STIMATOR ) ∶ v t → o t
At test time, agents in the embodied world must operate purely from visual input.
To this end,
BUTLER::V ISION ’s language state estimator functions as a captioning module that translates visual observations v t into textual descriptions o t .
Speciﬁcally, we use a pre-trained Mask R-CNN detec- tor
(He et al., 2017) to identify objects in the visual frame.
The detector is trained separately in a supervised setting with random frames from ALFRED training scenes (see Appendix D).
For each frame v t , the detector generates N detections {( c 1 , m 1 ) , ( c 2 , m 2 ) , . . .
, ( c N , m N )} , where c n is the predicted object class, and m n is a pixel-wise object mask.
These detections are formatted into a sentence using a template e.g., On table 1, you see a mug 1, a tomato 1, and a tomato 2 .
To handle multiple instances of objects, each object is associated with a class c n and a number ID e.g., tomato 1 .
Commands goto , open , and examine generate a list of detections, whereas all other commands generate afﬁrmative responses if the action succeeds e.g., a t : put mug 1 on desk 2 → o t + 1 : You put mug 1 on desk 2 , otherwise produce Nothing happens to indicate failures or no state-change.
See Appendix G for a full list of templates.
While this work presents preliminary results with template-based descriptions, future work could generate more descriptive observations using pre-trained image-captioning models (Johnson et al., 2016), video-action captioning frameworks (Sun et al., 2019), or scene-graph parsers (Tang et al., 2020).
[Equation]
The controller translates a high-level text action a t into a sequence of L low-level physical actions { ˆ a 1 , ˆ a 2 , . .
, ˆ a L } that are executable in the embodied environment.
The controller handles two types of commands: manipulation and navigation.
For manipulation actions, we use the ALFRED API to interact with the simulator by providing an API action and a pixel-wise mask based on Mask R-CNN detections m n that was produced during state-estimation.
For navigation commands, each episode is initialized with a pre-built grid-map of the scene, where each receptacle instance is associated with a receptacle class and an interaction viewpoint ( x, y, θ, φ ) with x and y representing the 2D position, θ and φ representing the agent’s yaw rotation and camera tilt.
The goto command invokes an A* planner to ﬁnd the shortest path between two viewpoints.
The planner outputs a sequence of L displacements in terms of motion primitives: M OVE A HEAD , R OTATE R IGHT , R OTATE L EFT , L OOK U P , and L OOK D OWN , which are executed in an open-loop fashion via the ALFRED API.
We note that a given pre-built grid-map of receptacle locations is a strong prior assumption, but future work could incorporate existing models from the vision-language navigation literature (Anderson et al., 2018a;
Wang et al., 2019) for map-free navigation.
E XPERIMENTS
We design experiments to answer the following questions: (1) How important is an interactive language environment versus a static corpus?
(2) Do policies learnt in TextWorld transfer to embodied environments?
(3) Can policies generalize to human-annotated goals?
(4) Does pre-training in an abstract textual environment enable better generalization in the embodied world?
4. I MPORTANCE OF I NTERACTIVE L ANGUAGE
The ﬁrst question addresses our core hypothesis that training agents in interactive TextWorld environments leads to better generalization than training agents with a static linguistic corpus.
To test this hypothesis, we use DAgger (Ross et al., 2011) to train the BUTLER::B RAIN agent in TextWorld and compare it against Seq2Seq , an identical agent trained with Behavior Cloning from an equivalentlysized corpus of expert demonstrations.
The demonstrations come from the same expert policies and we control the number of episodes to ensure a fair comparison.
Table 2 presents results for agents trained in TextWorld and subsequently evaluated in embodied environments in a zero-shot manner.
The agents are trained independently on individual tasks and also jointly on all six task types.
For each task category, we select the agent with best evaluation performance in TextWorld (from 8 random seeds); this is done separately for each split: seen and unseen.
These best-performing agents are then evaluated on the heldout seen and unseen embodied ALFRED tasks.
For embodied evaluations, we also report goal-condition success rates, a metric proposed in ALFRED (Shridhar et al., 2020) to measure partial goal completion.
[Table]
in parentheses.
The
Seq2Seq
baseline is trained in TextWorld from pre-recorded expert demonstrations
using
standard
supervised
learning
BUTLER
is our main model using the Mask R-CNN detector and A
navigator.
BUTLER-O RACLE uses an oracle state-estimator with ground-truth object detections and an oracle controller that directly teleports between locations
Comparing BUTLER to Seq2Seq , we see improved performance on all types of seen tasks and ﬁve of the seven types of unseen tasks, supporting the hypothesis that interactive TextWorld training is a key component in generalizing to unseen embodied tasks.
Interactive language not only allows agents to explore and build an understanding of successful action patterns, but also to recover from mistakes.
Through trial-and-error the BUTLER agent learns task-guided heuristics, e.g., searching all the drawers in kitchen to look for a knife.
As Table 2 shows, these heuristics are subsequently more capable of generalizing to the embodied world.
More details on TextWorld training and generalization performance can be found in Section 5.1.
4. T RANSFERRING TO E MBODIED T ASKS
Since TextWorld is an abstraction of the embodied world, transferring between modalities involves overcoming domain gaps that are present in the real world but not in TextWorld.
For example, the physical size of objects and receptacles must be respected – while TextWorld will allow certain objects to be placed inside any receptacle, in the embodied world it might be impossible to put a larger object into a small receptacle (e.g. a large pot into a microwave).
Subsequently, a TextWorld-trained agent’s ability to solve embodied tasks is hindered by these domain gaps.
So to study the transferability of the text agent in isolation, we introduce BUTLER-O RACLE in Table 2, an oracle variant of BUTLER which uses perfect state-estimation, object-detection, and navigation.
Despite these advantages, we nevertheless observe a notable drop in performance from
TextWorld to BUTLER-O RACLE .
This performance gap results from the domain gaps described above as well as misdetections from Mask R-CNN and navigation failures caused by collisions.
Future work might address this issue by reducing the domain gap between the two environments, or performing additional ﬁne-tuning in the embodied setting.
The supplementary video contains qualitative examples of the BUTLER agent solving tasks in unseen environments.
It showcases 3 successes and 1 failure of a TextWorld-only agent trained on All Tasks.
In “put a watch in the safe”, the agent has never seen the ‘watch’-‘safe’ combination as a goal.
4. G ENERALIZING TO H UMAN -A NNOTATED G OALS
BUTLER is trained with templated language, but in realistic scenarios, goals are often posed with open-ended natural language.
In Table 2, we present Human Goals results of BUTLER evaluated on human-annotated ALFRED goals, which contain 66 unseen verbs (e.g., ‘wash’, ‘grab’, ‘chill’) and 189 unseen nouns (e.g., ‘rag’, ‘lotion’, ‘disc’; see Appendix H for full list).
Surprisingly, we ﬁnd non-trivial goal-completion rate indicating that certain categories of task, such as pick and place, are quite generalizable to human language.
While these preliminary results with natural language are encouraging, we expect future work could augment the templated language with synthetic-to-real transfer methods (Marzoev et al., 2020) for better generalization.
4. T O P RETRAIN OR NOT TO P RETRAIN IN T EXT W ORLD ?
[Table]
Given the domain gap between TextWorld and the embodied world, Why not eliminate this gap by training from scratch in the embodied world?
To answer this question, we investigate three training strategies: (i)
E MBODIED -O
NLY : pure embodied training, (ii) TW-O NLY : pure TextWorld training followed by zero-shot embodied transfer and (iii) H YBRID training that switches between the two environments with 75% probability for TextWorld and 25% for embodied world.
Table 3 presents success rates for these agents trained and evaluated on All Tasks.
All evaluations were conducted with an oracle state-estimator and controller.
For a fair comparison, each agent is trained for 50K episodes and the training speed is recorded for each strategy.
We report peak performance for each split.
Results indicate that TW-O NLY generalizes better to unseen environments while E MBODIED -O
NLY quickly overﬁts to seen environments (even with a perfect object detector and teleport navigator).
We hypothesize that the abstract TextWorld environment allows the agent to focus on quickly learning tasks without having to deal execution-failures and expert-failures caused by physical constraints inherent to embodied environments.
TextWorld training is also 7 × faster 4 since it does not require running a rendering or physics engine like in the embodied setting.
See Section F for more quantitative evaluations on the beneﬁts of training in TextWorld.
A BLATIONS
We conduct ablation studies to further investigate: (1) The generalization performance of BUTLER::B RAIN within TextWorld environments, (2) The ability of unimodal agents to learn directly through visual observations or action history, (3)
The importance of various hyper-parameters and modeling choices for the performance of BUTLER::B RAIN .
5. G ENERALIZATION WITHIN T EXT W ORLD
We train and evaluate BUTLER::B RAIN in abstract TextWorld environments spanning the six tasks in
Table 1, as well as All Tasks.
Similar to the zero-shot results presented in Section 4.1, the All Tasks setting shows the extent to which a single policy can learn and generalize on the large set of 3, different tasks, but here without having to deal with failures from embodied execution.
We ﬁrst experimented with training BUTLER::B RAIN through reinforcement learning (RL) where the agent is rewarded after completing a goal.
Due to the infesibility of using candidate commands or command templates as discussed in Section I, the RL agent had to generate actions token-by-token.
Since the probability of randomly stumbling upon a grammatically correct and contextually valid action is very low ( 7 . 02e - 44 for sequence length 10), the RL agent struggled to make any meaningful progress towards the tasks.
After concluding that current reinforcement learning approaches were not successful on our set of training tasks, we turned to DAgger (Ross et al., 2011) assisted by a rule-based expert (detailed in
Appendix E).
BUTLER::B RAIN is trained for 100K episodes using data collected by interacting with the set of training games.
Results in Table 4 show (i) Training success rate varies from 16-60% depending on the category of tasks, illustrating the challenge of solving hundreds to thousands of training tasks within each category.
(ii) Transferring from training to heldout test games typically reduces performance, with the unseen rooms leading to the largest performance drops.
Notable exceptions include heat and cool tasks where unseen performance exceeds training performance.
(iii) Beam search is a key contributor to test performance; its ablation causes a performance drop of 21% on the seen split of All Tasks.
(iv)
Further ablating the DAgger strategy and directly training a Sequence-to-Sequence (Seq2Seq) model
[Table]
5. U NIMODAL B ASELINES
[Table]
to BUTLER.
For all baselines, the action space and controller are ﬁxed, but the state space is substituted with different modalities.
To study the agents’ capability of learning a single policy that generalizes across various tasks, we train and evaluate on All Tasks.
In V ISION (R ESNET 18), the textual observation from the state-estimator is replaced with ResNet-18 fc7 features (He et al., 2016) from the visual frame.
Similarly, V ISION (MCNN-FPN) uses the pre-trained Mask R-CNN from the state-estimator to extract FPN layer features for the whole image.
A CTION - ONLY acts without any visual or textual feedback.
We report peak performance for each split.
The visual models tend to overﬁt to seen environments and generalize poorly to unfamiliar environments.
Operating in text-space allows better transfer of policies without needing to learn state representations that are robust to visually diverse environments.
The zero-performing A CTION - ONLY baseline indicates that memorizing action sequences is an infeasible strategy for agents.
5. M ODEL A BLATIONS
[Figure]
Figure 4 illustrates more factors that affect the performance of BUTLER::B RAIN .
The three rows of plots show training curves, evaluation curves in seen and unseen settings, respectively.
All experiments were trained and evaluated on All Tasks withrandom seeds.
In the ﬁrst column, we show the effect of using different observation queue lengths k as described in Section 3.1, in which size 0 refers to not providing any observation information to the agent.
In the second column, we examine the effect of explicitly keeping the initial observation o 0 , which lists all the receptacles in the scene.
Keeping the initial observation o 0 facilitates the decoder to generate receptacle words more accurately for unseen tasks, but may be unnecessary in seen environments.
The third column suggests that the recurrent component in our aggregator is helpful in making history-based decisions particularly in seen environments where keeping track of object locations is useful.
Finally, in the fourth column, we see that using more training games can lead to better generalizability in both seen and unseen settings.
Fewer training games achieve high training scores by quickly overﬁtting, which lead to zero evaluation scores.
R ELATED W ORK
The longstanding goal of grounding language learning in embodied settings (Bisk et al., 2020) has lead to substantial work on interactive environments.
ALFWorld extends that work with fully-interactive aligned environments that parallel textual interactions with photo-realistic renderings and physical interactions.
Interactive Text-Only Environments : We build on the work of text-based environments like
TextWorld (Côté et al., 2018) and Jericho (Hausknecht et al., 2020).
While these environment allow for textual interactions, they are not grounded in visual or physical modalities.
Vision and language : While substantial work exists on vision-language representation learning e.g., MAttNet (Yu et al., 2018b), CMN (Hu et al., 2017), VQA (Antol et al., 2015), CLEVR (Johnson et al., 2017), ViLBERT (Lu et al., 2019), they lack embodied or sequential decision making.
Embodied Language Learning : To address language learning in embodied domains, a number of interactive environments have been proposed: BabyAI (Chevalier-Boisvert et al., 2019), Room2Room (Anderson et al., 2018b), ALFRED (Shridhar et al., 2020), InteractiveQA (Gordon et al., 2018),
EmbodiedQA (Das et al., 2018), and NetHack (Küttler et al., 2020).
These environments use language to communicate instructions, goals, or queries to the agent, but not as a fully-interactive textual modality.
Language for State and Action Representation : Others have used language for more than just goal-speciﬁcation.
Schwartz et al.
(2019) use language as an intermediate state to learn policies in VizDoom.
Similarly, Narasimhan et al.
(2018) and Zhong et al.
(2020) use language as an intermediate representation to transfer policies across different environments.
Hu et al.
(2019) use a natural language instructor to command a low-level executor, and Jiang et al.
(2019) use language as an abstraction for hierarchical RL.
However these works do not feature an interactive text environment for pre-training the agent in an abstract textual space.
Zhu et al.
(2017) use high-level commands similar to ALFWorld to solve tasks in THOR with IL and RL-ﬁnetuning methods, but the policy only generalizes to a small set of tasks due to the vision-based state representation.
Using symbolic representations for state and action is also an inherent characteristic of works in task-and-motionplanning (Kaelbling and Lozano-Pérez, 2011; Konidaris et al., 2018) and symbolic planning (Asai and Fukunaga, 2017).
World Models : The concept of using TextWorld as a “game engine” to represent the world is broadly related to inverse graphics (Kulkarni et al., 2015) and inverse dynamics (Wu et al., 2017) where abstract visual or physical models are used for reasoning and future predictions.
Similarly, some results in cognitive science suggest that humans use language as a cheaper alternative to sensorimotor simulation (Banks et al., 2020; Dove, 2014).
C ONCLUSION
We introduced ALFWorld, the ﬁrst interactive text environment with aligned embodied worlds.
ALFWorld allows agents to explore, interact, and learn abstract polices in a textual environment.
Pre-training our novel BUTLER agent in TextWorld, we show zero-shot generalization to embodied tasks in the ALFRED dataset.
The results indicate that reasoning in textual space allows for better generalization to unseen tasks and also faster training, compared to other modalities like vision.
BUTLER is designed with modular components which can be upgraded in future work.
Examples include the template-based state-estimator and the A* navigator which could be replaced with learned modules, enabling end-to-end training of the full pipeline.
Another avenue of future work is to learn “textual dynamics models” through environment interactions, akin to vision-based world models (Ha and Schmidhuber, 2018).
Such models would facilitate construction of text-engines for new domains, without requiring access to symbolic state descriptions like PDDL.
Overall, we are excited by the challenges posed by aligned text and embodied environments for better cross-modal learning.
A CKNOWLEDGMENTS
The authors thank Cheng Zhang, Jesse Thomason, Karthik Desingh, Rishabh Joshi, Romain Laroche,
Shunyu Yao, and Victor Zhong for insightful feedback and discussions.
This work was done during
Mohit Shridhar’s internship at Microsoft Research
A D ETAILS OF BUTLER::B RAIN
In this section, we use o t to denote text observation at game step t , g to denote the goal description provided by a game.
We use L to refer to a linear transformation and L f means it is followed by a non-linear activation function f . Brackets [ ⋅ ; ⋅ ] denote vector concatenation, ⊙ denotes element-wise multiplication.
A. O BSERVATION Q UEUE
As mentioned in Section 3.1, we utilize an observation queue to cache the text observations that have been seen recently.
Since the initial observation o 0 describes the high level layout of a room, including receptacles present in the current game, we it visible to BUTLER::B RAIN at all game steps, regardless of the length of the observation queue.
Speciﬁcally, the observation queue has an extra space storing o 0 , at any game step, we ﬁrst concatenate all cached observations in the queue, then prepend the o 0 to form the input to the encoder.
We ﬁnd this helpful because it facilitates the pointer softmax mechanism in the decoder (described below) by guiding it to point to receptacle words in the observation.
An ablation study on this is provided in Section 5.
A. E NCODER
We use a transformer-based encoder, which consists of an embedding layer and a transformer block (Vaswani et al., 2017).
Speciﬁcally, embeddings are initialized by pre-trained 768-dimensional BERT embeddings (Sanh et al., 2019).
The embeddings are ﬁxed during training in all settings.
The transformer block consists of a stack of 5 convolutional layers, a self-attention layer, and a 2-layer
MLP with a ReLU non-linear activation function in between.
In the block, each convolutional layer has 64 ﬁlters, each kernel’s size is 5.
In the self-attention layer, we use a block hidden size H of 64, as well as a single head attention mechanism.
Layernorm (Ba et al., 2016) is applied after each component inside the block.
Following standard transformer training, we add positional encodings into each block’s input.
At every game step t , we use the same encoder to process text observation o t and goal description g .
The resulting representations are h o t ∈ R L ot × H and h g ∈ R L g × H , where L o t is the number of tokens in o t , L g denotes the number of tokens in g , H = 64 is the hidden size.
A. A GGREGATOR
We adopt the context-query attention mechanism from the question answering literature (Yu et al., 2018a) to aggregate the two representations h o t and h g .
Speciﬁcally, a tri-linear similarity function is used to compute the similarity between each token in h o t with each token in h g .
The similarity between i -th token in h o and j -th token in h g is thus computed by (omitting game step t for simplicity):
[Equation]
where W is a trainable parameter in the tri-linear function.
By applying the above computation for each h
o
and h g pair, we get a similarity matrix S ∈ R L o × L g .
By computing the softmax of the similarity matrix S along both dimensions (number of tokens in goal description L g and number of tokens in observation L o ), we get S g and S o , respectively.
The two representations are then aggregated by:
[Equation]
where h og ∈ R L o × 4 H is the aggregated observation representation.
Next, a linear transformation projects the aggregated representations to a space with size H = 64 :
[Equation]
To incorporate history, we use a recurrent neural network.
Speciﬁcally, we use a GRU (Cho et al., 2014):
[Equation]
in which, the mean pooling is performed along the dimension of number of tokens, i.e., h RNN ∈ R H .
h t − 1 is the output of the GRU cell at game step t − 1 .
A. D ECODER
Our decoder consists of an embedding layer, a transformer block and a pointer softmax mechanism (Gulcehre et al., 2016).
We ﬁrst obtain the source representation by concatenating h og and h t , resulting h src ∈ R L o × 2 H .
Similar to the encoder, the embedding layer is frozen after initializing it with pre-trained BERT embeddings.
The transformer block consists of two attention layers and a 3-layer MLP with ReLU non-linear activation functions inbetween.
The ﬁrst attention layer computes the self attention of the input embeddings h self as a contextual encoding for the target tokens.
The second attention layer then computes the attention α i src ∈ R L o between the source representation h src and the i -th token in h self .
The i -th target token is consequently represented by the weighted sum of h src , with the weights
α i src .
This generates a source information-aware target representation h ′ tgt ∈ R L tgt × H , where L tgt denotes the number of tokens in the target sequence.
Next, h ′ tgt is fed into the 3-layer MLP with ReLU activation functions inbetween, resulting h tgt ∈ R L tgt × H .
The block hidden size of this transformer is
H = 64 .
Taking h tgt as input, a linear layer with tanh activation projects the target representation into the same space as the embeddings (with dimensionality of 768), then the pre-trained embedding matrix E generates output logits (Press and Wolf, 2016), where the output size is same as the vocabulary size.
The resulting logits are then normalized by a softmax to generate a probability distribution over all tokens in vocabulary:
[Equation]
in which, p a ( y i ) is the generation (abstractive) probability distribution.
We employ the pointer softmax (Gulcehre et al., 2016) mechanism to switch between generating a token y i (from a vocabulary) and pointing (to a token in the source text).
Speciﬁcally, the pointer softmax module computes a scalar switch s i at each generation time-step i and uses it to interpolate the abstractive distribution p a ( y i ) over the vocabulary (Equation 5) and the extractive distribution p x ( y i ) =
α i src over the source text tokens:
[Equation]
where s i is conditioned on both the attention-weighted source representation ∑ j α i,j src ⋅ h j src and the decoder state h
i tgt :
[Equation]
In which, L 1 ∈ R H × 1 , L 2 ∈ R 2 H × H and L 3 ∈ R H
× H are linear layers, H = 64 .
B T RAINING AND I MPLEMENTATION D ETAILS
In this section, we provide hyperparameters and other implementation details.
For all experiments, we use Adam (Kingma and Ba, 2014) as the optimizer.
The learning rate is set to 0.001 with a clip gradient norm of 5.
During training with DAgger, we use a batch size of 10 to collect transitions (tuples of { o 0 , o t , g, ˆ a t } ) at each game step t , where ˆ a t is the ground-truth action provided by the rule-based expert (see Section E).
We gather a sequence of transitions from each game episode, and push each sequence into a replay buffer, which has a capacity of 500K episodes.
We set the max number of steps per episode to be 50.
If the agent uses up this budget, the game episode is forced to terminate.
We linearly anneal the fraction of the expert’s assistance from 100% to 1% across a window of 50K episodes.
The agent is updated after every 5 steps of data collection.
We sample a batch of 64 data points from the replay buffer.
In the setting with the recurrent aggregator, every sampled data point is a sequence of 4 consecutive transitions.
Following the training strategy used in the recurrent DQN literature (Hausknecht and Stone, 2015; Yuan et al., 2018), we use the ﬁrst 2 transitions to estimate the recurrent states, and the last 2 transitions for updating the model parameters.
BUTLER::B RAIN learns to generate actions token-by-token, where we set the max token length to be 20.
The decoder stops generation either when it generates a special end-of-sentence token [EOS] , or hits the token length limit.
When using the beam search heuristic to recover from failed actions, we use a beam width of 10, and take the top-5 ranked outputs as candidates.
We iterate through the candidates in the rank order until one of them succeeds.
This heuristic is not always guaranteed to succeed, however, we ﬁnd it helpful in most cases.
Note that we do not employ beam search when we evaluate during the training process due to speed restrictions, e.g., in the seen and unseen curves shown in Figure 4.
We take the best performing checkpoints and then apply this heuristic during evaluation and report the resulting scores in tables (e.g., Table 2).
By default unless mentioned otherwise (ablations), we use all available training games in each of the task types.
We use an observation queue length of 5 and use a recurrent aggregator.
The model is trained with DAgger, and during evaluation, we apply the beam search heuristic to produce the reported scores.
All experiment settings in TextWorld are run with 8 random seeds.
All text agents are trained for 50,000 episodes.
C T EXT W ORLD E NGINE
Internally, the TextWorld Engine is divided into two main components: a planner and text generator.
Planner TextWorld Engine uses Fast Downward (Helmert, 2006), a domain-independent classical planning system to maintain and update the current state of the game.
A state is represented by a set of predicates which deﬁne the relations between the entities (objects, player, room, etc.)
present in the game.
A state can be modiﬁed by applying production rules corresponding to the actions listed in
Table 6.
All variables, predicates, and rules are deﬁned using the PDDL language.
For instance, here is a simple state representing a player standing next to a microwave which is closed and contains a mug:
[Equation]
where the symbol ⊗ is the linear logic multiplicative conjunction operator.
Given that state, a valid action could be open microwave , which would essentially transform the state by replacing closed ( microwave ) with open ( microwave ) .
Text generator The other component of the TextWorld Engine, the text generator, uses a contextsensitive grammar designed for the ALFRED environments.
The grammar consists of text templates similar to those listed in Table 6.
When needed, the engine will sample a template given some context, i.e., the current state and the last action.
Then, the template gets realized using the predicates found in the current state.
D M ASK R-CNN D ETECTOR
We use a Mask R-CNN detector (He et al., 2017) pre-trained on MSCOCO (Lin et al., 2014) and ﬁne-tune it with additional labels from ALFRED training scenes.
To generate additional labels, we replay the expert demonstrations from ALFRED and record ground-truth image and instance segmentation pairs from the simulator (THOR) after completing each high-level action e.g., goto, pickup etc.
We generate a dataset of 50K images, and ﬁne-tune the detector for 4 epochs with a batch size of 8 and a learning rate of 5 e - 4 .
The detector recognizes 73 object classes where each class could vary up to 1-10 instances.
Since demonstrations in the kitchen are often longer as they involve complex sequences like heating, cleaning etc., the labels are slightly skewed towards kitchen objects.
To counter this, we balance the number of images sampled from each room (kitchen, bedroom, livingroom, bathroom)
so the distribution of object categories is uniform across the dataset.
E R ULE - BASED E XPERT
To train text agents in an imitation learning (IL) setting, we use a rule-based expert for supervision.
A given task is decomposed into sequence of subgoals (e.g., for heat & place: ﬁnd the object, pick the object, ﬁnd the microwave, heat the object with the microwave, ﬁnd the receptacle, place the object in the receptacle), and a closed-loop controller tries to sequentially execute these goals.
We note that while designing rule-based experts for ALFWorld is relatively straightforward, experts operating directly in embodied settings like the PDDL planner used in ALFRED are prone to failures due to physical infeasibilities and non-deterministic behavior in physics-based environments.
F B ENEFITS OF T RAINING IN T EXT W ORLD OVER E MBODIED W ORLD
Pre-training in TextWorld offers several beneﬁts over directly training in embodied environments.
Figure 5 presents the performance of an expert (that agents are trained to imitate) across various environments.
The abstract textual space leads to higher goal success rates resulting from successful navigation and manipulation subroutines.
TextWorld agents also do not suffer from object misdetections and slow execution speed.
G O BSERVATION T EMPLATES
The following templates are used by the state-estimator to generate textual observations o t .
The object IDs {obj id} correspond to Mask R-CNN objects detection or ground-truth instance IDs.
The receptacle IDs {recep id} are based on the receptacles listed in the initial observation o 0 .
Failed actions and actions without any state-changes result in Nothing happens .
Actions Templates
goto
a
arrive at
loc id} .
see
obj
The
The
On it, you see a {obj1 id} , ... and a {objN id} .
take
You pick up the {obj id} from the {recep id} .
put
You put the {obj id} on the {recep id} .
open
In it, you see a {obj1 id} , ... and a {objN id} .
The close
You close the {recep id} .
toggle
You turn the {obj id} on.
heat
You heat the {obj id} with the {recep id} .
cool
You cool the {obj id} with the {recep id} .
clean
You clean the {obj id} with the {recep id} .
inventory
(a) You are carrying: {obj id} .
(b) You are not carrying anything
examine
[Table]
a) On the {recep id} , you see a {obj1 id} , ... and a {objN id} .
(b) This is a hot/cold/clean {obj} .
ALFWorld along with their observation templates.
H G OAL D ESCRIPTIONS H. T EMPLATED G OALS
The goal instructions for training games are generated with following templates.
Here obj , recep , lamp refer to object, receptacle, and lamp classes, respectively, that pertain to a particular task.
For each task, the two corresponding templates are sampled with equal probability.
[Table]
with the
[Table] [Table]
H. H UMAN A NNOTATED G OALS
The human goal descriptions used during evaluation contain 66 unseen verbs and 189 unseen nouns with respect to the templated goal instructions used during training.
Unseen Verbs: acquire, arrange, can, carry, chill, choose, cleaning, clear, cook, cooked, cooled, dispose, done, drop, end, ﬁll, ﬁlled, frying, garbage, gather, go, grab, handled, heated, heating, hold, holding, inspect, knock, left, lit, lock, microwave, microwaved, move, moving, pick, picking, place, placed, placing, putting, read, relocate, remove, retrieve, return, rinse, serve, set, soak, stand, standing, store, take, taken, throw, transfer, turn, turning, use, using, walk, warm, wash, washed.
Unseen Nouns: alarm, area, back, baisin, bar, bars, base, basin, bathroom, beat, bed, bedroom, bedside, bench, bin, books, bottle, bottles, bottom, box, boxes, bureau, burner, butter, can, canteen, card, cardboard, cards, cars, cds, cell, chair, chcair, chest, chill, cistern, cleaning, clock, clocks, coffee, container, containers, control, controllers, controls, cooker, corner, couch, count, counter, cover, cream, credit, cupboard, dining, disc, discs, dishwasher, disks, dispenser, door, drawers, dresser, edge, end, ﬂoor, food, foot, freezer, game, garbage, gas, glass, glasses, gold, grey, hand, head, holder, ice, inside, island, item, items, jars, keys, kitchen, knifes, knives, laddle, lamp, lap, left, lid, light, loaf, location, lotion, machine, magazine, maker, math, metal, microwaves, move, nail, newsletters, newspapers, night, nightstand, object, ottoman, oven, pans, paper, papers, pepper, phone, piece, pieces, pillows, place, polish, pot, pullout, pump, rack, rag, recycling, refrigerator, remote, remotes, right, rinse, roll, rolls, room, safe, salt, scoop, seat, sets, shaker, shakers, shelves, side, sink, sinks, skillet, soap, soaps, sofa, space, spatulas, sponge, spoon, spot, spout, spray, stand, stool, stove, supplies, table, tale, tank, television, textbooks, time, tissue, tissues, toaster, top, towel, trash, tray, tv, vanity, vases, vault, vegetable, wall, wash, washcloth, watches, water, window, wine.
I A CTION C ANDIDATES VS A CTION G ENERATION
BUTLER::B RAIN generates actions in a token-by-token fashion.
Prior text-based agents typically use a list of candidate commands from the game engine (Adhikari et al., 2020) or populate a list of command templates (Ammanabrolu and Hausknecht, 2020).
We initially trained our agents with candidate commands from the TextWorld Engine, but they quickly oveﬁt without learning affordances, commonsense, or pre-conditions, and had zero performance on embodied transfer.
In the embodied setting, without access to a TextWorld Engine, it is difﬁcult to generate candidate actions unless a set of heuristics is handcrafted with strong priors and commonsense knowledge.
We also experimented with populating a list of command templates, but found this to be infeasible as some scenarios involved 1000s of populated actions per game step.
J ALFRED T ASK D ESCRIPTIONS
The following descriptions describe the processes involved in each of six task-types :
• Pick & Place (e
g., “put a plate on the coffee table”) - the agent must ﬁnd an object of the desired type, pick it up, ﬁnd the correct location to place it, and put it down there.
• Examine in Light (e.g., “examine a book under the lamp”)
- the agent must ﬁnd an object of the desired type, locate and turn on a light source with the desired object in-hand.
• Clean & Place (e.g., “clean the knife and put in the drawer”) - the agent must ﬁnd an object of the desired type, pick it up, go to a sink or a basin, wash the object by turning on the faucet, then ﬁnd the correct location to place it, and put it down there.
• Heat & Place (e.g., “heat a mug and put on the coffee table”) - the agent must ﬁnd an object of the desired type, pick it up, go to a microwave, heat the object turning on the microwave, then ﬁnd the correct location to place it, and put it down there.
• Cool & Place (e.g., “put a cool bottle on the countertop”) - the agent must ﬁnd an object of the desired type, pick it up, go to a fridge, put the object inside the fridge and cool it, then ﬁnd the correct location to place it, and put it down there.
• Pick Two & Place (e.g., “put two pencils in the drawer”) - the agent must ﬁnd an object of the desired type, pick it up, ﬁnd the correct location to place it, put it down
there, then look for another object of the desired type, pick it up, return to previous location, and put it down there with the other object.
K
ALFW ORLD T EXT G AME E XAMPLES
Three
[Table]
of ALFWorld text game
[Table]