Attention-Based Fault-Tolerant Approach for Multi-Agent Reinforcement Learning Systems

The aim of multi-agent reinforcement learning systems is to provide interacting agents with the ability to collaboratively learn and adapt to the behavior of other agents. Typically, an agent receives its private observations providing a partial view of the true state of the environment. However, in realistic settings, the harsh environment might cause one or more agents to show arbitrarily faulty or malicious behavior, which may suffice to allow the current coordination mechanisms fail. In this paper, we study a practical scenario of multi-agent reinforcement learning systems considering the security issues in the presence of agents with arbitrarily faulty or malicious behavior. The previous state-of-the-art work that coped with extremely noisy environments was designed on the basis that the noise intensity in the environment was known in advance. However, when the noise intensity changes, the existing method has to adjust the configuration of the model to learn in new environments, which limits the practical applications. To overcome these difficulties, we present an Attention-based Fault-Tolerant (FT-Attn) model, which can select not only correct, but also relevant information for each agent at every time step in noisy environments. The multihead attention mechanism enables the agents to learn effective communication policies through experience concurrent with the action policies. Empirical results showed that FT-Attn beats previous state-of-the-art methods in some extremely noisy environments in both cooperative and competitive scenarios, much closer to the upper-bound performance. Furthermore, FT-Attn maintains a more general fault tolerance ability and does not rely on the prior knowledge about the noise intensity of the environment.


Introduction
In this paper, we focus on the fault tolerance problem in multi-agent reinforcement learning systems.Consider the following robotic search and rescue scenario: a group of unmanned aerial vehicles (UAVs) is sent to find the survivors in a group of high-rise buildings after an earthquake [1].The harsh environmental conditions might cause individual robots to fail, or hackers might take control of some robots and force them to behave in misleading ways [2].In order to find the survivors as quickly as possible, these robots have to periodically exchange information with the neighbors and make decisions based both on the local view and the correct information from the neighbors.
The above-mentioned multi-robot cooperation problem can be modeled as multi-agent reinforcement learning problem.Multi-agent reinforcement learning systems aim to provide interacting agents with the ability to collaboratively learn and adapt to other agents' behaviors.Plenty of real-world applications can be modeled as multi-agent systems, e.g.autonomous driving [3], smart grid control [4] and multi-robot control [5].Typically, an agent receives its private observations providing a partial view of the true state of the world.However, in realistic settings, one or more agents that show arbitrarily faulty or malicious behavior may suffice to let the current coordination mechanisms fail [6].Therefore, fault tolerance and credit assignment will become of paramount importance.
We conclude two challenges to enable the agents to collaboratively solve the underlying task with the fault-tolerance ability.First, a proper communication mechanism needs to be designed for the agents to extract correct and relevant information from others and model the environment.Then, the communication mechanism should maintain a stable complexity while keeping the ability to deal with different kinds of uncertainties in the environment i.e., accommodate a various number of agents with noisy observations without tuning the configuration of the algorithm.In concrete, the algorithm should maintain the ability to deal with the complex cases where an agent needs to reach multiple agents' correct observations at the same time.
To overcome the challenges, we present an Attention-based Fault-Tolerant (FT-Attn) algorithm which selects correct and relevant information for each agent at every time-step.The multi-head attention mechanism enables the agents to learn effective communication policies through experience concurrently to the main policies.Rather than simply sharing the correct obser-vations, FT-Attn estimates the critic function for a single agent by selecting and utilizing the useful encoded information from others.We study the performance of FT-Attn in the modified Cooperative Navigation environments [7] and compare our results with the previous state-of-the-art method MADDPG-M (Multi-agent Deep Deterministic Policy Gradient-Medium) [7].The results show a clear advantage of our method in some extremely complex environments.Furthermore, FT-Attn can easily adapt to various kinds of noisy environments without tuning the complexity of the algorithm.We also visualize the attention weights generated by FT-Attn to inspect how the fault-tolerance mechanism is working.We comment that FT-Attn is not designed for competing with other models without considering fault-tolerance, but a complementary one.We believe that adding our idea of fault-tolerance makes the existing algorithms much more valuable and practical.
The rest of this paper is organized as follows.Section 2 introduces the background and highly related work.Section 3 describes the methodology of our work as well as the architecture designed for training and prediction.The validation and evaluation of our work in the modified Cooperative Navigation environment are described in Section 4. We conclude and provide our future directions in Section 5.

Related Work
To the best of our knowledge, there is only one method MADDPG-M [7] studying the multi-agent reinforcement learning problem characterized by partial and extremely noisy observations, i.e., only one agent's observation is correct.To deal with the noisy observations which are weakly correlated to the true state of the environment, MADDPG-M forces the agents to learn whose private observation is sufficiently informative to be shared with others.However, the communication policy is task-specific relying on prior knowledge about the underlying environment requirement, which simplifies the uncertainties and the complexity compounded with a specific experimental evaluation.If the experimental setting changes, MADDPG-M must adjust the information filtering mechanism to adapt to the new environments.Besides, when there exist multiple correct observations (in not extremely noisy environments), MADDPG-M could not select the relevant information for each agent on the basis of correct observations and may lead to sub-optimal performance.Furthermore, the observation sharing mechanism may introduce redundant information (e.g.pixel data) because the raw observations may be high-dimensional.

Our Approach
In this section, we will first introduce the problem formulation of our multi-agent reinforcement learning fault-tolerant setting.Then, we will introduce the framework of our proposed method FT-Attn.Finally, we will introduce the training details.

Problem Formulation
We consider partially observable Markov Games, and make the assumption that the observations received by some of the agents are noisy and weakly correlated to the true state, which makes learning optimal policies unfeasible.Denote the policy for agent i on all N private observations as The learning process of the individual policy a i is hard to complete because a large number of o i are uncorrelated to the corresponding true state s, i.e., the background information provides a poor representation of the current true state for the i th agent.In order to solve this challenge, each agent has to explicitly and selectively exploit the correct and useful observations shared by other agents.In other words, the agents have to form a common cognition internally before they master the ability to cooperate.Due to the reason that the agents cannot discriminate between relevant and noisy information on their own, the ability to decide whether to share their own observations with others must also be acquired through experience.

Framework of FT-Attn
More formally, we introduce multi-head attention mechanism to learn the critic for each agent by selectively paying attention to other agents' observations.Figure 1 illustrates the main components of our approach.
We use multi-head dot-product attention to select the correct observations and compute interactions between agents.Intuitively, each agent inquires about other agents for information about their observations as well as the actions and then takes the relevant information into account for estimating its value function.Denote Q ψ i (o, a) as the function of agent i's observation and action, as well as other agents' contributions, the value is estimated as follows: Here, f i represents the Q-Network and g i represents the encoder function.The contribution from other agents m i is a weighted sum of each agent's value: where h is an attention head and e j is the embedding encoded by g j function.
W h v transforms e j into a "value".The set of all agents except i is represented as \i and indexed with j.To calculate the weight a h ij , the input feature of each agent is projected to query, key and value representation by each independent attention head.For attention head h, the relation between i and j is computed as: where τ is a scaling factor, W h q transforms e i into a "query" and W h k transforms e j into a "key".

Training Details of FT-Attn
All critics are updated together to minimize a joint regression loss function because of the parameter sharing: where where ψ and θ are the parameters of the target critics and target policies respectively.α represents the temperature parameter determining the balance between maximizing entropy and rewards [8].The individual policies are updated with the following gradient: where b(o, a \i ) represents the multi-agent baseline used to calculate the advantage function: the advantage function here can help solve the multi-agent credit assignment problem [9].In concrete, by comparing the value of specific action to the value of the average action for the agent, with all other agents fixed, we can know whether any increase in reward is attributed to other agents' actions.
For the training procedure, we use Soft Actor-Critic [10] method for maximum entropy reinforcement learning.The model is trained for 10 5 episodes with 25 steps each episode.We add a tuple of (o t , a t , r t , o t+1 ) 1•••N to the replay buffer with the size of 10 6 at each time-step.We update the network parameters after every 1024 tuples added to the replay buffer and perform gradient descent on the loss function.We use Adam [11] optimizer with a learning rate of 0.001.For other hyper-parameters, the discount factor γ is set to 0.99; the dimension of the hidden state is set to 128 and the number of attention heads is set to 4. For the exploration noise, following [12], we use an Ornstein-Uhlenbeck process [13] with θ = 0.15 and σ = 0.2.

Experiments
In this section, we will first introduce the experimental setting and baseline methods.Then, we will show the experimental results compared with the baseline methods.Finally, we will give the attention visualization and the corresponding analyze.

Experimental Setting and Baseline Methods
To evaluate our proposed approach, we follow the experimental settings: three varied versions of Cooperative Navigation problem (N agents and N landmarks) in MADDPG-M [7].In concrete, only one gifted agent of N agents can observe the true position of the landmarks and all other agents receive inaccurate information about the landmarks' positions.The task includes three different variants of increasing complexity depending on how the gifted agent is defined: in the Fixed case, the gifted agent stays the same throughout the training phase; in the Alternating case, the gifted agent may change at the beginning of each episode; in the Dynamic case, the agent closest to the center of the map becomes the gifted one within each episode.
We set N = 3 and evaluate FT-Attn against five actor-critic based baselines, DDPG (Deep Deterministic Policy Gradient) [12], MADDPG (Multiagent Deep Deterministic Policy Gradient) [14], Meta-agent [7], DDPG-OC (DDPG with Optimal Communication) [7] and MADDPG-M [7].DDPG and MADDPG are chosen to provide a lower bound of the performance since each agent's policy is conditioned only on its own observations.The Meta-agent method is included to test the performance where all the observations are shared.The DDPG-OC baseline is chosen to study what level of performance is achievable when communicating optimally.MADDPG-M enables concurrent learning of optimal communication policy and the underlying task.

Performance Comparison with the Baseline Methods
We run an additional 1000 episodes after training to collect the performance metrics and report the averages on the three scenarios.Table 1 shows the mean episode rewards for FT-Attn and all baselines on the three scenarios.In these cases, both DDPG and MADDPG fail to learn the correct behavior because the observations are not allowed to be shared in the execution process.DDPG-OC provides an upper bound of the performance since the shared message is correctly controlled.The poor performance provided by Meta-agent method in the complex cases (Alternating and Dynamic) demonstrates that selecting correct and relevant information is essential in noisy environments.FT-Attn beats MADDPG-M in the complex cases and performs quite similarly to the upper bound DDPG-OC.The superiority demonstrates that multi-head attention mechanism maintains a better ability to deal with the noisy observations.

Attention Visualization
To understand how the use of attention contributes to the fault-tolerance ability, we examine the "entropy" of the four attention weights from the attention heads in Figure 2, Figure 3 and Figure 4.The initial value 0.69 represents the maximum possible entropy (i.e.uniform attention across all agents).Lower entropy indicates that the head is focusing on specific agents.We find that the agents are more willing to utilize head1 and head2 and each agent appears to use a different combination of the four heads.
We further visualize the attention weights generated by FT-Attn to understand the interactions in N = 5 scenarios containing a different number of gifted agents.Each agent's attention weight is calculated from the heads that the agent appears to use the most.We pick the scenarios containing four different combinations of the gifted agents (with the number of gifted agents set to 1, 2, 3 and 4 respectively) and show the related heat-maps of the interaction matrix generated by FT-Attn in Figure 5 and Figure 6.We can see that the agents have acquired the ability to select the correct observations (self-attention is avoided in FT-Attn).Furthermore, the agents can also select the relevant and useful information among the correct observations (not paying uniform attention), which demonstrates the superiority 0 2 0 0 0 0 4 0 0 0 0 6 0 0 0 0 8 0 0 0 0 1 0 0 0 0 0 0 .compared with the simple information sharing mechanism in MADDPG-M.

Conclusion
We propose an algorithm FT-Attn for coping with the fault-tolerance problem in the multi-agent reinforcement learning systems.The key idea is to utilize the multi-head attention mechanism to select the correct and useful information for estimating critics.We evaluate the performance of FT-Attn in the modified Cooperative Navigation environments compared with MADDPG-M, a method which is designed for dealing with extremely noisy environments.Empirical results have shown that FT-Attn beats MADDPG-M in some complex environments and can adapt to various kinds of noisy environments without tuning the complexity of the algorithm.Furthermore, FT-Attn can effectively deal with the complex situation where an agent needs to reach multiple agents' correct observation at the same time.
In our future work, we will compare the performance of FT-Attn with other baseline methods in Predator and Prey scenario.Besides, we will increase the number of agents and further highlight the advantage of faulttolerance ability in multi-agent reinforcement learning systems.

1 Figure 1 :
Figure 1: FT-Attn is composed of three modules: encoder, multi-head attention part, and Q network.

Figure 2 :
Figure 2: Attention entropy for each head over the course of training for agent 1 in the "Dynamic" situation.

Figure 3 :
Figure 3: Attention entropy for each head over the course of training for agent 2 in the "Dynamic" situation.

Figure 4 :
Figure 4: Attention entropy for each head over the course of training for agent 3 in the "Dynamic" situation.

Figure 5 :
Figure 5: Attention weights generated by FT-Attn in the Fixed case of N = 5 version.(a) Scenario 1: only the observation of agent 1 is correct; (b) Scenario 2: the observations of agent 2 and agent 3 are correct.

Figure 6 :
Figure 6: Attention weights generated by FT-Attn in the Fixed case of N = 5 version.(a) Scenario 3: the observations of agent 1, agent 2 and agent 4 are correct; (b) Scenario 4: the observations of agent 1, agent 2, agent 3 and agent 4 are correct.

Table 1 :
Mean (standard deviations) episode rewards for all baselines in all 3 scenarios.