Causality-Aware Transformer Networks for Robotic Navigation
Ruoyu Wang Yao Liu Yuanjiang Cao Lina Yao







Causality-Aware Transformer Networks for Robotic Navigation






Wang et al.






University of New South Wales Macquarie University Commonwealth Scientific and Industrial Research Organisation, Australia


Causality-Aware Transformer Networks for Robotic Navigation
    Ruoyu Wang 1 Yao Liu 2 Yuanjiang Cao 2 Lina Yao 1,3
    September 9, 2024
===========================================================



§ ABSTRACT 
Recent advances in machine learning algorithms have garnered growing interest in developing versatile Embodied AI systems. However, current research in this domain reveals opportunities for improvement. First, the direct adoption of RNNs and Transformers often overlooks the specific differences between Embodied AI and traditional sequential data modelling, potentially limiting its performance in Embodied AI tasks. Second, the reliance on task-specific configurations, such as pre-trained modules and dataset-specific logic, compromises the generalizability of these methods. We address these constraints by initially exploring the unique differences between Embodied AI tasks and other sequential data tasks through the lens of Causality, presenting a causal framework to elucidate the inadequacies of conventional sequential methods for Embodied AI. By leveraging this causal perspective, we propose Causality-Aware Transformer (CAT) Networks for Navigation, featuring a Causal Understanding Module to enhance the models's Environmental Understanding capability. Meanwhile, our method is devoid of task-specific inductive biases and can be trained in an End-to-End manner, which enhances the method's generalizability across various contexts. Empirical evaluations demonstrate that our methodology consistently surpasses benchmark performances across a spectrum of settings, tasks and simulation environments. Extensive ablation studies reveal that the performance gains can be attributed to the Causal Understanding Module, which demonstrates effectiveness and efficiency in both Reinforcement Learning and Supervised Learning settings.  









§ INTRODUCTION

Navigation is a fundamental task in the research of Embodied AI, and the methods for Navigation can be broadly grouped into Supervised Learning methods and Reinforcement Learning methods, distinguished by the nature of their training processes <cit.>. Supervision in Navigation generally refers to a demonstration of a possible solution to a problem, and the methods are typically focused on matching the behaviour of their demonstrator. In Reinforcement Learning (RL) settings, an agent learns the policy by interactions with an environment. In both settings, while some methods have been proposed in recent years, many of them share similar limitations.

First, many methods involve the incorporation of task-specific inductive bias thus lack of generalizability <cit.>. For example, they usually require dataset-specific hand-crafted logics <cit.>, pre-trained modules to construct semantic maps <cit.>, additional large dataset <cit.>, or multi-stage training <cit.>. These limitations render them deficient in terms of generalizability and reproducibility, precluding their extension to alternative datasets or tasks.

Second, most existing methods directly adopt the traditional sequential data modeling methods such as RNN or Transformer as a core module. While employing these strategies from analogous tasks involving sequential data might seem expedient, it is crucial to acknowledge that Embodied AI tasks exhibit distinct characteristics from a causal perspective (Section <ref>). However, existing methods haven't adequately engaged with these distinctions thus limiting their effectiveness on Embodied AI tasks.










While a few existing works <cit.> tackled the generalizability problem by proposing an End-to-End method without task-specific architectures and inductive biases, the second weakness introduced above remains unaddressed. Therefore, we introduce a novel method to address these identified shortcomings in this paper.

Firstly, to enhance the generalizability and reproducibility of the approaches, we present an end-to-end method for visual navigation. This framework eschews any task-specific architecture and inductive biases, aligning with the principles demonstrated in EmbCLIP <cit.>. Secondly, we conduct a thorough analysis of the disparities between Embodied AI tasks and other types of sequential tasks through the lens of causality. By encapsulating these distinctions within a causal framework, we elucidate the inadequacies of conventional sequential methods, such as RNNs and Transformers, in addressing Embodied AI tasks. Consequently, we propose an innovative solution incorporating a Causal Understanding Module, designed to significantly enhance model performance in these contexts. In a nutshell, our contributions are three-folded:


    
  * We propose Causality-Aware Transformer (CAT), a novel End-to-End framework for Navigation tasks without task-specific inductive bias, and experimentally show that it outperforms the baseline methods by a significant margin across various tasks and simulators.
    
    
  * We introduce a causal framework for Navigation tasks, 
    offering a comprehensive rationale for the limitations in existing methods that potentially hinder agent performance. Without incurring additional computational cost, we design a Causal Understanding Module to substantially enhance the methods' effectiveness and efficiency, demonstrating the framework's ability to optimize performance through a more nuanced understanding of causality.
    
    
  * We conduct comprehensive ablation studies and demonstrate the efficiency, effectiveness and necessity of the Causal Understanding Module. Besides, while we primarily focus on the tasks in the Reinforcement Learning setting, experiments show that the proposed Causal Understanding Module is also generally beneficial in the Supervised Learning setting.





R0.6
    

    
    < g r a p h i c s >

    Our method encourages the model to understand the environment by highlighting the direct causal relationships and diminishing the non-direct causal associations.
    
    








§ BACKGROUND





 §.§ Motivation


Across diverse settings and paradigms within Embodied AI tasks, many necessitate the modelling of sequential data accumulated from preceding time steps. Predominantly, research endeavours utilize Recurrent Neural Networks (RNNs) or Transformers for this purpose, given their established efficacy in handling sequential data. Nevertheless, these methods were primarily proposed for other scenarios such as NLP, our question is, are these methods well-suited for the Navigation tasks?

We argue that directly adopting methods such as RNNs or Transformers to navigation tasks may result in specific limitations. This is due to the intrinsic differences between navigation tasks and conventional sequential data modelling tasks such as NLP, particularly when viewed through the framework of Causality. For instance, if we consider the following sentence in NLP:




    The doctor asked the nurse a question, “...?”,  She said, .... 


It is obvious that the token She refers to the nurse, which was mentioned several time steps earlier. This indicates that direct causal relationships in such scenarios can be long-term or short-term, and do not adhere to a universal pattern.

In Navigation tasks, however, based on our empirical understanding of the physical world, the direct causal relationship can only be one-step, because it is generally believed that the transition from one state to another is typically attributed to the actions undertaken in the interim. For example, the current standing position of the agent and the action performed in that position serves as the direct determinants of its subsequent position, as demonstrated in Figure <ref>.

This fundamental difference underscores why methods such as RNNs or Transformers may not be ideally suited for Embodied AI tasks, because they are inherently designed to capture long-term associations across time steps. While this feature is advantageous for tasks that exhibit long-term causal connections, it proves counterproductive for navigation tasks, where such associations may not be desirable. Therefore, modifications to the architecture are necessary to address these disparities.






 §.§ Motivation Formulation from a Causal Perspective



We formalize the motivation introduced above into a causal framework. First, based on the nature of the Navigation tasks, we make the following assumptions, which closely align with our empirical observations in the real world, as elaborated in Section <ref>.


    At any given time step t, the state S_t and the action a_t are the only direct causal parent influencing the subsequent state at time step t+1, denoted as S_t+1.
    



    At any given time step t, the state S_t and the Objective are the only causal parents of the action a_t.
    


Differences with Markov Property While the intuition of these assumptions may appear similar to the Markov Property <cit.>, they are distinct concepts from three perspectives: 1) Our assumptions pertain to causality, whereas the Markov property concerns transitional probability. 2) The Markov property underpins problem formulations such as Markov Decision Processes (MDPs), rather than serving as a specific modeling technique. However, our focus is on the practical aspects, and we discuss the appropriate architecture for modelling the scenario. 3) Our method is broadly applicable in both Reinforcement Learning and Supervised Learning contexts, thus not restricted to MDPs.

We depict these causal assumptions in a causal graph, as illustrated in the enlarged Causal Understanding Module in Figure <ref>, where the edge S_t-1→ S_t← a_t-1 corresponds to the Assumption <ref>, and the edge S_t→ a_t corresponds to the Assumption <ref>. Further, we derive Proposition <ref> based on these assumptions, which suggests that there exist NO direct causal relationships between S_t-1 and S_t+1, so S_t-1→ S_t+1 is marked by a light dotted line, indicating the causation between them is indirect and weak.

    At any given time step t, and for any integer δ≥ 2, there exist no direct causal relationships between S_t and S_t-δ, the causal relationships between states S_t and S_t-δ are indirect and must be mediated by states S_t' for all t' where t-δ≤ t' ≤ t.
    

As discussed in Section <ref>, we identify Proposition <ref> as a crucial distinction between Navigation tasks and other sequential data tasks such as NLP. Therefore, we aim to make the direct causal relationship S_t-1→ a_t-1, S_t-1→ S_t and a_t-1→ S_t stand out from the associations in other forms. While S_t-1→ a_t-1 is inherently highlighted by the data collection process in the task, S_t-1→ S_t and a_t-1→ S_t need to be addressed in the historical data modelling step. Building on these concepts, we propose our method to make these causal associations stand out from the associations in other forms.








































§ CAUSALITY-AWARE TRANSFORMER NETWORKS



The architecture of our proposed methodology is depicted in Figure <ref> and encompasses multiple components: Visual Encoder, Goal/Action Embedding, Feature Post-Processing, Multi-modal Transformer, and the Causal Understanding Module. The functions and operations of these individual modules are delineated in the subsequent sections.

Visual Encoder We fine-tune the pre-trained CLIP ResNet-50 model <cit.> as the Visual Encoder to convert the visual signal S_i into features z_s_i because CLIP is proven to be effective for the Embodied AI tasks <cit.>.

Objective & Action Embedding The Objective and Actions are given in the text format, such as “Find the laptop”, “Move Forward”, and “Turn Left”. We utilize a simple Embedding layer to transform the Objective and previous actions a_i into features h_o and h_a_i.

Feature Post-Processing After obtaining the representations of the visual signal of each state z_s_i and the representation of the goal h_o, we pass these features to a Feature Post-Processing Module, which is designed to integrate objective-related information into the visual representation of each state serves to reinforce the causal relationship between the objective and the subsequent action (Assumption <ref>). Consequently, the Feature Post-Processing Module generates a distinct set of features h_s_i for each state.

Multi-modal Transformer All the features obtained in the earlier steps are passed into a Multi-modal Transformer Module, as illustrated in Figure <ref>. We use h_visual and h_action to denote the sequence of h_v_i and h_a_i for simplicity.

First, we concatenate h_visual and h_action along the direction of the time step, as demonstrated by Equation <ref>, and apply the Positional Encoding on the concatenated features h_concat. Then, the features will be passed to the transformer encoder <cit.>, which is built with causal attention that prevents visual and action embeddings from attending to subsequent time steps. Consequently, the transformer produces a set of updated features h'_concat.

    h_concat = [ h_visual; h_actions]

Similarly, the output of the transformer contains the updated features of visual states and previous actions, as illustrated by Equation <ref>. Then, we take the updated visual features h'_visual and feed them to an Actor layer, which predicts the proper action to be taken at the given state, as illustrated by Equation <ref>. Finally, the agent will interact with the environment through a_t to get the visual signal of the next state, then the framework proceed to the next time step.


    h'_concat = [ h'_visual; h'_actions]


    a_t = Actor(h'_visual)



Causal Understanding Module Following the idea in Assumption <ref>, Assumption <ref> and Proposition <ref>, we use a Causal Understanding Module to encourage the one-step direct causation to stand out from the associations in other forms. In particular, we claim that for any time step t, the state S_t and the corresponding action a_t should be the only direct causes of the next state S_t+1. And any states in earlier time steps only hold indirect causation with S_t+1, thus the association between them should be weaker than the direct causation between adjacent states. To align the model architecture with these assumptions, we aim to make the direct causations stand out from other forms of associations. Therefore, we introduce a Causal Understanding Module, which predicts the representation of the next state S_t+1 by taking the representation of S_t and a_t as input. Ideally, a model demonstrating accurate predictions on this auxiliary task signifies a thorough understanding and effective encoding of the underlying environment. Mathematically, the Causal Understanding Module is trained by minimizing the Causal Loss as defined in Equation <ref>.

    ℒ_causal(θ) = 𝔼_t[ (Causal(h_v_t, h_a_t) - h_v_t+1 )^2 ]


Training Process For experiments in the Reinforcement Learning setting, we train our model with Proximal Policy Optimization (PPO) <cit.>. So the overall objective of our framework becomes Equation <ref>, where ℒ_PPO denotes the original objective of PPO <cit.> which is to be maximized, ℒ_causal is our proposed Causal Loss which is to be minimized, so we subtract the causal loss from the PPO objective.

    ℒ_total(θ) = ℒ_PPO - αℒ_causal

We also conduct experiments in the Supervised Learning setting, where the training process differs from that in the Reinforcement Learning setting. This will be elaborated in Section <ref>.




























§ EXPERIMENTS


In Section <ref>-<ref>, we evaluate the performance of our method in the Reinforcement Learning setting. In Section <ref>, we conduct ablation studies and found the Causal Understanding Module contributes most of the performance gain. In Section <ref>, we demonstrate that the Causal Understanding Module is also generally applicable and effective in the Supervised Learning setting.



 §.§ Experiment Setting




  §.§.§ Task Descriptions

We evaluate our method over three tasks in the Reinforcement Learning setting:
(1) Object Navigation in RoboTHOR <cit.>, which requires an agent to navigate through its environment and find an object of a given category. For example, “Find an apple". The task consists of 12 possible goal object categories, and the agent is allowed to MoveAhead, RotateRight, RotateLeft, LookUp, and LookDown. The agent is considered to have completed the task if it takes a special Stop action and one goal object category is visible within 1 meter of the agent. 
(2) Object Navigation in Habitat, which is defined similarly to the task in RoboTHOR, but Habitat has 21 objects and does not require the agent to be looking at a target object to succeed. Habitat uses scenes from the MatterPort3D <cit.> dataset of real-world indoor spaces. 
(3) Point Navigation in Habitat, which requires an agent to navigate from a random initial position to polar goal coordinates. For example, “Navigate to (X, Y)". The agent is allowed to do three actions, which include MoveAhead, RotateRight, and RotateLeft. The agent should perform a special Done action when it reaches its goal coordinates. We train within the Gibson Database <cit.>.



  §.§.§ Evaluation Metrics

Various metrics are employed to assess an agent's performance across different tasks. Following the previous works, we evaluate the performance of an agent on Object Navigation in RoboTHOR by Success Rate (SR) and Success weighted by Path Length (SPL).
Success Rate measures the frequency with which an agent successfully completes a task, while Success weighted by Path Length (SPL) takes into account the length of the path traversed by the agent to accomplish the task. On the other hand, for the two tasks in Habitat, apart from SR and SPL, we also evaluate the agent's performance on Goal Distance (GD), which quantifies the agent's proximity to the goal upon task completion. In general, an agent is considered to be better if it achieves a higher SR and SPL, or lower GD.



  §.§.§ Baselines



(1) We compare our method with EmbCLIP, because both methods do not contain any task-specific designs and can be trained in an End-to-End manner, thus lying in the same category and can be compared directly. For both methods, we train the model for 20M steps. And during the training process, we select the checkpoint with the highest SR for evaluation and comparison.

(2) We compare our method with baseline methods specifically designed for each task. However, as discussed earlier, it is worth noting that these methods are not directly comparable with us because they are not in the same setting as our method. For example, these methods employ either task-specific hand-crafted logic, undergo training across multiple stages, or leverage extensive offline datasets to facilitate the training process. But for a comprehensive understanding of the performance of our method, we report the validation results of these methods as a reference.
Specifically, we compare our method with Action Boost, RGB+D, ICT-ISIA, and ProcTHOR <cit.> on RoboTHOR ObjNav; and compare with Stubborn <cit.>, TreasureHunt <cit.>, Habitat on Web (IL-HD) <cit.>, Red Rabbit <cit.>, PIRLNav<cit.> and RIM on Habitat ObjNav; and compare with DD-PPO <cit.>, Monocular Predicted Depth, Arnold and SRK AI on Habitat PointNav.






  §.§.§ Environment and Parameters
 
For all the experiments, we trained our method for 20M steps. and select the checkpoint with the highest Success Rate (SR) for evaluation on other metrics. Regarding the model architecture, we use an Embedding layer for Action and Objective Embedding and a linear layer for the Feature Post-Processing, the Casual Understanding and the Actor Module. The Multi-modal Transformer Encoder is a single-layer transformer encoder with 4 self-attention heads and the dimension for each self-attention head is 392 thus the total dimension is 1568. The episode length is 128. The weight α for Causal Loss is 1. We train our framework using Adam <cit.> with a learning rate of 1e-4, and schedule the learning rate to linearly Decay to 0 when the training is finished. Our code is based on AllenAct <cit.>, a learning framework designed for Embodied-AI research. Any settings not specified here remain the same as <cit.>. 








 §.§ Results





















    


















We provide the results of our experiments for each task in Table <ref> and Table <ref>. As introduced in Section <ref>, we compare our method with two types of baselines, thus our findings similarly fall into two aspects:

(1) Compared with EmbCLIP, our method outperforms the baseline significantly on all the tasks across all evaluation metrics, as illustrated in Table <ref>-<ref>. This shows the effectiveness of our method. In particular, our method achieves more than a doubling of EmbCLIP on SPL and SR, in RoboTHOR Object Navigation and Habitat Object Navigation tasks.

(2) Compared with other methods with stronger assumptions and inductive bias, we observe that our method also achieves better results than these methods. While a few of these methods achieve similar performance to our method on some evaluation metrics, these method lacks generalizability and reproducibility due to various reasons, as elaborated earlier. For example, in Table <ref>, while ProcTHOR<cit.> also performs well, it requires extremely large offline data to train a large model first, and then fine-tune the pre-trained model as a second stage. Similarly, in Table <ref>, while RIM and PIRLNav <cit.> achieve a similar result to us, they also require multi-stage training and task-specific designs.

R6cm
  

  Results on Habitat ObjNav.
  
        SPL     SR     GD 

    CAT (Ours)     0.16     0.41     6.76 

    Emb-CLIP     0.07     0.15     7.13 

    
    RIM     0.15     0.37     6.80 

    PIRLNav     0.14     0.35     6.95 

    Stubborn     0.10     0.22     9.17 

    TreasureHunt     0.09     0.21     9.20 

    Habitat on Web     0.08     0.24     7.88 

    Red Rabbit     0.06     0.24     9.15 

    
  

  


Besides, we conducted some case studies to investigate the benefits of implementing our method. In Figure <ref>a-b, we tested our method and EmbCLIP with the task “Find an AlarmClock” in RoboTHOR ObjNav, and found that our method encouraged the agent to stop at a spot closer to the objective, thus benefiting the performance. In Figure <ref>c-d, we test the methods in Habitat PointNav with the Nuevo scenario, where the green dot denotes the starting point and the red star denotes the target point. We found that our agent can directly navigate to the target point with an optimal route, while EmbCLIP failed to find the shortest path. We speculate that this is because our method enables the agent to understand the environment more efficiently, so the agent can navigate to a place that was less explored before.

In summary, both quantitative results and the qualitative sample check demonstrated the effectiveness and generalizability of our proposed method.












 §.§ Ablation Studies



Our proposed method differs from EmbCLIP mainly from three perspectives: (1) We propose a Causal Understanding Module to reinforce the model's capability for environmental understanding; (2) We implement a Multi-modal transformer for feature encoding; (3) We fine-tune the CLIP visual encoder in the training process instead of holding it fixed. Therefore, we conduct ablation studies to examine the impact of these components. We conduct the studies on all three tasks and present the result in Table <ref>. 





  §.§.§ Impact of Causal Understanding Module


We first examine the impact of the Causal Understanding Module by implementing this module on EmbCLIP <cit.>. We keep all the configurations in EmbCLIP unchanged and compare the cases with/without the causal understanding module. We refer to this model as Causal-RNN in Table <ref> for simplicity.

R0.6
    

  
    < g r a p h i c s >

  Average Success Rate for EmbCLIP and Causal-RNN on RoboTHOR ObjNav. Our proposed Causal Understanding Module can: 1) significantly benefit the performance; and 2) significantly reduce the training time by 10 times.
  
  



Besides, we also plot a curve of Success Rate in Figure <ref> for direct comparison of the training progress, where the x-axis denotes the steps of training, and the y-axis denotes the Success Rate. We ran each case 10 times randomly and plotted the average Success Rate at each step. Due to the space limitation, we only plotted the curve for the first 10M steps.

We observe two clear benefits of implementing the Causal Understanding Module: (1) It significantly improves the performance of the baseline model without computational overhead. Specifically, we improve the success rate by more than 50% by adding one simple linear layer; (2) It significantly reduces the time required for training a satisfactory agent. Specifically, we trained the Causal-RNN model for 20M steps and achieved a success rate of 0.48. In contrast, as claimed in <cit.>, EmbCLIP achieved a success rate of 0.47 after training for 200M steps. Therefore, we significantly reduce the training time 10 times by adding one simple Linear layer.



























  §.§.§ Impact of Multi-modal Transformer

To examine the effectiveness of the Multi-modal Transformer Encoder, we simplify the architecture by removing the Causal Understanding Module from Figure <ref>, and holding CLIP fixed across the training process while keeping all other settings unchanged. In other words, we replace the encoder in EmbCLIP with our Multi-modal Transformer. We directly compare this method with EmbCLIP to understand the benefits of employing a multi-modal Transformer. We refer to this method as Transformer in Table <ref>, and observe that the Multi-modal Transformer Encoder is beneficial to the model's performance.







  §.§.§ Impact of CLIP Fine-tuning

 
To examine the impact of a tunable visual encoder, we modify the architecture of EmbCLIP slightly by making the CLIP visual encoder trainable, and all other settings remain unchanged. We refer to this method as EmbCLIP (f.t.) in Table <ref>, and find that a tunable visual encoder is beneficial to the outcome.




  §.§.§ Summary
 Our ablation studies reveal that all three components are necessary for our method to achieve optimal outcomes. However, while a Multi-modal Transformer and a tunable Visual Encoder contribute to the agent's performance, the majority of the observed improvements in Section <ref> can be attributed to the Causal Understanding Module.

















 §.§ Causal Understanding Module in Supervised Learning



While our primary focus in the earlier sections is on experiments within the Reinforcement Learning setting, we also assess the effectiveness of our proposed method in Supervised Learning. Specifically, we implemented the Causal Understanding Module on existing methods including Seq2Seq <cit.>, Speaker Follower <cit.> and EnvDrop <cit.>, while maintaining all other settings as proposed in the respective papers. The experiments are conducted on the R2R dataset <cit.>, and we evaluate the performance of the methods by the commonly used metrics for the task including Navigation Error (NE), Oracle Success Rate (OSR), and SR introduced in earlier sections. The results of the validation unseen split are presented in Table <ref>. Overall, the results have demonstrated the effectiveness, consistency and generalizability of the proposed Causal Understanding Module.








 §.§ Computational Cost

Our proposed architecture requires more computational resources than the baseline method. However, our experiments reveal that our method is not computationally expensive. We trained the model on our machine with a single NVIDIA TITAN X GPU, and it occupies only 5GB of Memory to train the model. It takes around 40 GPU hours to train the model for 20M steps, which is nearly identical to the baseline (EmbCLIP). Besides, our Causal-RNN model in Section <ref> is proven to be effective without any extra resources.







§ RELATED WORK

Many simulators and tasks have been proposed in recent years for Embodied AI. Simulators such as <cit.> enables the interaction between agents and their environments, and tasks such as Navigation <cit.>, Rearrangement <cit.>, Interpreting Instructions <cit.> are proposed to evaluate the performance of the agent. While fast progress has been made on some of the tasks, most of these tasks remain challenging. 

While various methods have been proposed in recent years, most methods are specifically designed for certain tasks aiming for better results for the challenges <cit.>. However, although these methods achieve state-of-the-art performances, they cannot be generalized to other scenarios due to the dataset-specific architecture, inductive bias and hand-crafted logic <cit.>. Recently, <cit.> addressed these issues. They found that CLIP <cit.> makes an effective visual encoder and proposed a novel method that does not require any task-specific architectures and inductive bias.















§ CONCLUSION

In conclusion, this paper addresses key challenges in the domain of Navigation tasks in Embodied AI, particularly the limitations associated with prevalent vanilla sequential data modelling methods and task-specific designs, which often hinder generalizability and performance. By elucidating the intrinsic disparities between Navigation tasks and conventional sequential data modelling tasks, we introduce a novel causal framework to explain the necessity of the causal environment understanding module and proposed Causality-Aware Transformer (CAT), an End-to-End transformer-based method that exhibits notable performance improvements across diverse tasks and simulators, surpassing baseline approaches on multiple evaluation metrics. Furthermore, comprehensive ablation studies reveal that most of the performance gain of our method can be attributed to the Causal Understanding Module, which is proven to be effective and can be implemented in other methods across the paradigm of Reinforcement Learning and Supervised Learning without computational overhead.









splncs04






