{'fraction_non_alphanumeric': 0.038969513468365004, 'fraction_numerical': 0.013155147212361662, 'mean_word_length': 4.380283668024154, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Learning to Share in Multi-Agent Reinforcement Learning

In this paper, we study the problem of networked multi-agent reinforcement learning (MARL), where a number of agents are deployed as a partially connected network and each interacts only with nearby agents. Networked MARL requires all agents make decision in a decentralized manner to optimize a global objective with restricted communication between neighbors over the network. Inspired by the fact that \textit{sharing} plays a key role in human's learning of cooperation, we propose LToS, a hierarchically decentralized MARL framework that enables agents to learn to dynamically share reward with neighbors so as to encourage agents to cooperate on the global objective. For each agent, the high-level policy learns how to share reward with neighbors to decompose the global objective, while the low-level policy learns to optimize local objective induced by the high-level policies in the neighborhood. The two policies form a bi-level optimization and learn alternately. We empirically demonstrate that LToS outperforms existing methods in both social dilemma and networked MARL scenario.


Introduction
In multi-agent reinforcement learning (MARL), there are multiple agents interacting with the environment via their joint action to cooperatively optimize an objective. Many methods of centralized training and decentralized execution (CTDE) have been proposed for cooperative MARL, such as COMA (Foerster et al., 2018), VDN (Sunehag et al., 2018), QMIX (Rashid et al., 2018), QTRAN (Son et al., 2019), QPLEX (Wang et al., 2021), FOP (Zhang et al., 2021), and DMAC (Su and Lu, 2021). However, these methods may suffer from the overgeneralization issue (Wei and Luke, 2016;Castellini et al., 2019). Moreover, they may not easily scale up with the number of agents due to centralized learning (Qu et al., 2020a).
In many MARL applications, there are a large number of agents that are deployed as a partially connected network and collaboratively make decisions to optimize the globally averaged return, such as smart grids (Dall'Anese et al., 2013), smart building systems , communication networks (Kim et al., 2019), and traffic signal control (Xu et al., 2021). To deal with such scenarios, networked MARL is formulated to decompose the dependency among all agents into dependencies between only neighbors. To avoid decision-making with insufficient information, agents are permitted to exchange messages with neighbors over the network. In such settings, it is feasible for agents to learn to make decisions in a decentralized way (Zhang et al., 2018;Qu et al., 2020b). However, there are still difficulties of dependency if anyone attempts to make decision independently, e.g., prisoner's dilemma and tragedy of the commons (Pérolat et al., 2017). Existing methods tackle these problems by consensus update of value function (Zhang et al., 2018), credit assignment (Wang et al., 2020), or reward shaping (Chu et al., 2020). However, these methods rely on either access to global state and joint action (Zhang et al., 2018) or hand-crafted reward functions (Wang et al., 2020;Chu et al., 2020).
Inspired by the fact that sharing plays a key role in human's learning of cooperation (Eisenberg and Mussen, 1989), in this paper, we propose Learning To Share (LToS), a hierarchically decentralized learning framework for networked MARL. LToS enables agents to learn to dynamically share reward with neighbors so as to collaboratively optimize the global objective. The high-level policies decompose the global objective into local ones by determining how to share their rewards, while the low-level policies optimize local objectives induced by the high-level policies. LToS learns in a decentralized manner, and we prove that the high-level policies are a mean-field approximation of the joint high-level policy. Moreover, the high-level and low-level policies form a bi-level optimization and alternately learn to optimize the global objective.
LToS is a general hierarchical framework for networked MARL and can be easily realized by diverse combinations of RL algorithms. We currently implement LToS by DDPG (Lillicrap et al., 2016) as the high-level policy and DGN (Jiang et al., 2020) as the low-level policy. We empirically demonstrate that LToS outperforms existing methods for networked MARL in both social dilemma and networked MARL scenario.

Related Work
There are many recent studies for collaborative MARL. Most adopt CTDE (Lowe et al., 2017;Foerster et al., 2018;Sunehag et al., 2018;Iqbal and Sha, 2019;Rashid et al., 2018;Son et al., 2019;Wang et al., 2021). Many of them are constructed on the basis of factorizing the joint Q-function (Sunehag et al., 2018;Rashid et al., 2018;Wang et al., 2021). However, these factorized methods suffer from the overgeneralization issue (Wei and Luke, 2016;Castellini et al., 2019). Coordination graph could prevent such issue, where the value function can be factorized as a summation of utility function on pairwise or local joint action (Guestrin et al., 2002;Böhmer et al., 2020). However, they can only be applied to discrete action, small scale games (Qu et al., 2020a). Other studies focus more on decentralized training, to which our work is more closely related, as summarized as follows.
Networked MARL. Zhang et al. (2018) and Qu et al. (2019) proposed consensus update of local value functions, where each agent keeps a local copy of the global value function but is assumed to have global information. Qu et al. (2020a) proposed intention propagation between agents, where each agent updates its policy based on intentions shared by other agents, but the policy may converge slowly due to propagated intentions over the network. Qu et al. (2020b) and Lin et al. (2020) investigated the exponential decay property, i.e., the impact of agents on each other decays exponentially in their graph distance, while Chu et al. (2020) introduced a spatial discount factor to capture the influence between agents, which remains hand-tuned. However, none of these studies provide an explicit mechanism to solve social dilemma in networked MARL.
Reward Design. Sodomka et al. (2013) and Peysakhovich and Lerer (2018b) involved the concept of transferable utility to encourage cooperation, and Peysakhovich and Lerer (2018a) resorted to game theory and gave more complex reward designs. However, these methods cannot be easily extended beyond two-player games. Hostallero et al. (2020) aimed at maximizing social welfare, but they simply used temporal difference error for reward shaping. As temporal difference error in deep RL hardly converges to zero, it still biases the optimization objective. Mguni et al. (2019) added an extra part to the original reward as non-potential based reward shaping and used Bayesian optimization to induce the convergence to a desirable equilibrium between agents. However, the extra part remains fixed during an episode, which makes it less capable of dealing with dynamic environments. Moreover, the reward shaping alters the original optimization problem. Hughes et al. (2018) proposed the inequity aversion model to balance agents' selfish desire and social fairness. Wang et al. (2020) considered learning the Shapley value as the credit assignment. Eccles et al. (2019) introduced two types of agents: innovator and imitator, where the imitator additionally obtains an intrinsic reward. However, these methods still rely on hand-crafted reward designs. Lupu and Precup (2020) added gifting as an extra action into the original MDP to modify the MDP and objective.  proposed that each agent learns an incentive function and optimizes the policy in terms of both reward and incentives given by other agents. Obviously, both methods alter the original objective of optimization.
Unlike existing work, LToS enables agents to learn to dynamically share reward with other agents (without the bias of the optimization objective) such that they can collaboratively optimize the global objective in networked MARL.

Networked Multi-Agent Reinforcement Learning
Assume N agents interact with an environment. Let V = {1, 2, · · · , N } be the set of agents. The multi-agent system is modeled as an undirected graph G(V, E), where each agent i serves as vertex i and E⊆ V × V is the set of all edges. Two agents i, j ∈ V can communicate with each other if and only if e ij = (i, j) ∈ E. We denote agent i and its all neighbors in the graph together as a set N i . The state of the environment s ∈ S transitions upon joint action a ∈ A according to transition probability P a : S × A × S → [0, 1], where joint action set A = × i∈V A i . Each agent i has a policy π i ∈ Π i : S × A i → [0, 1], and we denote the joint policy of all agents as π ∈ Π = × i∈V Π i (Zhang et al., 2018). For networked MARL, a common and realistic assumption is that the reward of each agent i just depends on its action and the actions of its neighbors (Qu et al., 2020a), i.e., r i (s, a) = r i (s, a Ni ). Moreover, each agent i may only obtain partial observation o i ∈ O i , but can approximate the state by the observations of N i (Jiang et al., 2020) or the observation history (Chu et al., 2020), which are all denoted by o i for simplicity. The global objective is to maximize the sum of cumulative rewards of all agents , i.e.,

Markov Game
In such a setting, each agent could individually maximizes its own expected return, which is known as Markov game. This may lead to stable outcome or Nash equilibrium, which however is usually sub-optimal. Given π, the value function of agent i is given by where p a ∈ P a describes the state transitions. A Nash equilibrium is defined as (Mguni et al.

Method
LToS is a decentralized hierarchy. At each agent, the high-level policy determines the weights of reward sharing based on low-level policies while the low-level policy directly interacts with the environment to optimize local objective induced by the high-level policies. Therefore, they form a bi-level optimization and alternately learn towards the global objective.

Reward Sharing
The intuition of reward sharing is that if agents share their rewards with others, each agent has to consider the consequence of its actions on others, and thus it promotes cooperation. In networked MARL, as the reward of an agent is assumed to depend on the actions of neighbors, we allow reward sharing only between neighboring agents. This is because the change of actions of neighbors directly affects the reward while the agents outside the neighborhood can only affect the return of the agent indirectly by the change of state distribution. Moreover, this also fits the setting of networked MARL with restricted communication between neighbors.
For the graph of V, we additionally define a set of directed edges, D, constructed from E. Specifically, we add a loop d ii ∈ D for each agent i and split each undirected edge e ij ∈ E into two directed edges: d ij = (i, j) and d ji = (j, i) ∈ D. Each agent i determines a weight w ij ∈ [0, 1] for each directed edge d ij , ∀j ∈ N i , subject to the constraint j∈Ni w ij = 1, so that w ij proportion of agent i's environment reward r i will be shared to agent j. Let w ∈ W = × dij ∈D w ij be the weights of the graph. Therefore, the shaped reward after sharing for each agent i is defined as (2)

Hierarchy
Assume there is a joint high-level policy φ ∈ Φ : S × W → [0, 1] to determine w. Given φ and w, we can define the value function of π at each agent i based on (1) as We express w as a discrete action for simplicity. It also holds for continuous action as long as we change all the summations to integrals. Let V φ V (s; π) . = i∈V v π i (s; w, φ). Proposition 4.1. Given π, V φ V (s; π) and Q φ V (s, w; π) are respectively the value function and actionvalue function of φ.
Proof. The proof is deferred to Appendix A.1.
Proposition 4.1 implies that φ directly optimizes the global objective by generating w, given π. Unlike existing hierarchical RL methods, we can directly construct the value function and action-value function of φ based on the value function of π at each agent.
As φ optimizes the global objective given π while π i optimizes the shaped reward individually at each agent given φ (assuming π convergent to Nash equilibrium or stable outcome, denoted as lim), they form a bi-level optimization. Let J φ (π) and J π (φ) denote the objectives of φ and π respectively. The bi-level optimization can be formulated as follows,

Decentralized Learning
We start from collective learning to achieve global optimization of average reward. So far, the joint high-level policy is still in a centralized form. Note that the scenario needs a decentralized method and each agent has its own reward. Now we turn to learning the joint high-level policy in a decentralized way. The following proposition proves each agent's independence of each other on the high level. Proposition 4.2. The joint high level policy φ can be learned in a decentralized manner, and the decentralized high-level policies of all agents form a mean-field approximation of φ.
Proof. The proof is deferred to Appendix A.2.
Proposition 4.1 and 4.2 indicate that for each agent i, the low-level policy simply learns a local π i (a i |s, w in i ), where w in i = {w ji |j ∈ N i }, to optimize the cumulative reward of r w i , since r w i is fully determined by w in i according to (2) and denoted as r w i from now on. And the high-level policy φ i just needs to locally determine w out i to maximize the cumulative reward of r φ i simplified as r φ i . Therefore, for decentralized learning, (5) can be decomposed locally for each agent i as We abuse the notation and let φ and π also denote their parameterizations respectively. To solve the optimization, we have where α is the learning rate for the low-level policy. Let π i denote π i + α∇ πi J πi (φ), we have The second-order derivative is neglected due to high computational complexity, without incurring significant performance drop such as in meta-learning (Finn et al., 2017) and neural architecture search (Liu et al., 2019). Similarly, we have where β is the learning rate of the high-level policy. Therefore, we can solve the bi-level optimization (5) by the first-order approximations in a decentralized way. For each agent i, φ i and π i are alternately updated.
In distributed learning, as each agent i usually does not have access to state, we further approximate , respectively. Moreover, in network MARL as each agent i is closely related to neighboring agents, (6) can be further seen as π i maximizes the cumulative discounted reward of r w i given φ Ni , where φ Ni = × j∈Ni φ j , and φ i optimizes the cumulative discounted reward of r w i given π Ni (i.e., r φ i ), where π Ni = × j∈Ni π j . During training, π Ni and φ Ni are implicitly considered by interactions of w out i and w in i respectively. The architecture of LToS is illustrated in Figure 1. At each timestep, the high-level policy of each agent i makes a decision of action w out i as the weights of reward sharing based on the observation. Then, the low-level policy takes the observation and w in i as an input and outputs the action. Agent i obtains the shaped reward according to w in i for both the high-level and low-level policies. The gradients are backpropagated along purple dotted lines.
i is the action-value function of φ i given π Ni , v πi i is the value function of π i given φ Ni and conditioned on w in i . As aforementioned, we approx- We can see that the action-value function of φ i is equivalent to the value function of π i . That said, we can use a single network to approximate these two functions simultaneously. For a deterministic low-level policy, the high-level and low-level policies can share a same action-value function. In the current instantiation of LToS, we use DGN (Jiang et al., 2020) (Q-learning) for the low-level policy and DDPG (Lillicrap et al., 2016) for the high-level policy. Thus, the Q-network of DGN also serves as the critic of DDPG, and the gradient of w in i is calculated based on the maximum Q-value of a i . For completeness, Algorithm 1 (see Appendix B) gives the training procedure of LToS based on DDPG and DGN. More discussions about training LToS are available in Appendix C.

Experiments
For the experiments, we adopt three scenarios prisoner, jungle, and traffic depicted in Figure 2, where prisoner and jungle (Jiang et al., 2020)   agents' cooperation, while traffic is a realistic scenario of networked MARL. We obey the principle of networked MARL that only allows communication in neighborhood as Zhang et al. (2018) and Chu et al. (2020).
To illustrate the reward sharing scheme each agent learned, we use a simple indicator: selfishness, the reward proportion that an agent chooses to keep for itself. For ablation, we keep the sharing weights fixed for each agent, named fixed LToS. Throughout the experiments, we additionally compare with the baselines including DQN and DGN, where DGN also serves the ablation of LToS without reward sharing as DGN is the low-level policy of LToS. To maximize the global return directly by centralized learning, we use QMIX (Rashid et al., 2018) as a baseline throughout the three scenarios and two other ones in prisoner. Moreover, as LToS aims to bring a harmonious cooperation by reward sharing in networked MARL, we compared LToS to three methods for networked MARL, i.e., ConseNet (Zhang et al., 2018), NeurComm (Chu et al., 2020) and Intention Propagation (abbreviated as IP) (Qu et al., 2020a), and LIO  for incentivized learning, all of which use recurrent neural network (RNN) or graph neural network (GNN) for the partially observable environment (Hausknecht and Stone, 2015). More details of hyperparameters are available in Appendix D.

Prisoner
We use prisoner, a grid game version of the well-known matrix game prisoner's dilemma from Sodomka et al. (2013) to empirically demonstrate that LToS is able to learn cooperative policies to achieve the global optimum (i.e., maximize globally averaged return). As illustrated in Figure 2a, there are two agents A and B that respectively start on two sides of the middle of a grid corridor with full observation. At each timestep, each agent chooses an action left or right and moves to the corresponding adjacent grid, and every action incurs a cost −0.01. There are three goals, two goals at both ends and one in the middle. The agent gets a reward +1 for reaching the goal. The game ends once some agent reaches a goal or two agents reach different goals simultaneously. This game resembles prisoner's dilemma: going for the middle goal ("defect") will bring more rewards than the farther one on its side ("cooperate"), but if two agents both adopt that, a collision occurs and only one of the agents wins the goal with equal probability. On the contrary, both agents obtain a higher return if they both "cooperate", though it takes more steps. The highest possible return is 1. Figure 3a illustrates the learning curves of all the methods in terms of average return. Note that for all three scenarios, we present the average of 5 training runs with different random seeds by solid lines and the min/max value by shadowed areas. As a result of self-interest optimization, DQN converges to the "defect/defect" Nash equilibrium where each agent receives an expected reward about 0.5. So does DGN since it only aims to take advantage of its neighbors' observations while prisoner is a fully observable environment already. Given a hand-tuned reward shaping factor to direct agents to maximize average return, NeurComm and fixed LToS agents are able to cooperate eventually. So are ConseNet and QMIX. However, they converge slowly. In contrast, IP agents learn at a slower pace and its performance is only a little higher than 0.5. LIO agents cooperate soon enough at the beginning, but they cannot form steady cooperation and perhaps need longer training to get rid of such instability.  JointDQN, Coco-Q (Sodomka et al., 2013), and LToS perform similarly and outperform other methods. JointDQN is one centralized DQN that takes control of joint actions of both agent A and B, and thus should be able to achieve the best performance but still takes time to converge even in such a simple two-agent scenario. As a modified tabular Q-learning method, Coco-Q introduces the coco value (Kalai and Kalai, 2010) as a substitute for the expected return in the Bellman equation and regards the difference as transferred reward. However, it is specifically designed for some games, and it is hard to be extended beyond two-player games. LToS can learn the reward sharing scheme where one agent at first gives all the reward to the other so that both of them are prevented from "defect", and thus achieve the best average return quickly, as observed in the experiment. By prisoner, we verify that LToS can escape from local optimum by learning to share reward.

Jungle
Jungle is a scenario about moral dilemma proposed by Jiang et al. (2020) based on MAgent (Zheng et al., 2017). As illustrated in Figure 2b, there are N agents and L stationary foods. At each timestep, each agent can attack or move to one adjacent grid. Eating (attacking food) brings a positive reward +1, but attacking other agents obtains a higher reward +2. The victim, however, suffers a negative reward −4, which makes each attack between agents a negative-sum action. Moreover, attacking a blank grid gets a small negative reward −0.01 (inhibiting excessive attacks). We follow the original setting of Jiang et al. (2020): map size = 30 × 30 grids, N = 20, L = 12, and the observation consists of one's coordinates and a field of 11 × 11 grids nearby. Each agent has 3 closest agents as its neighbors. Compared to prisoner, jungle has much more agents, and thus JointDQN and Coco-Q are disregarded for this scenario. Another challenge of jungle is that the network topology is dynamic since each agent can always move. Fortunately, the topology change slowly and predictably, and algorithms may get the time-varying neighbor set N i as part of the input. Therefore, it is still likely to estimate the shaped rewards and value functions well.  Figure 3b illustrates the learning curves of all the methods, and their performance after convergence is also summarized in Table 1. NeurComm, ConseNet and QMIX do not perform well in this task. In NeurComm, each agent gets a "delayed global information". However, a stable pattern of delayed global information cannot be formed when the communication is conducted via a dynamic topology. ConseNet is constructed on the basis of a premise of full observation, and it can hardly learn well when the input is not only partial but also fairly varying in sequence and content. LIO agents also perform badly, since they cannot be distinguished from one another in the dynamic topology and thus fail to learn a proper incentive function. Moreover, LIO requires opponent modeling, but it is hard to simultaneously model all other agents in a dynamic environment. QMIX is free from these problems. While aiming at global optimization, like LIO, it realizes that attacking usually means a negative-sum action, but as a result, it avoids attacking as well as eating most of the time and thus only achieves a reward slightly higher than 0. Another possible reason to explain the performance QMIX is its scalability. As there are 20 agents in the scenario, it can be hard to learn the joint action-value function to directly optimize the average return (Qu et al., 2020a). Also, we can see that a fixed reward sharing scheme does not bring any gain over DGN. This is because fixed reward sharing does not adapt to the dynamic topology. By learning proper reward sharing and adjusting to changing circumstances, LToS outperforms all other baselines. Note that there is an upper bound for average reward per step for jungle. By estimating the average distance between each agent and the food that is the closest to it at the beginning of one episode, we can give a loose upper bound around 0.95 to reflect our improvement.  Figure 4 illustrates the representative behaviors of agents learned by difference methods. For NeurComm, ConseNet (and the same with LIO), most agents are not even close to the foods, so as to avoid being attacked. Even though, there are still conflict and sneak attack between agents sometimes. IP and DGN agents learn much better, but agents may still be cautious about each other, which leads to hesitation when they are near the same food. LToS agents learn to properly share the food even if the foods are close (i.e., agents are easy to be attacked) as depicted in Figure 4e and demonstrate much better cooperation than the agents learned by other methods. The experimental results in jungle verify that LToS can also adapts to considerably varying topology in networked MARL.
Besides, we compared LToS and ablation baselines (i.e., DGN and fixed LToS) with different number of agents (i.e., from 10 to 50) to verify the scalability of LToS. All the setting remains the same except that the number of agents and food grows proportionally (i.e., #agents /#foods = 5 /3). As depicted in Figure 5, LToS can always achieve the best performance as the agent population size increases. In traffic, as illustrated in Figure 2c , we aim to investigate the capability of LToS in dealing with highly dynamic environment through reward sharing. We adopt the same problem setting as Wei et al. (2019). In a road network, each agent serves as traffic signal control at an intersection. The observation of an agent consists of a one-hot representation of its current phase (directions for red/green lights) and the number of vehicles on each incoming lane of the intersection. At each timestep, an agent chooses a phase from the pre-defined phase set for the next time interval, i.e., 10 seconds. The reward is set to be the negative of the sum of the queue lengths of all approaching lanes at current timestep. The global objective is to minimize average travel time of all vehicles in the road network, which is equivalent to minimizing the sum of queue lengths of all intersections over an episode (Zheng et al., 2019). The experiment was conducted on a traffic simulator, CityFlow (Zhang et al., 2019). We use a 6 × 6 grid network with 36 intersections (agents). The traffic flows were generated to simulate dynamic traffic flows including both peak and off-peak period, and the statistics is summarized in Table 2. Figure 3c shows the learning curves of all the methods in terms of average travel time of all vehicles in logarithmic form. The performance after convergence is summarized in Table 3, where LToS outperforms all other methods. LToS outperforms DGN, which demonstrates the reward sharing scheme learned by the high-level policy indeed helps to improve the cooperation of agents. Without the high-level policy, i.e., given fixed sharing weights, fixed LToS does not perform well in dynamic environment. This indicates the necessity of the high-level policy. The performance of IP agents increases so slowly that they cannot converge efficiently. Although NeurComm and ConseNet both take advantage of RNN for partially observable environments, LToS still outperforms these methods, which verifies the great improvement of LToS in networked MARL. QMIX is confined to suboptimality (Mahajan et al., 2019). As observed in the experiment, QMIX tries to release traffic flows from one direction while stopping flows from the other direction all the time, because this will only make two rows of intersections on the border blocked but keep most of the intersections from any traffic jam all the time. However, the global optimality actually does not need to be constructed on the sacrifice of anyone. Some similar thing happens to LIO. It is likely because LIO contains some sensitive parameters  and agents are hard to learn and coordinate their incentive functions since the original reward functions change acutely once an improper operation causes traffic congestion. An introduction of some explicit coordination mechanism may also alleviate the problem, like that of NeurComm and ConseNet. We visualize the variation of selfishness of all agents during an episode in Figure 6a and 6b. Figure 6a depicts the temporal variance of selfishness for each agent. For most agents, there are two valleys occurred exactly during two peak periods (i.e., 0 − 600s and 1, 800 − 2, 400s). This is because for heavy traffic agents need to cooperate more closely, which can be induced by being less selfish. We can see this from the fact that selfishness is even lower in the second valley where the traffic is even heavier (i.e., 2 vs. 1 vehicles/s). Therefore, this demonstrates that the agents learn to adjust their extent of cooperation to deal with dynamic environment by controlling the sharing weights. Figure 6b shows the spatial pattern of selfishness at different timesteps, where the distribution of agents is the same as the road network in Figure 2c. The edge and inner agents tend to have very different selfishness. In addition, inner agents keep their selfishness more uniform during off-peak periods, while they diverge and present cross-like patterns during peak periods. This shows that handling heavier traffic requires more diverse reward sharing schemes among agents to promote more sophisticated cooperation. Note that it is very difficult to obtain an average travel time below 100 seconds since every necessary red light will take at least 10 seconds. The experimental results in traffic verify that LToS can also handle highly dynamic environment in networked MARL.

Conclusion
In this paper, we proposed LToS, a hierarchically decentralized framework for networked MARL. LToS enables agents to share reward with neighbors so as to encourage agents to cooperate on the global objective. For each agent, the high-level policy learns how to share reward with neighbors to decompose the global objective, while the low-level policy learns to optimize local objective induced by the high-level policies in the neighborhood. Experimentally, we demonstrate that LToS outperforms existing methods in both social dilemma and networked MARL scenario.

A Proofs
A.1 Proof of Proposition 4.1 Proof. Let r φ i . = a π(a|s, w)r w i and p w (s |s, w) . = a π(a|s, w)p a (s |s, a). As commonly assumed the reward is deterministic given s and a, from (3), we have, where p w ∈ P w : S × W × S → [0, 1] describes the state transitions given π.
Let r φ V . = i∈V r φ i , and from (7) we have and similarly, Moreover, from the definitions of r w i and r φ i we have Thus, given π, V φ V (s) and Q φ V (s, w) are respectively the value function and action-value function of φ in terms of the sum of expected cumulative rewards of all agents, i.e., the global objective.

A.2 Proof of Proposition 4.2
First, we introduce one definition and one lemma. Definition 1 (Markov Random Field). A Markov Random Field (MRF) is a graph G = (V, E) that satisfies: where X i is some random variable associated with node i, ∀i ∈ V. Lemma A.1 (Hammersley-Clifford Theorem). A probability distribution that has a strictly positive mass or density satisfies one of the Markov properties with respect to an undirected graph G if and only if it is a Gibbs random field, i.e., its density can be factorized over the cliques (or complete subgraphs) of the graph. (Hammersley and Clifford, 1971) Now we begin the proof of Proposition 4.2.
Proof. Let d ij ∈ D serve as a vertex with action w ij and reward w ij r i in a new graph G . Each vertex has its own local policy φ ij (w ij |s). Note that in the sense of mean-field approximation, we focus on neighbors and find a MRF: each w ij needs and only needs to be determined considering other {w ik } k∈Ni\{j} , because their actions are subject to the constraint j∈Ni w ij = 1. It accords with the adjacency relationship in G . According to Lemma A.1, it is also a Gibbs random field. Now we consider the cliques that we factor φ(w|s) over. For ∀i ∈ V, {d ij |j ∈ N i } should form a complete subgraph in G . As d ij ∈ G only connects to {d ik |k ∈ N i \{j}}, the complete subgraph is also a maximal clique. Therefore, we have φ(w|s) ≈ i∈V φ i (w out i |s), where w out i = {w ij |j ∈ N i }. Note that technically each agent i can determine {w ij |j ∈ N i } simultaneously. We allow agent i to take charge of φ i (w out i |s) as its high-level policy which is a joint policy of the complete subgraph in G , so that we can turn the view back to G from G and verify each agent's independence in the high level.
This proposition gives a factorization which is different from existing studies. First, our factorization differs from π(a|s) = Π N i=1 π(a i |s) (Zhang et al., 2018), since each agent needs to make decision considering other agents' plan. Also in contrast to Qu et al. (2020a), they parameterize intention propagation by GNN and other neural networks to factorize the joint policy thoroughly, while we accept incomplete factorization and group indecomposable cliques by each agent to form high-level policies that are also decentralized and independent of each other.

B Algorithm
We describe LToS below as Algorithm 1.
Algorithm 1 LToS 1: Initialize φ i parameterized by θ i and π i parameterized by µ i for each agent i (φ i is learned by DDPG and π i is learned by DGN, and they share the Q-network) 2: for t = 0 to T do for each agent i do 15: sample a minibatch from replay buffer exchange g in i and get gradient g out i for w out

C Discussions on Training LToS
As a hierarchically decentralized MARL framework, LToS brings some challenges for training.
Selfishness Initializer. On the basis of a straightforward idea that one should generally focus more on its own reward than that of others when optimizing its own policy, the initial output of each high-level policy network is supposed to be higher on the sharing weight of its own than others. We choose to predetermine the initial selfishness to learn the high-level policy effectively. However, with normal initializers, the output of the high-level policy network will be evenly distributed initially. Therefore, we use a special selfishness initializer for each high-level policy network instead. As we use the softmax to produce the weights, which guarantees the constraint: j∈Ni w ij = 1, ∀i ∈ V, we specially set the bias of the last fully-connected layer so that each decentralized high-level policy network tends to keep for itself the same reward proportion as the given selfishness initially. The rest of reward is still evenly distributed among neighbors. LToS learns started from such initial weights, while fixed LToS uses such weights throughout each experiment. Moreover, we use grid search to find the best selfishness for fixed LToS in traffic and jungle. For prisoner we deliberately set the selfishness to 0.5 so that fixed LToS directly optimizes the average return.
Unified Pseudo Random Number Generator. LToS is learned in a decentralized manner. This incurs some difficulty for experience replay. As each agent i needs w in i to update network weights for both high-level and low-level policies, it should sample from its buffer a batch of experiences where each sampled experience should be synchronized across the batches of all agents (i.e., the experiences should be collected at a same timestep). To handle this, all agents can simply use a unified pseudo random number generator and the same random seed.
Different Time Scales. As many hierarchical RL methods do, we can set the high-level policy to running at a slower time scale than the low-level one. Proposition 1 still holds if we expand v π i for more than one step forward. Assuming the high-level policy runs every M timesteps, we can fix w out i = w out,t+1 = · · · = w out,t+M −1 . M is referred to as action interval in Table 5. Infrequent Parameter Update with Small Learning Rate. Based on the continuity of w, a small modification of φ means a slight modification of local reward functions, and will intuitively result in an equally slight modification of the low-level value functions. This guarantees the low-level policies are highly reusable.
Unordered Output. Essentially, the output of high-level policy network is unordered and has a one-to-one match with each neighbor as input. The output of deep neural network, however, is generally ordered and has trouble in varying with the input order. To settle this, we take advantage of DGN which is insensitive of neighbor order as input. Besides, we modify the structure to make the output keep consistency with the neighbor part of input in the relative order.

D Hyperparamaters
As three experimental scenarios are quite different, we may use different hyperparamenters. Note that we also tuned the hyparameters for the baselines. Table 4 summarizes the hyperparameters of DQN, DGN that also serves as the low-level network of LToS, and IP. We choose the setting of original DGN in jungle while the setting of Wei et al. (2019) in traffic for consistency. Table 5 summarizes the hyperparameters of the high-level network of LToS, which are different from the low-level network. Table 6 summarizes the hyperparameters of NeurComm and ConseNet, which adhere to the implementation (Chu et al., 2020). In addition, for tabular Coco-Q, the step-size parameter is 0.5, and for IP, the regularizer factor is 0.2. We adopt soft update for both high-level and low-level networks and use an Ornstein-Uhlenbeck Process (abbreviated as OU) for high-level exploration.
Both fixed LToS and NeurComm exploit static reward shaping, but they adopt different reward shaping schemes which are hard to compare directly. We consider a simple indicator: Self Neighbor Ratio (SNR), the ratio of reward proportion that an agent chooses to keep for itself to that it obtains from a single neighbor. As the rest reward is evenly shared with neighbors in LToS, for each agent i, we have SNR = selfishness /1-selfishness × (|N i | − 1) for LToS, and SNR = 1 /α for NeurComm where α is the spatial discount factor. We adjust the initial selfishness and α to set the SNR of both methods at the same level for fair comparison.