S URPRISE M INIMIZING M ULTI -A GENT L EARNING WITH E NERGY - BASED M ODELS
Anonymous authors
Paper under double-blind review
A BSTRACT
Multi-Agent Reinforcement Learning (MARL) has demonstrated signiﬁcant success by virtue of collaboration across agents.
Recent work, on the other hand, introduces surprise which quantiﬁes the degree of change in an agent’s environment.
Surprise-based learning has received signiﬁcant attention in the case of single-agent entropic settings but remains an open problem for fast-paced dynamics in multi-agent scenarios.
A potential alternative to address surprise may be realized through the lens of free-energy minimization.
We explore surprise minimization in multi-agent learning by utilizing the free energy across all agents in a multiagent system.
A temporal Energy-Based Model (EBM) represents an estimate of surprise which is minimized over the joint agent distribution.
Our formulation of the EBM is theoretically akin to the minimum conjugate entropy objective and highlights suitable convergence towards minimum surprising states.
We further validate our theoretical claims in an empirical study of multi-agent tasks demanding collaboration in the presence of fast-paced dynamics. sites.google.com/view/surprise-web/
I NTRODUCTION
The rise of RL has led to an increasing interest in the study of multi-agent systems (Lowe et al., 2017;
Vinyals et al., 2019), commonly known as Multi-Agent Reinforcement Learning (MARL).
In the case of partially observable settings, MARL enables the learning of policies with centralised training and decentralised control (Kraemer & Banerjee, 2016).
This has proven to be useful for exploiting value-based methods which motivate collaboration across large number of agents.
But how do agents behave in the presence of sudden environmental changes?
Consider the problem of autonomous driving wherein a driver (agent) autonomously operates a vehicle in real-time.
The driver learns to optimize the reward function by maintaining constant speed and covering more distance in different trafﬁc conditions.
Whenever the vehicle approaches an obstacle, the driver acts to avoid it by utilizing the brake and directional steering commands.
However, due to the fast-paced dynamics of the environment, say fast-moving trafﬁc, the agent may abruptly encounter an obstacle ( a person running across the street ) which may result in a collision.
Irrespective of the optimal action ( pushing of brakes ) executed by the agent, the vehicle may fail to evade the collision as a result of the abrupt temporal change.
The above arises as a consequence of surprise , which is deﬁned as a statistical measure of uncertainty.
Surprise minimization (Berseth et al., 2019) is a recent phenomenon observed in the case of singleagent RL methods which deals with environments consisting of rapidly changing states.
In the case of model-based RL (Kaiser et al., 2019), surprise minimization is used as an effective planning tool in the agent’s model (Berseth et al., 2019) whereas in the case of model-free RL, surprise minimization is witnessed as an intrinsic motivation (Achiam & Sastry, 2017; Macedo et al., 2004) or generalization problem (Chen, 2020).
On the other hand, MARL does not account for surprise across agents as a result of which agents remain unaware of drastic changes in the environment (Macedo & Cardoso, 2005).
Thus, surprise minimization in the case of multi-agent settings requires attention from a critical standpoint.
A potential pathway to treat surprising states may be realized in light of free-energy minimization.
The free-energy principle depicts convergence to local niches and provides a general recipe for cognitive stability among agents.
Through this lens, we unify surprise with free-energy in the multi-agent setting.
We construct a temporal EBM which represents an estimate of surprise agents may face in the environment.
All agents jointly minimize this estimate utilizing temporal difference learning upon their value functions and the EBM.
Our formulation of free-energy minimization is theoretically akin to minimizing the entropy in conjugate gradient space.
This insight provides a suitable convergence result towards minimum surprising states (or niches) of the agent state distributions.
In an empirical study of multi-agent tasks which present signiﬁcant collaboration bottlenecks and fast-paced dynamics, we validate our theoretical claims and motivate the practical usage of EBMs in MARL.
R ELATED W ORK
Surprise Minimization:
Despite the recent success of value-based methods (Mnih et al., 2016;
Hessel et al., 2017) RL agents suffer from spurious state spaces and encounter sudden changes in trajectories.
Quantitatively, surprise has been studied as a measure of deviation (Berseth et al., 2019;
Chen, 2020) among states encountered by the agent during its interaction with the environment.
While exploring (Burda et al., 2019; Thrun, 1992) the environment, agents tend to have higher deviation among states which is gradually reduced by gaining a signiﬁcant understanding of state-action transitions.
In the case of model-based RL, agents can leverage spurious experiences (Berseth et al., 2019) and plan effectively for future steps.
On the other hand, in the case of model-free RL, surprise results in sample-inefﬁcient learning (Achiam & Sastry, 2017).
This is primarily addressed by making use of rigorous exploration strategies (Stadie et al., 2015; Lee et al., 2019).
High-dimensional exploration further requires extrinsic feature engineering (Kulkarni et al., 2016) and meta models (Gupta et al., 2018).
A suitable way to tackle high-dimensional dynamics is by utilizing surprise as a penalty on the reward (Chen, 2020).
This leads to improved generalization for single-agent interactions (Ren et al., 2005).
Our proposed approach is orthogonal to the aforesaid methods.
Energy-based Models: EBMs have been successfully implemented in single-agent RL methods (O’Donoghue et al., 2016; Haarnoja et al., 2017).
These typically make use of Boltzmann distributions to approximate policies (Levine & Abbeel, 2014).
Such a formulation results in the minimization of free energy within the agent.
While policy approximation depicts promise in the case of unknown dynamics, inference methods (Toussaint, 2009) play a key role in optimizing goal-oriented behavior.
A second type of usage of EBMs follows the maximization of entropy (Ziebart et al., 2008).
The maximum entropy framework (Haarnoja et al., 2018b) highlighted in Soft Q-Learning (SQL) (Haarnoja et al., 2017) allows the agent to obey a policy which maximizes its reward and entropy concurrently.
Maximization of agent’s entropy results in diverse and adaptive behaviors (Ziebart, 2010) which may be difﬁcult to accomplish using standard exploration techniques (Burda et al., 2019; Thrun, 1992).
The maximum entropy framework is akin to approximate inference in the case of policy gradient methods (Schulman et al., 2017).
Such a connection between likelihood ratio gradient techniques and energy-based formulations leads to diverse and robust policies (Haarnoja, 2018) and their hierarchical extensions (Haarnoja et al., 2018a) which preserve the lower levels of hierarchies.
In the case of
MARL, EBMs have witnessed limited applicability as a result of the increasing number of agents and complexity within each agent (Bus¸oniu et al., 2010).
While the probabilistic framework is readily transferable to opponent-aware multi-agent systems (Wen et al., 2019), cooperative settings consisting of coordination between agents require a ﬁrm formulation of energy which is scalable in the number of agents (Grau-Moya et al., 2018) and accounts for environments consisting of spurious states (Wei et al., 2018).
Our theoretical formulation is motivated by these methods in literature.
P RELIMINARIES 3. M ULTI -A GENT L EARNING
We review the cooperative MARL setup.
The problem is modeled as a Dec-Partially Observable Markov Decision Process (POMDP) (Oliehoek & Amato, 2016) deﬁned by the tuple ( S , A , r, N, P, Z, O, γ ) where the state space S and action space A are discrete, r : S ×
A → [ r min , r max ] presents the reward observed by agents a ∈ N where N is the set of all agents,
P : S × S ×
A → [0 , ∞ ) presents the unknown transition model consisting of the transition probability to the next state s (cid:48)
∈ S given the current state s ∈ S and joint action u ∈ A (a combination of each agent’s action u a ∈
A
a ) at time step t and γ is the discount factor.
We consider a partially observable setting in which each agent n draws individual observations z ∈ Z according to the observation function O ( s, u ) : S ×
A → Z .
We consider a joint policy π θ ( u | s ) as a function of model parameters θ .
Standard RL deﬁnes the agent’s objective to maximize the expected discounted reward E π θ [ (cid:80) Tt =
γ t r ( s t , u t )] as a function of the parameters θ .
The joint action-value function for agents is represented as Q ( u, s ; θ ) =
E π θ [ (cid:80) Tt =1 γ t r ( s, u ) | s = s t , u = u t ] which is the expected sum of payoffs obtained in state s upon performing action u by following the policy π θ .
We denote the optimal policy π θ ∗ ( shorthand π ∗ ) such that Q ( u, s ; θ ∗ ) ≥ Q ( u, s ; θ ) ∀ s ∈ S, u ∈ A .
In the case of multiple agents, the joint optimal policy can be expressed as the Nash Equilibrium (Nash, 1950) of the Stochastic Markov Game as π ∗ =
( π 1 , ∗ , π 2 , ∗ , ...
π N, ∗ ) such that
Q ( u a , s ; θ ∗ ) ≥ Q ( u a , s ; θ ) ∀ s ∈ S, u ∈ A, a ∈ N .
Q-Learning is an off-policy, model-free algorithm suitable for continuous and episodic tasks.
The algorithm uses semi-gradient descent to minimize the Temporal Difference (TD) error in Equation 1.
[Equation]
where y = r + γ max u (cid:48) ∈
A Q ( u (cid:48) , s [Equation] ; θ − ) is the TD target consisting of θ − as the target parameters and R denotes the replay buffer.
3. E NERGY - BASED M ODELS
EBMs (LeCun et al., 2006; 2007) have been successfully applied in the ﬁeld of machine learning (Teh et al., 2003) and probabilistic inference (MacKay, 2002).
A typical EBM E formulates the equilibrium probabilities (Sallans & Hinton, 2004) P ( v, h ) =
exp( −E ( v,h ))
(cid:80) ˆ v, ˆ h
[exp( −E (ˆ v, ˆ h ))] via a Boltzmann distribution (Levine & Abbeel, 2014) where v and h are the values of the visible and hidden variables and ˆ v
and ˆ h are all the possible conﬁgurations of the visible and hidden variables respectively.
The probability distribution over all the visible variables can be obtained by summing over all possible conﬁgurations of the hidden variables.
This is mathematically expressed in Equation 2.
[Equation]
Here, E ( v, h ) is called the equilibrium free energy which is the minimum of the variational free energy and (cid:80) ˆ v, ˆ h exp ( −E (ˆ v, ˆ h )) is the partition function.
E NERGY - BASED S URPRISE M INIMIZATION
We begin by constructing surprise minimization as an energy-based problem in the temporal setting.
The motivation behind an energy-based formulation stems from rapidly changing states as an undesired niche among agents in the case of partially-observed settings.
To steer agents away from this niche, we further construct a method which incorporates the theoretical aspect of the study.
4. T HE S URPRISE M INIMIZATION O BJECTIVE
To make analysis tractable towards valid function spaces and surprising states, we take into account two assumptions which form the central basis of surprise minimization among multiple agents.
Assumption 1.
(Completeness of value function space)
The space Π : S ×
A of all Q value functions Q ( s, u ) ∈ Π , ∀ s ∈ S , ∀ u ∈
A is a nonempty complete metric space.
Assumption 1 restricts the formulation of individual agent value functions Q a to the nonempty complete metric space.
A nonempty space conﬁrms the presence of candidate functions Q a upper bounded by the optimal function Q ∗ , i.e.- Q a ≤ Q ∗ , ∀ a ∈ N (Bertsekas & Tsitsiklis, 1995).
The completeness counterpart, on the other hand, provisions a ﬁxed interior int Π for optimization (Boyd & Vandenberghe, 2004).
Assumption 2.
(Constant surprise at Equilibrium)
In the limit of convergence lim π a → π ∗ to an optimal policy π ∗ , all agents a ∈ N incur a ﬁnite surprise ζ > 0 between consecutive states s and s (cid:48) until termination state s T .
Assumption 2 is directly based on the constant and continuous temporal aspect of surprise minimization (Schwartenbeck et al., 2013; Friston, 2010).
Corresponding to the lifetime of each agent a ∈ N , a desired ecological niche bakes in the optimal distribution of actions which correspond to minimum yet ﬁnite instantaneous surprise.
We formulate the energy-based objective consisting of surprise as a function of states s , joint actions u and standard deviation σ of observations for each agent a .
In the case of high-dimensional state spaces (such as multiple opponents), σ informs agents of the abrupt statistical change that would take place upon executing action u .
We formulate surprise as T V a surp ( s, u, σ ) which serves as an uncertainty quantiﬁer Unc(s,a) of the state-action distribution.
Here V a surp ( s, u, σ ) denotes the surprise value function which serves as a mapping from agent and environment dynamics to surprise.
Deﬁne an operator presented in Equation 3 which sums surprising conﬁgurations across all agents.
[Equation]
Remark 1.
T V a surp ( s, u, σ ) intuitively provides a global estimate of surprise.
If all agents are equally likely to face a surprising state, then T V a surp ( s, u, σ ) captures their individual contributions.
The formulation makes use of the soft-maximum operator (Asadi & Littman, 2017).
The operator
T V a surp ( s, u, σ ) is similar to prior energy formulations (Haarnoja et al., 2017) where the energy across different actions is evaluated.
In our case, inference is carried out across all agents with actions as prior variables.
However, in the special case of using an EBM as a Q -function, our approach suitable generalizes to the above methods (details in Appendix B).
Our choice of T V a surp ( s, u, σ ) is based on its unique mathematical properties which result in better convergence.
Of these properties, the most useful result is that T forms a contraction on the surprise value function V a surp ( s, u, σ ) indicating a guaranteed minimization of surprise within agents.
This is formally stated in Theorem 1 while utilizing the completeness criterion of Assumption 1 which provides a tractable value function space.
All proofs are deferred to Appendix A.
Theorem 1.
Given a surprise value function V a surp ( s, u, σ ) ∀ a ∈ N , the energy operator
T V a surp ( s, u, [Equation]
= log (cid:80)
Na = [Equation] exp ( V a surp ( s, u, σ )) forms a contraction on V a surp ( s, u, σ ) .
Theorem 1 provides a suitable guarantee of T V a surp ( s, u, σ ) converging to a ﬁxed point niche.
The contraction result is directly based on Banach’s ﬁxed point property and suggests the generalization of convergence in any nonempty complete metric space ( X, d ) (Bertsekas & Tsitsiklis, 1995).
We now consider a weighted combination of Q ( s, u ) with T V a surp ( s, u, σ ) wherein we denote β as a temperature parameter, ˆ Q ( u, s ; θ ) =
[Equation]
Remark 2.
Equation 4 is an instance of value function regularization wherein the Q values are subject to a joint penalty while observing surprising states.
Interestingly, upon considering the Legendre transform f ∗ ( x ) (Boyd & Vandenberghe, 2004; Gao &
Pavel, 2017)
(convex conjugate function corresponding to the conjugate space X of a differentiable function f
(z) ) of T V a surp ( s, u, σ ) , we obtain the following,
[Equation]
Remark 3.
The Legendre Transform of T V a surp ( s, u, σ ) given by f ∗ ( x ) =
(cid:80) x x log( x ) when utilized as value function regularization ˆ Q = Q − f ∗ ( x ) corresponds to the minimum entropy formulation in conjugate space E π θ (cid:104)(cid:80)
{+Tt =
 γ t ( r ( s t , u t ) − λ H ( x )) (cid:105) for x = ∇ z f (z) ∈ X .+}
high low
Based on the above insight, minimizing entropy to express ∇ z f ( z ) in conjugate space is akin to minimizing uncertainty among all agents in the value function space Π .
Intuitively, H ( x ) denotes the uncertainty for each agent a ∈ N in the multi-agent population which is directly related to its ability of efﬁcaciously interpreting the environment.
Minimizing H ( x ) leads to an increase in the expressiveness of value function.
This in turn, induces an expressive state visitation distribution which steers the agent away from sudden changes in its environment.
Note that the setting does not minimize entropy in value function space which would stand contrary to the maximum entropy formulation Haarnoja et al.
(2018b) (see Appendix B)
Figure 1 presents an intuitive illustration of the objective.
The joint agent population aims to minimize surprise corresponding to minimum energy conﬁgurations.
Agents collaborate in partially-observed worlds to attain a joint niche.
This local niche implicitly corresponds to a ﬁxed point of
T V a surp ( s, u, σ ) on the energy landscape.
Note that agents act locally with actions conditioned on their own action observation histories.
It is by virtue of preconditioned values estimations that the surprise minimization scheme informs agents of joint surprise.
Upon population’s convergence to a suitable conﬁguration, agents continue to experience minimum (yet ﬁnite) surprise arising from evironment dynamics.
4. S URPRISE M INIMIZATION WITH F UNCTION A PPROXIMATION
We utilize the above insights as surprise-based regularization in the TD learning setting.
Upon replacing Q ( u, s ; θ ) with ˆ Q ( u, s, ; θ ) in the RL construction of Equation 1 one obtains the following,
[Equation]
where ˆ y = r
+ γ max u (cid:48) Q ( u (cid:48) , s (cid:48) ; θ − )
+ β log (cid:80)
Na =1 exp ( V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) )) .
Collecting the log terms yields the following,
[Equation]
Here, E is deﬁned as the surprise ratio .
The surprise value function V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ) is expressed as the negative free energy and (cid:80) Na =1 exp
( V a surp ( s, u, σ )) as the partition function of a conventional
EBM described in Equation 2.
Alternatively, V a surp ( s, u, σ ) can be formulated as the negative free energy with (cid:80) Na =1 exp ( V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) )) as the partition function.
The TD objective incorporates the minimization of surprise across all agents as minimizing the energy in spurious states.
Remark 4.
The above formulation of βE can be realized as intrinsic motivation steering the agent towards subgoals with reduced surprise.
The energy formulation E provides a tractable distribution over all surprising conﬁgurations in the state space S .
This guarantees convergence to minimum surprise at optimal policy π ∗ and is formally expressed in Theorem 2 (see Appendix C for a detailed convergence analysis).
Theorem 2.
Upon agent’s convergence to an optimal policy π ∗ , total energy of π ∗ , expressed by E ∗ will reach a thermal equilibrium consisting of minimum surprise among consecutive states s and s (cid:48) .
Theorem 2 demonstrates an intuitive convergence result of agent populations collaborating to reside in a mutual ecological niche (Friston, 2010).
The multi-agent population with minimum surprise exhibits the optimal policy π ∗ which results in minimum energy corresponding to each surprising state in the state distribution S .
Orthogonally, agents may continue to experience ﬁnite and constant surprise in the long-horizon while acting optimally to visit non-surprising and rewarding states.
This presents surprise minimization as a secondary surrogate objective in MARL.
4. E NERGY - BASED MIX ER (EMIX)
Based on our theoretical analysis, we incorporate learning of surprise as global intrinsic motivation across all agents in the multi-agent system.
A global estimate of surprise, following the energy operator T V a surp ( s, u, σ ) , is beﬁtting from a computational perspective as well.
An individual estimate of surprise for each agent may be intractable to obtain due to the non-stationarity of the environment.
Instead, we seek to minimize surprise jointly across all agents using an expressive
Energy-based MIXer (EMIX) architecture which is compatible with any multi-agent RL algorithm.
Figure 2 illustrates our learning scheme.
Learning of surprise in the high-dimensional value function space is cumbersome with the number of actions scaling linearly in the number of agents.
This imposes an inherent restriction to learn global surprise efﬁcaciously across all agents at a given timestep.
Towards this goal, EMIX encodes individual value functions Q 1 , Q 2 , ...
Q n corresponding to each agent using local value encoders.
These encoders capture the local change in value functions arising over subsequent TD learning iterations (Wang et al., 2021).
A global state encoder maps environment states s 1 , s 2 , ...
s T to a low dimensional representation.
Further, a state deviation encoder encodes deviations across all states s 1 , s 2 , ...
s T within the given batch.
Akin to a model-based method (Janner et al., 2019), the state deviation encoder accounts for uncertainty in an agent’s state visitation distribution.
Note that the encoder does not construct an explicit model of states, but only represents their variation in the agent’s environment.
This insight is essential to account for abrupt dynamics encountered by agents.
Representations obtained from state and value function encoders are concatenated and compressed using a ﬁnal surprise encoder which estimates a distribution of surprise values.
The distribution implicitly represents the density of states wherein an agent may encounter most surprise.
A value estimate V a surp ( s, u, σ ) sampled from the surprise distribution depicts the variational free energy conﬁguration upon application of T which serves as global intrinsic motivation.
Practical training of EMIX proceeds with backpropagation (Rumelhart et al., 1986) using gradient descent and the reparameterization trick (Kingma & Welling, 2014) for sampling of V a surp ( s, u, σ ) .
4. P RACTICAL I MPLEMENTATION
do 4: u ←− ( u 1 , u 2 ..., u N ) 5:
R ←− R ∪ { ( s, u, r, s (cid:48) ) } 6: if |R| > batch-size then 7: for random batch do 8:
Q θtot ←− Mixer-Network ( Q 1 , Q 2 ..., Q N , s ) 9:
Q θ − i ←− Target-Mixer i
( Q 1 , Q 2 ..., Q N , s (cid:48) ), ∀ i
= 1 , 2 .., m 10:
Calculate σ and σ (cid:48) using s and s (cid:48) 11:
V a surp ( s, u, σ ) ←− Surprise-Mixer( s, u, σ ) 12:
V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) )
←− Target-Surprise-Mixer( s (cid:48) , u (cid:48) , σ (cid:48) ) 13:
E ←− log (cid:18) (cid:80) Na =1 exp( V a surp ( s (cid:48) ,u (cid:48) ,σ (cid:48) ))
(cid:80)
Na =1 exp( V a surp ( s,u,σ ))
(cid:19) 14:
Calculate L ( θ ) using E in Equation15:
θ ←− θ − α ∇ θ L ( θ ) 16: end for 17: end if 18: if update-interval steps have passed then 19: θ − i ←− θ, ∀ i = 1 , 2 .., m 20: end if 21: end for
Algorithm 1 presents the EMIX framework (in green) combined with QMIX Rashid et al.
, an off-the-shelf MARL algorithm.
The total Q -value Q θtot is computed by the mixer network with its inputs as the Q -values of all the agents conditioned on s via the hypernetworks.
Similarly, the target mixers approximate Q θ − i conditioned on s (cid:48) .
In order to evaluate surprise within agents, we compute the standard deviations σ and σ (cid:48) across all observations z and z (cid:48) for each agent using s and s (cid:48) respectively.
The surprise value function, called the Surprise-Mixer, estimates surprise V a surp ( s, u, σ ) conditioned on s , u and σ .
The same computation is repeated using the Target-Surprise-Mixer for estimating surprise V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ) within next-states in the batch.
Application of the energy operator along the non-singleton agent dimension for V a surp ( s, u, σ ) and V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ) yields the energy ratio E which is used in Equation 7 to evaluate L ( θ ) .
We then use batch gradient descent to update parameters of the mixer θ .
Target parameters θ − i are updated every update − interval steps.
E XPERIMENTS
Our experiments aim to evaluate the theoretical claims presented by EMIX along with its performance to prior MARL methods.
Speciﬁcally, we aim to answer the following questions- (1) How does the provision of an EBM for surprise minimization compare to current MARL methods?, and (2) Does the algorithm validate the theoretical claims corresponding to its components?
5. E NERGY - BASED S URPRISE M INIMIZATION
We assess the validity of EMIX, when combined with QMIX, on multi-agent StarCraft II micromanagement scenarios (Samvelyan et al., 2019) as these consist of a larger number of agents with different action spaces.
This in turn motivates a greater deal of coordination.
Additionally, micromanagement scenarios in StarCraft II consist of multiple opponents which introduce a greater degree of surprise within consecutive states.
We compare our method to prior methods namely; (1) QMIX (Rashid et al., 2018), constituting of nonlinear value function factorization with monotonicity constraints; (2) Value Decomposition
Networks (VDN) (Sunehag et al., 2018), consisting of linear additive factorization of Q function; (3) Counterfactual Multi-Agent Policy Gradients (COMA) (Foerster et al., 2017), which consist of
[Table]
counterfactual actor-critic updates in a centralized critic; and (4) Independent Q Learning (IQL) (Tan, 1993), wherein each agent acts independent of other agents.
In order to compare our surprise minimization scheme against pre-existing mechanisms, we compare EMIX additionally to a model-free implementation of SMiRL (Berseth et al., 2019) in QMIX.
We use the generalized version of SMiRL as it demonstrates reduced variance across batches (Chen, 2020).
This implementation is denoted as SMiRL-QMIX for comparisons.
Details related to the implementation of EMIX are presented in Appendix D.
Table 1 presents the comparison of success rate percentages between EMIX and prior MARL algorithms on 12 StarCraft II micromanagement scenarios.
Corresponding to each scenario, algorithms demonstrating higher success rate values in comparison to other methods have their entries highlighted in bold .
Out of the 12 scenarios considered, EMIX presents higher success rates on 9 of these scenarios depicting the suitability of the proposed approach.
In cases of so many baneling and 5m vs 6m having large number of opponents and a greater level of surprise, EMIX aptly improves over prior methods.
When compared to QMIX, EMIX depicts improved success rates on all of the 12 scenarios.
On comparing EMIX with SMiRL-QMIX, we note that EMIX demonstrates a higher average success rate.
This highlights the suitability of the energy-based scheme in the case of a larger number of agents and complex environment dynamics for surprise minimization.
5. A BLATION S TUDY
We now present the ablation study for the various components of EMIX.
Our experiments aim to determine the effectiveness of the energy-based surprise minimization method.
Additionally, we also aim to evaluate the utility of dual approximators for surprise estimation in accordance with the precept from RL literature (Hasselt et al., 2016; Fujimoto et al., 2018; Haarnoja et al., 2018b).
5.2. EMIX O BJECTIVE
To weigh the effectiveness of energybased scheme, we ablate the energy operator T and only utilize V a surp .
Since this implementation employs dual approximators V a surp , ( i ) i ∈ { 1 , 2 } for stability, we call this implementation as
TwinQMIX.
Thus, we compare between
QMIX, TwinQMIX and EMIX to assess the contributions of each of the proposed methods.
Figure 3 presents the comparison of average success rates for QMIX, TwinQMIX and EMIX on 3 different scenarios.
Agents were evaluated for a total of 2 million timesteps with the lines in the plot indicating average success rates and the shaded area as the deviation across 5 random seeds.
In comparison to QMIX, TwinQMIX adds stability to the original objective by incorporating surprising estimates in the initial QMIX objective.
On comparing TwinQMIX to EMIX we note that dual approximators play little role in improving convergence.
Thus, the energy-based surprise minimization scheme is the main facet for signiﬁcant performance improvement in the modiﬁed EMIX objective.
This is demonstrated in the 5m vs 6m scenario wherein the EMIX implementation improves the performance of TwinQMIX in comparison to QMIX by utilizing a surprise-robust policy.
In the case of so many baneling scenario which consists of a large number of opponents (27 banelings), EMIX tackles surprise effectively by preventing a signiﬁcant drop in performance which is observed in cases of QMIX and TwinQMIX.
We conjecture that this is a direct consequence of underestimations arising from V a surp , ( i ) estimates.
5.2. S URPRISE M INIMIZATION WITH T EMPERATURE
The importance of β can be validated by assessing its usage in surprise minimization.
However, it is difﬁcult to evaluate surprise minimization directly as surprise value function estimates V a surp ( s, u, σ ) vary from state-to-state across different agents and thus, they present high variance during agent’s learning.
We instead observe the variation of E as it is a collection of surprise-based sample estimates across the batch.
Additionally, E consists of prior samples V a surp ( s, u, σ ) for V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ) which makes inference across different agents tractable.
Figure 4 presents the variation of Energy ratio E with the temperature parameter β during learning.
We compare two stable variations of E at β = 0 .
001 and β = 0 .
The objective minimizes
E over the course of learning and attains thermal equilibrium with minimum energy.
Intuitively, equilibrium corresponds to convergence to optimal policy π ∗ which validates the claim in Theorem 2.
With β = 0 .
01 , EMIX presents improved convergence and surprise minimization for 5 out of theconsidered scenarios, hence validating the suitable choice of β .
On the other hand, a lower value of β = 0 .
001 does little to minimize surprise across agents.
D ISCUSSION
In this paper, we presented an energy-based perspective towards surprise minimization in multiagent RL.
Towards this goal we introduce EMIX, an energy-based intrinsic motivation framework for surprise minimization in MARL algorithms.
EMIX utilizes a temporal EBM to estimate and minimize surprise jointly across all agents.
Our theoretical claims on the formulation of minimization of temporal energy with surprise are corroborated upon utilizing EMIX on a suite of challenging
MARL tasks requiring signiﬁcant collaboration under fast-paced dynamics.
While EMIX serves as a practical example of EBMs in cooperative MARL, it presents several new avenues for future work.
We shed light on 3 such aspects,
(1) Provision of an energy-based model naturally raises the question of how can we efﬁciently sample from the surprise distribution?
Advances in sampling methods depict promise towards this aspect.
Although suitable for lower dimensions, the scalability of EBMs towards high dimensional action spaces remains an open question.
We conjecture that the utility of density-based methods and generative models can address the scalability gap.
(3) Lastly, the extension of an EBM framework to opponent-aware and competitive MARL settings presents a suitable tangent for learning multi-agent roles.
Provision of an EBM for learning minimum energy role conﬁgurations would do away with the need for multi-stage training and complex exploration strategies.
We leave the aforesaid as potential directions for future work
A P ROOFS
Theorem 1.
Given a surprise value function V a surp ( s, u, σ ) ∀ a ∈ N , the energy operator
T V a surp ( s, u, σ )
= log (cid:80)
Na =1 exp ( V a surp ( s, u, σ )) forms a contraction on V a surp ( s, u, σ ) .
Proof.
We follow the process of (Asadi & Littman, 2017).
Let us ﬁrst deﬁne a norm on surprise values
|| V 1 − V 2 || ≡ max s,u,σ | V 1 ( s, u, σ ) − V 2 ( s, u, σ ) | .
Suppose (cid:15) =
||
V 1 − V 2 || , log
N (cid:88) a = exp ( V 1 ( s, u, σ )) ≤ log
N (cid:88) a = exp ( V 2 ( s, u, σ ) + (cid:15) )
= log
N (cid:88) a = exp ( V 1 ( s, u, σ )) ≤ log exp ( (cid:15) )
N (cid:88) a = exp ( V 2 ( s, u, σ )) = log
N (cid:88) a = exp ( V 1 ( s, u, σ )) ≤ (cid:15) + log
N (cid:88) a = exp ( V 2 ( s, u, σ )) = log
N (cid:88) a = exp ( V 1 ( s, u, σ ))
− log
N (cid:88) a = exp ( V 2 ( s, u, σ )) ≤ || V 1 − V
|| (8)
Similarly, using (cid:15) with log (cid:80) Na =1 exp ( V 1 ( s, u, σ )) , log
N (cid:88) a = exp ( V 1 ( s, u, σ ) + (cid:15) ) ≥ log
N (cid:88)
[Equation]
Results in Equation 8 and Equation 9 prove that the energy operation is a contraction.
Theorem 2.
Upon agent’s convergence to an optimal policy π ∗ , total energy of π ∗ , expressed by E ∗ will reach a thermal equilibrium consisting of minimum surprise among consecutive states s and s (cid:48) .
Proof.
We begin by initializing a set of M policies { π 1 , π 2 ..., π M } having energy ratios { E 1 , E 2 ..., E M } .
Consider a policy π 1 with surprise value function V 1 .
E 1 can then be expressed as
[Equation]
Invoking Assumption 2 for s and s (cid:48) , we can express V a 1 ( s (cid:48) , u (cid:48) , σ (cid:48) )
=
V a 1 ( s, u, σ ) + ζ 1 where ζ 1 is a constant.
Using this expression in E 1 we get,
[Equation]
Similarly, E 2 = ζ 2 , E 3 = ζ 3 ..., E M = ζ M .
Thus, the energy residing in policy π is proportional to the surprise between consecutive states s and s (cid:48) .
Clearly, an optimal policy π ∗ is the one with minimum surprise.
Mathematically,
[Equation]
Thus, proving that the optimal policy consists of minimum surprise at thermal equilibrium.
B R ELATION TO M AXIMUM E NTROPY F RAMEWORK B. S IMILARITIES & D IFFERENCES
We conceptually compare EMIX to the maximum entropy framework.
Similarities: Both methods utilize an auxilary objective as intrinsic motivation to tackle uncertainty.
While the maximum entropy formulation assigns low energy to uncertain actions, our method assigns low energy to uncertain encoded representations od states (as presented in Fig. 2).
Differences: Our method differs from maximum entropy in its optimization process and learning scheme.
The maximum entropy formulation aims to maximize entropy in the value function space so as to motivate exploration.
Our proposed scheme, on the other hand, aims to minimize surprise in the low-dimensional representation space to obtain dynamics-aware robust policies.
B. C ONNECTION TO S OFT Q-L EARNING
The Soft Q-Learning objective with V θ − soft ( s (cid:48) ) and Q soft ( u, s ; θ ) as state and action value functions respectively is given by-
[Equation]
The gradient of this objective can be expressed as-
[Equation]
And the gradient of the EMIX objective is obtained as-
[Equation]
Comparing Equation 10 to Equation 11 we notice that Soft Q-Learning and EMIX are related to each other as they utilize EBMs.
Soft Q-Learning makes use of a discounted energy function which downweights the energy values over longer horizons.
Actions consisting of lower energy conﬁgurations are given preference by making use of Q soft ( u, s ; θ ) as the negative energy.
On the other hand, EMIX makes use of a constant energy function weighed by β which minimizes surprise-based energy between consecutive states.
Both the objectives can be thought of as energy minimizing models which search for an optimal energy conﬁguration.
Soft Q-Learning searches for an optimal conﬁguration in the action space whereas EMIX favours optimal behavior on spurious states.
In fact, EMIX can be realized as a special case of Soft Q-Learning if the mixer agent utilizes an energy-based policy and attains thermal equilibrium.
This leads us to express Theorem 3.
Theorem 3.
Given an energy-based policy π with its target function V ( s (cid:48) )
[Equation]
log (cid:80) u ∈
A exp Q ( u (cid:48) , s (cid:48) ; θ − ) , the surprise minimization objective L ( θ ) reduces to the Soft QLearning objective L ( θ soft ) in the special case surprise absent between consecutive states,
[Equation]
Proof.
We know that the EMIX objective is given by-
[Equation]
Replacing the greedy policy term max u (cid:48) Q ( u (cid:48) , s (cid:48) ; θ − ) with the energy-based value function V ( s (cid:48) )
= log (cid:80) u (cid:48)
∈
A exp Q ( u (cid:48) , s (cid:48) ; θ − ) , we get,
L ( θ ) =
E s,u,s (cid:48) ∼ R   1(cid:32) r + γ E s (cid:48) ∼ R
[ V ( s (cid:48) )]
+ β log (cid:32)(cid:80)
Na =1 exp ( V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ))
(cid:80) Na =1 exp ( V a surp ( s, u, σ )) (cid:33) − Q ( u, s ; θ ) (cid:33) 2   (13) =
L ( θ ) =
E s,u,s (cid:48) ∼ R (cid:34) (cid:32) r + γ E s (cid:48) ∼ R (cid:20) log (cid:88) u (cid:48) ∈
A exp Q ( u (cid:48) , s (cid:48) ;
θ − ) (cid:21) + β log (cid:18)(cid:80)
Na =1 exp ( V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ))
(cid:80) Na =1 exp ( V a surp ( s, u, σ ))
(cid:19) − Q ( u, s ; θ ) (cid:33) 2 (cid:35)
At thermal equilibrium, (cid:80) Na =1 exp ( V a surp ( s, u, σ ))
= (cid:80) Na =1 exp ( V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) )) , =
L ( θ ) =
E s,u,s (cid:48) ∼ R (cid:34) (cid:32) r + γ E s (cid:48) ∼ R (cid:20) log (cid:88) u (cid:48)
[Equation]
A exp Q ( u (cid:48) , s
[Equation]
) (cid:21) +
[Equation]
log (cid:18)(cid:80)
Na =1 exp ( V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ))
(cid:80) Na =1 exp ( V a surp ( s (cid:48) , u (cid:48) , σ (cid:48) ))
(cid:19) − Q ( u, s ; θ ) (cid:33) 2 (cid:35) =
L ( θ ) =
E s,u,s (cid:48) ∼ R 
[Equation] [Equation]
(cid:32) r +
[Equation]
E s (cid:48) ∼ R (cid:34) log (cid:88) u (cid:48) ∈
A exp Q ( u (cid:48) , s (cid:48) ;
θ − ) (cid:35) + β log(1) − Q ( u, s ; θ ) (cid:33) 2   (14) =
L ( θ ) =
E s,u,s (cid:48) ∼ R
[Equation]
(cid:32)
[Equation]
+
[Equation]
E s (cid:48) ∼ R (cid:34) log (cid:88) u (cid:48) ∈
A exp Q ( u (cid:48) , s (cid:48) ;
θ − ) (cid:35) − Q ( u, s ; θ ) (cid:33) 2   (15)
Equation 15 represents the Soft Q-Learning objective, hence proving the result.
C C ONVERGENCE A NALYSIS
We now analyze convergence of the surprise minimization scheme during policy optimization.
For brevity, our notation denotes the modiﬁed Bellman operator as B obeying the standard assumptions of monotonicity and contraction (Bertsekas, 2018).
Additionally, we consider the cumulative value ˆ V k
= r k + G k + β log (cid:80)
Na =1 exp( V a surp , ( k ) ( s, u, σ )) as the sum of state values
V k
= r k + G k and surprise energy values β log (cid:80) Na =1 exp( V a surp , ( k ) ( s, u, σ )) at k th Bellman update.
[Equation]
[Table]
optimal value
[Table]
convergence
[Table]
[Equation]
Thus
[Equation]
for k iterations
[Equation]
we have,
[Equation]
We now absorb the sum of surprise values from time index i = 1 , .., k in a single variable V a tot .
Thus, using V a tot = (cid:80) ki =1 V a surp , ( i ) and utilizing the Triangle Inequality, we get,
[Equation]
We now bound the two terms separately.
Considering the ﬁrst term and following the results of value iteration convergence (Bertsekas & Tsitsiklis, 1995),
[Equation]
wherein V µ denotes an approximation to V .
Utilizing the triangle inequality yields,
[Equation]
The two terms are bounded using the convergence result of (Bertsekas, 2018).
[Equation] [Equation]
Now, considering the second term in Equation 23,
[Equation]
using the triangle inequality,
[Equation]
Since T = log (cid:80) Na =1 exp( V a tot ) is a contraction following Theorem
[Equation]
for the ﬁrst term we have,
[Equation]
The second term in the above relation is bounded due to the completeness assumption,
[Equation]
Finally, combining Equation 27 and Equation 32 in Equation 23, we obtain the desired convergence bound.
[Equation]
While the ﬁrst term in Equation 33 denotes the convergence of policy optimization, the second term indicates the bounded convergence of surprise to ecological niches with ﬁnite (yet nonzero) surprising elements.
The policy optimization process converges at a geometric rate O ( γ k ) towards its stable ﬁxed points.
The surprise minimization process, on the other hand, demonstrates an annealing behavior which depends on the temperature parameter β .
Furthermore, convergence to stable ﬁxed point V a tot is bounded in respect to each agents individual surprise values V a tot .
This insight indicates that different agents converge towards different locally optimal values of surprise.
Finally, the presence of constant ζ corroborates prior claims (Schwartenbeck et al., 2013; Friston, 2010) that agents continue to experience surprise irrespective of their convergence to minimum energy niches.
To further develop intuition for this claim, consider the special case wherein (cid:13)(cid:13)(cid:13)(cid:13)
V
[Equation]
tot − V
[Equation]
tot
[Equation]
→ 0 .
Irrespective of global convergence among all agents, a ﬁnite yet small ζ continues to contribute to the upper bound of (cid:13)(cid:13)(cid:13)(cid:13)
V k
[Equation]
Role of β : We further discuss the role of β which is of balancing the terms at successive iterations.
While the ﬁrst term geometrically decays with O ( γ k ) rate, the second term approaches a ﬁnite constant βζ as V atot → V ∗ tot .
Irrespective of our choice of β , the LHS (cid:107) V k − V ∗ (cid:107) 2 is upper bounded by a constant which validates the claims of minimum yet ﬁnite surprise values.
We do note that a small β is still desirable to remove any approximation errors in order to push V k
→ V ∗ .
However, this comes at the cost of increased surprise if β is not selected appropriately.
D I MPLEMENTATION D ETAILS D. M ODEL S PECIFICATIONS
Architecture:
This section highlights model architecture for the surprise value function.
At the lower level, the architecture consists of 3 independent networks called state net , q net and surp net .
Each of these networks consist of a single layer of 256 units with ReLU non-linearity as activations.
Similar to the mixer-network, we use the ReLU non-linearity in order to provide monotonicity constraints across agents.
Using a modular architecture in combination with independent networks leads to a richer extraction of joint latent transition space.
Outputs from each of the networks are concatenated and are provided as input to the main net consisting of 256 units with ReLU activations.
The main net yields a single output as the surprise value V a surp ( s, u, σ ) which is reduced along the agent dimension by the energy operator.
Alternatively, deeper versions of networks can be used in order to make the extracted embeddings increasingly expressive.
However, increasing the number of layers does little in comparison to additional computational expense.
Computation of σ : The deviation σ corresponds to the standard deviation across each dimension of the state s .
Considering the state as a tensor of size B ×
A × M with B as the batch size, A as the number of agents and M as the observation dimension, we compute σ by calculating the standard deviation across the M dimension.
This yields σ as a B × A × 1 dimensional array.
Computation of surprise estimates: V surp denotes the surprise value function which quantiﬁes the amount of surprise experienced by agents.
Analogous to a Q value function which provides estimates of returns, V surp provides estimate of surprise.
Our framework learns V surp much like any other value function (using a neural network), but by additionally undergoing a log (cid:80) exp transformation to obey the ﬁxed point property.
This is achieved by realizing log-sum-exp as an energy operator
T = log (cid:80) exp which can be computed using standard computation libraries.
Since our code is implemented in PyTorch, we implement this as T_V = torch.logsumexp(V_surp, dim=1) .
D. H YPERPARAMETERS
Table 2 presents hyperparameter values for EMIX.
A total of 2 target Q -functions were used as the model is found to be robust to any greater values.
[Table]
D. S ELECTION & T UNING OF β
One can manually tune β using a ﬁne-grained hyperparameter search.
We tune β between 0.001 and 1 in intervals of 0.01 with best performance observed at β = 0 .
However, we ﬁnd two additional methods helpful for obtaining more accurate values.
These are described as followsArmijo’s Line Search: One can borrow from optimization theory and utilize Armijo’s line search
Nocedal & Wright (2006) by setting a termination condition.
The method starts with a constant value of β which is iteratively incremented/decremented until a termination criterion (example- (cid:107)∇ L ( θ ) (cid:107) < (cid:15) with (cid:15) a constant) is reached.
While line search is proven to converge towards globally optimal values, its O ( n 2 ) convergence may be computationally expensive that too in the MARL setting.
Thus, we turn to the more efﬁcient automatic tuning.
α ∗ β ∗ ∇ EMIX
Q
T T V a end
Automatic Tuning: We choose to automatically tune β following single-agent RL literature Haarnoja et al.
(2018b)
; Kumar et al.
This is achieved by treating β as a parameter and adaptively optimizing over it using Adam.
We treat a surprise value of 0 as our target value.
The method works well in practice and provides β values closer to 0 .
01 (our manual selection).
E A DDITIONAL R ESULTS E. Q UALITATIVE A NALYSIS
We visualize and compare behaviors learned by surprise minimizing agents to the prior method of
QMIX.
Fig.
5 presents the comparison of EMIX and QMIX agent trajectories (in yellow arrows) on the challenging so many baneling task.
The task consists of 27 baneling opponents which rapidly attack the agent team on a bridge.
QMIX agents naively move to the central alley of the bridge and start attacking enemies early on.
While QMIX agents naively maximize returns, EMIX agents learn a different strategy.
EMIX agents rearrange themselves ﬁrst at the corners of the bridge.
Note that these corners provide cover from enemy’s ﬁre.
Thus, EMIX agents learn to take cover before approaching the enemy head-on.
This indicates that the surprise-robust policy is aware of the incoming fast-paced assault.
As another example, Fig. 6 presents behaviors on the 2s vs 1sc task wherein two agents must collaborate together to defeat a SpineCrawler enemy.
The enemy, having a long tentacle, chooses to attack any one of the agents randomly .
This indicates that the agents face a greater degree of surprise with no prior knowledge of the enemy’s movement.
We observe that QMIX agents take turns to attack the enemy by moving back and forth to minimize damage.
EMIX agents, on the other hand, learn a different strategy.
One of the EMIX agents stands at a distance to attack th enemy while the other agent goes around to attack from behind.
This indicates that the policy is aware of enemy’s limited movement.
E. S TATISTICAL S IGNIFICANCE
We follow the recommendation of Lones (2021) and evaluate the statistical signiﬁcance of our results by carrying out the Mann-Whitney U test Mann & Whitney (1947).
All 5 seeds of an algorithm
Scenarios
EMIX
SMiRL-QMIX
QMIX
VDN
COMA
IQL
[Table]
-   2s3z  -
[Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
-   10m
[Table]
-   so many baneling  -
[Table]
(on each task) are compared to that of QMIX to yield the U statistic.
U here denotes the statistical signiﬁcance of performance with higher values being desirable.
Table 3 presents the comparison of U statistic on the StartCraft II benchmark.
EMIX demonstrates consistently high values of U across a diverse set of tasks when compared to SMiRL and prior MARL agents.
This highlights the consistent surprise-minimizing performance of EMIX across random seeds.
E. A DDITIONAL T ASKS
This section compares EMIX and TwinQMIX to prior MARL methods on the Predator-Prey tasks.
In addition to the difﬁculty of task, we vary the number of opponents.
This helps quantify the variation in performance against increasing level of surprise under ﬁxed dynamics.
Table 4 presents average returns.
While all agents present comparable performance on the easier tasks, EMIX improves over
QMIX and TwinQMIX on the more challenging punish and hard tasks.
In the case of punish , EMIX is the only method to achieve greater than 20 returns outperforming baselines by a signiﬁcant margin.
[Table]
We consider a simple toy task from the Predator-Prey benchmark to demonstrate the importance of surprise minimization.
We select predator prey easy due to its simplicity and convenient dynamics.
The task consists of 3 agents and 3 opponents.
We increase the number of opponents while keeping the task ﬁxed.
This way the dynamics of the MDP remain unchanged and the only changing factor is opponent behaviors.
Fig.
7 presents the variation of average returns for EMIX and QMIX over 5 random seeds.
While QMIX agents undergo a steady decrease in performance, EMIX agents are found robust to this fast degradation.
Even after the addition of 20 opponents (against only 3 agents), EMIX is able to retain positive returns.
The algorithm acquires a surprise robust-policy early on during training to tackle fast-paced changes introduced by the large number of agents.