Average-Reward Soft Actor-Critic Jacob Adamczyk, Volodymyr Makarenko, Abstract The average-reward formulation of reinforcement learning (RL) has drawn increased interest in recent years for its ability to solve temporally-extended problems without relying on discounting. Meanwhile, in the discounted setting, algorithms with entropy regularization have been developed, leading to improvements over deterministic methods. Despite the distinct benefits of these approaches, deep RL algorithms for the entropy-regularized average-reward objective have not been developed. While policy-gradient based approaches have recently been presented for the average-reward literature, the corresponding actor-critic framework remains less explored. In this paper, we introduce an average-reward soft actor-critic algorithm to address these gaps in the field. We validate our method by comparing with existing average-reward algorithms on standard RL benchmarks, achieving superior performance for the average-reward criterion. 1 Introduction A successful reinforcement learning (RL) agent learns from interacting with its surroundings to achieve desired behaviors, as encoded in a reward function. However, in “continuing” tasks, where the amount of interactions is potentially unlimited, the total sum of rewards received by the agent is unbounded. To avoid this divergence, a popular technique is to discount future rewards relative to current rewards. The framework of discounted RL enjoys convergence properties ( Sutton & Barto, 2018 ; Kakade, 2003 ; Bertsekas, 2012 ) , practical benefits ( Schulman et al., 2016 ; Andrychowicz et al., 2020 ) , and a plethora of useful algorithms ( Mnih et al., 2015 ; Schulman et al., 2015 ; Schulman et al., 2017 ; Hessel et al., 2018 ; Haarnoja et al., 2018b ) making the discounted objective an obvious choice for the RL practitioner. Despite these benefits, the use of discounting introduces a (typically unphysical) hyperparameter \gamma which must be tuned for optimal performance. The difficulty in properly tuning the discount factor \gamma is illustrated in our motivating example, Figure 1 . Furthermore, agents solving the discounted RL problem will fail to optimize for long-term behaviors that operate on timescales longer than those dictated by the discount factor, (1-\gamma)^{-1} . Moreover, recent work has argued that the discounted objective is not even a well-defined optimization problem ( Naik et al., 2019 ) . Importantly, despite most state-of-the-art algorithms operating within this discounted framework, their metric for performance is most often the total or average reward over trajectories, as opposed to the discounted sum, which they are designed to optimize. In such cases, the discounted objective is used as a crutch for optimizing the true object of interest: long-term average performance. To address these issues, another objective for solving continuing tasks has been defined and studied ( Schwartz, 1993 ; Mahadevan, 1996 ) : the average-reward objective. Although it is arguably a more natural choice, it has less obvious convergence properties since the associated Bellman operators no longer possess the contraction property. Despite an ongoing line of work on the theoretical properties of the average-reward objective ( Zhang et al., 2021 ; Wan, 2023 ) , there remain a limited number of deep RL algorithms for this setting. Current algorithms beyond the tabular or linear settings focus on policy-gradient methods to develop deep actor-based models ( Zhang & Ross, 2021 ; Ma et al., 2021 ; Saxena et al., 2023 ) . While these advancements represent a positive step toward solving the average-reward objective, there remains a need for alternative approaches for the problem of average-reward deep RL. Figure 1 : The Swimmer-v5 environment, often not included in Mujoco benchmarks ( Franceschetti et al., 2022 ) , is notoriously difficult for discounted methods to solve when the discount factor is not tuned over and set to its default value of \gamma=0.99 . Other discount-sensitive examples of environments have been discussed by Tessler & Mannor (2020) . We find that after carefully tuning the discount factor, SAC can solve the task, but the solution is quite sensitive to the choice of \gamma . Each curve corresponds to an average over 30 random seeds, with the standard error indicated by the shaded region. In both the discounted and average-reward scenarios, optimal policies are known to be deterministic ( Mahadevan, 1996 ; Sutton & Barto, 2018 ) . However, under various real-world circumstances (e.g. errors in the model, perception, and control loops), a deterministic policy can fail. In deployment, when RL agents face the sim-to-real gap, are transferred to other environments, or when perturbations arise ( Haarnoja et al., 2017 ; Haarnoja et al., 2018a ; Eysenbach & Levine, 2022 ) , fully-trained deterministic agents may be rendered useless. To address these important use-cases, it would be useful to have a stochastic optimal policy which is flexible and robust under uncertainty. Rather than using heuristics (e.g. \varepsilon -greedy, mixture of experts, Boltzmann) to generate a stochastic policy post-hoc , the original RL problem can be regularized with an entropy-based term that yields an optimal policy which is naturally stochastic. Implementing this entropy-regularized RL objective corresponds to additionally rewarding the agent (in proportion to a temperature parameter, \beta^{-1} ) for using a policy which has a lower relative entropy ( Levine, 2018 ) , in the sense of Kullback-Leibler divergence. This formulation of entropy-regularized (often considered in the special case of maximum entropy or ‘‘MaxEnt’’ 1 1 1 MaxEnt refers to using a uniform prior policy. In that case, “low relative entropy” (with respect to a uniform prior) is equivalent to “high Shannon entropy”. In this work, we consider the case of more general priors. ) RL has led to significant developments in state-of-the-art off-policy algorithms ( Haarnoja et al., 2017 ; Haarnoja et al., 2018b ; Haarnoja et al., 2018c ) . Despite the desirable features of both the average-reward and entropy-regularized objectives, an empirical study of the combination of these two formulations is limited, and no function-approximator algorithms exist yet for this setting. To address this, we propose a novel algorithm for average-reward RL with entropy regularization which is an extension of the discounted algorithm Soft Actor-Critic (SAC) ( Haarnoja et al., 2018b ; Haarnoja et al., 2018c ) . Notably, our implementation requires minimal changes to common codebases, making it accessible for researchers and allowing for future extensions by the community. 2 Preliminaries In this section, we discuss the background material necessary for the subsequent discussion. Let \Delta(\mathcal{X}) denote the probability simplex over the space \mathcal{X} . A Markov Decision Process (MDP) is modeled by a state space \mathcal{S} , action space \mathcal{A} , reward function r:\mathcal{S}\times\mathcal{A}\to\mathbb{R} , transition dynamics p:\mathcal{S}\times\mathcal{A}\to\Delta(\mathcal{S}) and initial state distribution \mu\in\Delta(\mathcal{S}) . The state space describes the set of possible configurations in which the agent (and environment) may exist. (This can be juxtaposed with the “observation” which encodes only the state information accessible to the agent. We will consider fully observable MDPs where state and observation are synonymous.) The action space is the set of controls available to the agent. Enacting control, the agent may alter its state. This change is dictated by the (generally stochastic) transition dynamics, p . At each discrete timestep, an action is taken and the agent receives a reward r(s,a)\in\mathbb{R} from the environment. We will make some of the usual assumptions for average-reward MDPs ( Wan et al., 2021 ) : Assumption 1 . The Markov chain induced by any stationary policy \pi is communicating. Assumption 2 . The reward function is bounded. In solving an average-reward MDP, one seeks a control policy \pi which maximizes the expected reward-rate , denoted \rho^{\pi} . In the average-reward framework, such an objective reads: \rho^{\pi}=\lim_{N\to\infty}\frac{1}{N}\mathop{\mathbb{E}}_{\tau\sim{}p,\pi,\mu}\left[\sum_{t=0}^{N-1}r(\mathbf{s}_{t},\mathbf{a}_{t})\right], (1) where the expectation is taken over trajectories generated by the dynamics p , control policy \pi , and initial state distribution \mu . The remaining non-scalar (that is, state-action-dependent) contribution to the value of a policy is called the average-reward differential bias function. Because of its analogy to the Q -function in discounted RL, we follow recent work ( Zhang & Ross, 2021 ) and similarly denote it as: Q^{\pi}_{\rho}(\mathbf{s},\mathbf{a})=\mathop{\mathbb{E}}_{\tau\sim{}p,\pi}\left[\sum_{t=0}^{\infty}r(\mathbf{s}_{t},\mathbf{a}_{t})-\rho^{\pi}\Biggr|\mathbf{s}_{0}=\mathbf{s},\mathbf{a}_{0}=\mathbf{a}\right]. (2) We will now introduce a variation of this MDP framework which includes an entropy regularization term. For notational convenience we refer to entropy-regularized average-reward MDPs as ERAR MDPs. The ERAR MDP constitutes the same ingredients as an average-reward MDP stated above, in addition to a pre-specified prior policy 2 2 2 For convenience we assume that \pi_{0} has support across \mathcal{A} , ensuring the Kullback-Leibler divergence is always finite. {\pi_{0}:\mathcal{S}\to\Delta(\mathcal{A})} and “inverse temperature”, \beta . The modified objective function for an ERAR MDP now includes a regularization term based on the relative entropy (Kullback-Leibler divergence), so that the agent now aims to optimize the expected entropy-regularized reward-rate , denoted \theta^{\pi} : \theta^{\pi}\doteq\lim_{N\to\infty}\frac{1}{N}\mathop{\mathbb{E}}_{\tau\sim{}p,\pi,\mu}\left[\sum_{t=0}^{N-1}r(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right], (3) \pi^{*}(a|s)=\mathop{\mathrm{argmax}}_{\pi}\theta^{\pi}. (4) Assumption 1 implies the expression in Equation ( 3 ) is independent of the initial state-action and ensures the reward-rate is indeed a unique scalar. From hereon, we will simply write \theta=\theta^{\pi^{*}} for the optimal entropy-regularized reward-rate for brevity. Comparing to Equation ( 1 ), this rate is seen to include an additional entropic contribution, the relative entropy between the control ( \pi ) and prior ( \pi_{0} ) policies. Beyond a mathematical generalization from the MaxEnt formulation, the KL divergence term has also found use in behavior-regularized RL tasks, especially in the offline setting ( Wu et al., 2019 ; Zhang & Tan, 2024 ) and has found growing interest in its application to large language models (LLMs) ( Rafailov et al., 2024 ; Yan et al., 2024 ) . Using a non-uniform prior has also been exploited to develop approaches for solving the un-regularized problem Adamczyk et al. (2025) and the problem of potential-based reward shaping and compositionality Adamczyk et al. (2023) . Intuitively, the choice of prior allows one to exploit inductive biases while maintaining robustness. The corresponding differential entropy-regularized action-value function is then given by: Q^{\pi}_{\theta}(\mathbf{s},\mathbf{a})=r(\mathbf{s},\mathbf{a})-\theta^{\pi}+\mathop{\mathbb{E}}_{\tau\sim{}p,\pi}\Biggl[\sum_{t=1}^{\infty}\Biggl(r(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}-\theta^{\pi}\Biggr)\Biggr|\mathbf{s}_{0}=\mathbf{s},\mathbf{a}_{0}=\mathbf{a}\Biggr]. (5) We have used the subscripts of \theta and \rho in this section to distinguish the two value functions. In the following, we drop the \theta subscript as we focus solely on the entropy-regularized objective. Similar to the notation for the average-reward rate, we make the notation compact, and write {Q(\mathbf{s},\mathbf{a})=Q^{\pi^{*}}_{\theta}(\mathbf{s},\mathbf{a})} as a shorthand. 3 Prior Work Research on average-reward MDPs has a longstanding history, dating back to seminal contributions by Blackwell (1962) and later Mahadevan (1996) , which laid the groundwork for future algorithmic and theoretical investigations ( Even-Dar et al., 2009 ; Abbasi-Yadkori et al., 2019 ; Abounadi et al., 2001 ; Neu et al., 2017 ; Wan et al., 2021 ) . Due to their theoretical nature, these studies primarily focused on algorithms within tabular settings or under linear function approximation, possibly explaining the limited work on the average-reward problem in the deep RL community. However, recent work has begun to address this challenge by tackling deep average-reward RL ( Zhang & Ross, 2021 ; Ma et al., 2021 ; Saxena et al., 2023 ) with methods based on the policy gradient algorithm ( Sutton et al., 1999 ) . Especially when tested on long-term optimization tasks, these studies have demonstrated superior performance of average-reward algorithms in the continuous control Mujoco benchmark ( Todorov et al., 2012 ) , compared to their discounted counterparts. In the deep average-reward RL literature, research has primarily focused on extending known algorithms from the discounted to the average-reward setting. For example, Zhang & Ross (2021) first provided an extension of the on-policy trust region method TRPO ( Schulman et al., 2015 ) to the average-reward domain. To extend the classical discounted policy improvement theorem to this domain, they introduced a novel (double-sided) policy improvement bound based on Kémeny’s constant (related to the Markov chain’s mixing time). Experimentally, they illustrated the success of ATRPO against TRPO, especially for long-horizon tasks in the Mujoco suite. Shortly thereafter, ( Ma et al., 2021 ) introduced an analogue of PPO ( Schulman et al., 2017 ) for average-reward tasks with an extension of generalized advantage estimation (GAE) and addressing the problem of “value drift”, again proving successful in experimental comparisons with PPO. Most recently, Saxena et al. (2023) continued this line of work by extending DDPG ( Lillicrap et al., 2016 ) to the average-reward domain with extensive supporting theory, including finite-time convergence analysis. The authors also demonstrate the improved performance of their algorithm, ARO-DDPG, against the previously discussed methods, thereby demonstrating a new state-of-the-art algorithm for the average-reward objective. In parallel, the discounted objective has included an entropy-regularization term, discussed in works such as ( Todorov, 2006 ; Todorov, 2009 ; Ziebart, 2010 ; Rawlik, 2013 ; Haarnoja et al., 2017 ; Geist et al., 2019 ) which to our knowledge has not yet been introduced in a deep average-reward algorithm. The included “entropy bonus” term in these methods has found considerable use in the development of both theory and algorithms in distinct branches of RL research ( Haarnoja et al., 2018a ; Eysenbach & Levine, 2022 ; Park et al., 2023 ) . This innovation yields optimal policies naturally exhibiting stochasticity in continuous action spaces, which has led SAC ( Haarnoja et al., 2018c ) and its variants to become state-of-the-art solution methods for addressing the discounted objective. However, there is limited work on the combination of average-reward and entropy-regularized methods, especially for deep RL. Recent work by Rawlik (2013) ; Neu et al. (2017) ; Rose et al. (2021) ; Li et al. (2022) ; Arriojas et al. (2023) ; Wu et al. (2024) set the groundwork for combining the entropy-regularized and average-reward formulations by providing supporting theory and validating experiments. We will leverage their results to address the problem of deep average-reward RL with entropy regularization, while introducing some new theoretical results. In the next section, we present our average-reward extension of soft actor-critic. 4 Proposed Algorithm We begin with a brief discussion of soft actor-critic (SAC), for which we derive new theoretical results and provide an algorithm in the average-reward setting. SAC ( Haarnoja et al., 2018b ) relies on iteratively calculating a value (critic) of a policy (actor) and improving the actor through soft policy improvement (PI). In the discounted problem formulation, soft PI states that a new policy (denoted \pi^{\prime} ) can be derived from the value function of a previous policy ( \pi ) with \pi^{\prime}\propto\exp{\beta Q^{\pi}(\mathbf{s},\mathbf{a})} , which is guaranteed to outperform the previous policy in the sense of (soft) Q -values: {Q^{\pi^{\prime}}(\mathbf{s},\mathbf{a})>Q^{\pi}(\mathbf{s},\mathbf{a})} for all \mathbf{s},\mathbf{a} (cf. Lemma 2 of ( Haarnoja et al., 2018b ) for details). We will first show that an analogous result for policy improvement holds in the ERAR setting. Note that in the case of large state-action spaces, experimentally verifying such inequalities becomes intractable ( Naik, 2024 ) and can be alleviated by instead comparing reward rates: scalar quantities which can (in principle) be efficiently evaluated with rollouts. Since the value of a policy is now encoded in the entropy-regularized average reward rate \theta^{\pi} and not in the differential value, the analogue to policy improvement ( Q^{\pi^{\prime}}>Q^{\pi} ) is to establish the bound \theta^{\pi^{\prime}}>\theta^{\pi} for some construction of \pi^{\prime} from \pi . Indeed, as we show, the same Boltzmann form over the differential value leads to soft PI in the ERAR objective. We later give some intuition on how this result can be understood as the limit \gamma\to 1 of SAC. After establishing PI and the related theory in this setting we will present our algorithm, denoted “ASAC” (for average-reward SAC, and following the naming convention of APO ( Ma et al., 2021 ) and ATRPO ( Zhang & Ross, 2021 ) ). 4.1 Theory As in the discounted case, it can be shown that the Q function for a fixed policy \pi satisfies a recursive Bellman backup equation 3 3 3 Equation ( 7 ) is an extension of V^{\pi}_{\text{soft}} in ( Haarnoja et al., 2017 ) to the case of non-uniform prior policy. . This proposition was also derived in the concurrent work of Wu et al. (2024) which analyzed the ERAR problem in the inverse RL framework: Proposition 1 . Let an ERAR MDP with reward function r(\mathbf{s},\mathbf{a}) , policy \pi and prior policy \pi_{0} be given. Then the differential value of \pi , denoted Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t}) , satisfies Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})=r(\mathbf{s}_{t},\mathbf{a}_{t})-\theta^{\pi}+\mathop{\mathbb{E}}_{\mathbf{s}_{t+1}\sim{p}}V^{\pi}(\mathbf{s}_{t+1}), (6) with the entropy-regularized definition of state-value function V^{\pi}(\mathbf{s}_{t})=\mathop{\mathbb{E}}_{\mathbf{a}_{t}\sim{}\pi}\left[Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right]. (7) For completeness, we give a proof of this result (and all others) in the Appendix. As in the discounted case, the proof exploits the recursive structure of Eq. ( 5 ). As mentioned above, in the average reward formulation, the metric of interest is the reward-rate. Our policy improvement result thus focuses on increases in \theta^{\pi} , generalizing the recent work of Zhang & Ross (2021) to the entropy-regularized setting. We find that the gap between any two entropy-regularized reward-rates can be expressed in the following manner: Lemma 1 (ERAR Rate Gap) . Consider two policies \pi,\pi^{\prime} absolutely continuous w.r.t. \pi_{0} . Then the gap between their corresponding entropy-regularized reward-rates is: \theta^{\pi^{\prime}}-\theta^{\pi}=\mathop{\mathbb{E}}_{\begin{subarray}{c}\mathbf{s}_{t}\sim d_{\pi^{\prime}}\\ \mathbf{a}_{t}\sim\pi^{\prime}\end{subarray}}\left(A^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right), (8) where A^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})=Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-V^{\pi}(\mathbf{s}_{t}) is the advantage function of policy \pi and d_{\pi^{\prime}} is the steady-state distribution induced by \pi^{\prime} . As a consequence of this result, we find that with the proper choice of the updated policy \pi^{\prime} , the right-hand side of Equation ( 8 ) is guaranteed to be positive, implying that soft PI holds. Using the Boltzmann form of a policy ( Haarnoja et al., 2018b ) with the differential Q -values as the energy function and the appropriate prior distribution ( \pi_{0} ), gives the desired result: Theorem 1 (ERAR Policy Improvement) . Let a policy \pi absolutely continuous w.r.t. \pi_{0} and its corresponding differential value Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t}) be given. Then, the policy \pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})\doteq\frac{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})e^{\beta Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})}}{\int e^{\beta Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})}d\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})} (9) achieves a greater entropy-regularized reward-rate. That is, \theta^{\pi^{\prime}}\geq\theta^{\pi} , with equality only at convergence, when \pi^{\prime}=\pi=\pi^{*} . Upon convergence, Equation ( 8 ) is identically zero, with the optimal policy satisfying {\pi^{*}\propto\exp\beta A^{*}(\mathbf{s}_{t},\mathbf{a}_{t})} as expected from the analogous discounted result. We note that the corresponding result in Lemma 2 of Haarnoja et al. (2018b) for SAC (which uses a uniform prior policy), involves the total value function. On the other hand, under the average-reward objective, the improved policy is calculated with the differential value function. Intuitively, this result can be understood as the \gamma\to 1 limit of PI for SAC. Numerically, this can be seen as setting \gamma=1 and continuously subtracting the “extensive” contribution to the total value function throughout. This bulk contribution scales with the number of timesteps in an episode and is the result of accruing a per-timestep reward \theta^{\pi} . Since the same term accrues in the state- and action-value functions, it cancels in the numerator and denominator of Equation ( 9 ). In the case of SAC, the bulk contribution (essentially N\theta^{\pi} , for N\gg 1 ) is included in the value function and so a discount factor \gamma<1 is required to ensure that the total value function is bounded in the limit of large N (in the sense of Equation ( 3 )). In contrast, for the case of ASAC, the bulk contribution is automatically excluded from the corresponding evaluation (by definition), and the differential value function remains bounded in the limit of large N , obviating the need to introduce a discount factor. This intuition can be formalized through a Laurent series expansion; cf. Mahadevan (1996) . To complete the discussion of convergence for ASAC, the policy evaluation (PE) step must also converge. To formulate this, we rely on the work of Wan et al. (2021) who give convergence proofs for average-reward policy evaluation. Lemma 2 (ERAR Policy Evaluation) . Consider a fixed policy \pi , for which \theta^{\pi} of Equation ( 1 ) has been calculated (e.g. with direct rollouts). The iteration of Equations ( 2 ) and ( 7 ) converges to the entropy-regularized differential value of \pi : Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t}) . Proof. The proof follows from the convergence results established in the un-regularized case, e.g. Wan et al. (2021) . Since the policy \pi is fixed (and \pi\ll\pi_{0} ), the entropic cost -\beta^{-1}\textrm{KL}\left({\pi||\pi_{0}}\right) is finite and can be absorbed into the reward function’s definition: r\xleftarrow{}r-\beta^{-1}\textrm{KL}\left({\pi||\pi_{0}}\right) , and the standard proof techniques apply. ∎ 4.2 Implementation Figure 2 : Training curves on continuous control benchmarks. We compare our algorithm, average-reward soft actor-critic (ASAC), with the following baselines: average-reward off-policy deep deterministic policy gradient (ARO-DDPG), average-reward trust-region policy optimization (ATRPO), and average-reward policy optimization (APO). ASAC learns the fastest with the best asymptotic performance. Each curve corresponds to an average over 20 random seeds, with standard errors indicated by the shaded region. As in SAC ( Haarnoja et al., 2018b ) , we propose to interleave steps of policy evaluation (PE) and policy improvement (PI) using stochastic approximation to train the critic and actor networks, respectively. We use a deep neural net with parameters \psi , and denote Q_{\psi} as the “online” critic network (with trainable parameters), and denote Q_{\bar{\psi}} as the “target” critic, updated periodically through Polyak averaging of the parameters. To implement a PI step, we use the KL divergence loss to update the parameters \phi of an actor network \pi_{\phi} based on the policy improvement theorem (Equation ( 9 )): \mathcal{L}_{\phi}=\sum_{\mathbf{s}_{t}\in\mathcal{B}}\textrm{KL}\left(\pi_{\phi}(\cdot|\mathbf{s}_{t})\biggr|\biggr|\frac{\pi_{0}(\cdot|\mathbf{s}_{t})e^{\beta Q_{\psi}(\mathbf{s}_{t},\cdot)}}{Z(\mathbf{s}_{t})}\right)\;. (10) Similar to SAC, the independence of parameters on the partition function Z allows us to simplify this loss expression to the more tractable form: \mathcal{L}_{\phi}=\sum_{\mathbf{s}_{t}\in\mathcal{B}}\mathop{\mathbb{E}}_{\mathbf{a}_{t}\sim{}\pi_{\phi}}\left(\log\frac{\pi_{\phi}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}-\beta^{-1}Q_{\psi}(\mathbf{s}_{t},\mathbf{a}_{t})\right)\;. (11) In practice, we also use the re-parameterization trick to efficiently propagate gradients through the actor model. After updating the actor via soft policy improvement, we update the critic (differential value) by performing a policy evaluation step with actions sampled from the current actor network. The mean squared error loss is calculated by comparing the expected Q -value to the right-hand side of Equation ( 6 ): \mathcal{L}_{\psi}=\sum_{(\mathbf{s}_{t},\mathbf{a}_{t},r,\mathbf{s}_{t+1})\sim{}\mathcal{B}}\biggr|Q_{\psi}(\mathbf{s}_{t},\mathbf{a}_{t})-\hat{y}(r,\theta;\bar{\psi},\phi)\biggr|^{2}, (12) where \hat{y} is the target value, defined as: \hat{y}(r,\theta;\bar{\psi},\phi)=r-\theta+\mathop{\mathbb{E}}_{\mathbf{a}_{t+1}\sim{}\pi_{\phi}(\cdot|\mathbf{s}_{t+1})}\left[Q_{\bar{\psi}}(\mathbf{s}_{t+1},\mathbf{a}_{t+1})-\frac{1}{\beta}\log\frac{\pi_{\phi}(\mathbf{a}_{t+1}|\mathbf{s}_{t+1})}{\pi_{0}(\mathbf{a}_{t+1}|\mathbf{s}_{t+1})}\right]. To update the ERAR rate \theta^{\pi} , we define its target as the batch-wise mean of its definition in Equation ( 3 ). We treat \theta as a trainable parameter (using an Adam optimizer) and train it to minimize the residual error compared to this target value. We adopt the double Q -learning paradigm ( Fujimoto et al., 2018 ; Haarnoja et al., 2018b ; Saxena et al., 2023 ) used in previous literature for reducing estimation bias: two critics are maintained, and the minimum Q -value is used at each state-action pair. Although the corresponding theory ( Fujimoto et al., 2018 ) for the average-reward case has not been studied in detail, we found this to improve experimental performance. Understanding the effect of estimation bias is an interesting line of study for future work. Unique to the average-reward objective is the family of solutions to the Bellman equation. Rather than a unique solution, the average-reward Bellman equation gives the differential value function an additional degree of freedom: If Q(\mathbf{s},\mathbf{a}) satisfies Eq. ( 5 ) then Q(\mathbf{s},\mathbf{a})+c is also a solution for all c\in\mathbb{R} . Section 4.1 of ( Ma et al., 2021 ) provides an interesting discussion on the learning of value functions with an additive bias and a related downstream “value drifting problem”, which they correct with value-based regularization. Section 6 of ( Wan et al., 2021 ) provides a discussion on learning centered value functions via an additionally learned corrective “value function” F . To correct for this additional degree of freedom in an off-policy way, we introduce a baseline for centering the value function. Since an entire family of value functions can solve the Bellman equation, to pin the value, we choose the solution which passes through the origin, by always subtracting the value Q(s=0,a=0) . This choice is arbitrary, but works well in practice. Compared to the proposed regularization, it does not require any additional hyperparameters. Since it is not centering the value function in the traditional sense, it does not require on-policy data, but in principle the constant shift can be recovered upon convergence via rollouts of the optimal policy. Finally, in average-reward tasks with terminating states, previous work ( Zhang & Ross, 2021 ) has introduced a “reset cost”, giving a penalty to the agent for resetting the environment and treating the reset state s\sim{}\mu(\cdot) as the next state to emulate a continuing task. Prior work has chosen a fixed reset cost ( -100 ) which was deemed suitable in the environments tested. However, it is not reasonable to expect such penalties to be effective for tasks with different reward scales or dynamics (cf. Humanoid results in Appendix D of ( Zhang & Ross, 2021 ) ). As such, we introduce a novel adaptive reset cost: To ensure the penalty for resetting is commensurate with the accrued rewards, we simply take the mean of all rewards in the current batch that do not correspond to termination. We use a rolling average (with the same learning rate as used for \theta ) to slowly adapt the penalty to the agent’s policy. We note that learning (and even defining) an “optimal” reset cost is an open question, which calls for further study. More details on the implementation, as well as the pseudocode for ASAC can be found in the Appendix, Section 9 . 5 Experiments To evaluate our new algorithm, we test ASAC on a set of locomotion environments of increasing complexity including HalfCheetah, Ant, Swimmer, Hopper, Walker2d, and Humanoid (all version 5 ) from the Gymnasium Mujoco suite ( Todorov et al., 2012 ; Towers et al., 2024 ) . We compare the performance (average evaluation return across 10 episodes) against the existing average-reward algorithms discussed in Section 3 : APO, ATRPO, and ARO-DDPG. For these baselines, we use the hyperparameters provided in the corresponding papers. While the focus of this paper is on a comparison of algorithms for the average-reward criterion, we also provide a comparison to the discounted algorithm SAC in the Appendix. To alleviate the cost of hyperparameter tuning, we simply use the default values inherited from SAC. Further details on the implementation and hyperparameter selection can be found in Section 9.1 . ASAC performs well compared to both off-policy (ARO-DDPG) and on-policy algorithms (ATRPO, APO). To maximize performance of the ARO-DDPG baseline, we found it beneficial to use a replay buffer of maximum length (equal to number of environment interactions). Compared to ASAC, the baselines fail to solve the task in a meaningful way on some environments (Walker, Ant, Humanoid), highlighting the importance of maximum-entropy approaches for high-dimensional locomotion tasks, especially in the average-reward setting. The results of these experiments are shown in Figure 2 . Our experiments show that ASAC represents a novel and effective algorithm for the average-reward setting. 6 Discussion The motivation for developing novel algorithms for average-reward RL arises from the problems generally associated with discounting. When the RL problem is posed in the discounted framework, a discount factor \gamma\in[0,1) is a required input parameter. However, there is often no principled approach for choosing the value of \gamma corresponding to the specific problem being addressed. Thus, the experimenter must treat \gamma as a hyperparameter. This reduces the choice of \gamma to a trade-off between large values to capture long-term rewards and small values to capture computational efficiency which typically scales polynomially with the horizon, H=(1-\gamma)^{-1} ( Kakade, 2003 ) . It is important to note that the horizon H introduces a natural timescale to the problem, but this timescale may not be well-aligned with another timescale corresponding to the optimal policy: the mixing time of the induced Markov chain. For the discounted solution to accurately approximate the average-reward optimal policy, the discounting timescale (horizon) must be larger than the mixing time. Unfortunately, the estimation of the mixing time for the optimal dynamics can be challenging to obtain in the general case, even when the transition dynamics are known, making a principled use of discounting computationally expensive. Therefore, an arbitrary “sufficiently large” choice of \gamma is often made (sometimes dynamically ( Wei et al., 2021 ; Koprulu et al., 2024 ) ) without knowledge of the relevant problem-dependent timescale. This can be problematic from a computational standpoint as evidenced by recent work ( Jiang et al., 2015 ; Schulman et al., 2017 ; Andrychowicz et al., 2020 ) . These points are illustrated in Figure 1 which showed the performance of SAC for the Swimmer environment with different choices of \gamma . For the widely used choice \gamma=0.99 the evaluation rewards are low relative to the optimal case, whereas the average rewards algorithms perform well (Fig. 2 ), highlighting the benefits of using the average-reward criterion. After submission of this paper, we became aware of related work: RVI-SAC Hisaki & Ono (2024) , which uses relative value iteration (RVI) to estimate the reward-rate. A detailed comparison of RVI-SAC and ASAC is left to future work. In this work, we have developed a framework for combining the benefits of the average-reward approach with entropy regularization. In particular, we have focused on extensions of the discounted algorithm SAC to the average-reward domain. By leveraging the connection of the ERAR objective to the soft discounted framework, we have presented the first solution to ERAR MDPs in continuous state and action spaces by use of function approximation. Our experiments suggest that ASAC compares favorably in several respects to their discounted counterparts: stability, convergence speed, and asymptotic performance. Our algorithm leverages existing codebases allowing for a straightforward and easily extendable implementation for solving the ERAR objective. 7 Future Work The current work suggests multiple extensions for future exploration. Beginning with the average-reward extension of SAC ( Haarnoja et al., 2018b ) , further developments have been made ( Haarnoja et al., 2018c ) including automated temperature adjustment, which we foresee as a straightforward extension for future work. As a value-based technique, other ideas from the literature such as \text{TD}(n) , REDQ ( Chen et al., 2021 ) , DrQ ( Kostrikov et al., 2020 ) , combating estimation bias ( Hussing et al., 2024 ) , or dueling architectures ( Wang et al., 2016 ) may be included. From the perspective of sampling, the calculation of \theta can likely benefit from more complex replay sampling, e.g. PER ( Schaul et al., 2015 ) . An important contribution for future work is studying the sample complexity and convergence properties of the proposed algorithm. We believe that the average-reward objective with entropy regularization is a fruitful direction for further research and real-world application, with this work addressing a gap in the existing literature. Supplementary Materials The following content was not necessarily subject to peer review. 8 Proofs Lemma 7 (ERAR Backup Equation) . Let an ERAR MDP be given with reward function r(\mathbf{s},\mathbf{a}) , fixed evaluation policy \pi and prior policy \pi_{0} . Then the differential value of \pi , Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t}) , satisfies Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})=r(\mathbf{s}_{t},\mathbf{a}_{t})-\theta^{\pi}+\mathbb{E}_{\mathbf{s}_{t+1}\sim{}p}V^{\pi}(\mathbf{s}_{t+1}), (13) with the entropy-regularized definition 4 4 4 Equation ( 14 ) is an extension of V^{\pi}_{\text{soft}} in Haarnoja et al. (2017) to the case of a non-uniform prior policy. of state-value function V^{\pi}(\mathbf{s}_{t})=\mathbb{E}_{\mathbf{a}_{t}\sim{}\pi}\left[Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right]. (14) Proof. We begin with the definitions for the current state-action and for the next state-action value functions, respectively: \displaystyle Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t}) \displaystyle=r(\mathbf{s}_{t},\mathbf{a}_{t})-\theta^{\pi}+\mathop{\mathbb{E}}_{p,\pi}\left[\sum_{k=1}^{\infty}\left(r(\mathbf{s}_{t+k},\mathbf{a}_{t+k})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t+k}|\mathbf{s}_{t+k})}{\pi_{0}(\mathbf{a}_{t+k}|\mathbf{s}_{t+k})}-\theta^{\pi}\right)\right], \displaystyle Q^{\pi}(\mathbf{s}_{t+1},\mathbf{a}_{t+1}) \displaystyle=r(\mathbf{s}_{t+1},\mathbf{a}_{t+1})-\theta^{\pi}+\mathop{\mathbb{E}}_{p,\pi}\left[\sum_{k=2}^{\infty}\left((\mathbf{s}_{t+k},\mathbf{a}_{t+k})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t+k}|\mathbf{s}_{t+k})}{\pi_{0}(\mathbf{a}_{t+k}|\mathbf{s}_{t+k})}-\theta^{\pi}\right)\right]. Re-writing Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t}) by writing out the first term in the infinite sum and highlighting the terms of Q^{\pi}(\mathbf{s}_{t+1},\mathbf{a}_{t+1}) in blue , \displaystyle Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})=r(\mathbf{s}_{t},\mathbf{a}_{t})-\theta^{\pi}+ \displaystyle\mathop{\mathbb{E}}_{p,\pi}\Biggr[r(\mathbf{s}_{t+1},\mathbf{a}_{t+1})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t+1}|\mathbf{s}_{t+1})}{\pi_{0}(\mathbf{a}_{t+1}|\mathbf{s}_{t+1})}-\theta^{\pi}+ \displaystyle{\color[rgb]{1,0,0}{\sum_{k=2}^{\infty}\left(r(\mathbf{s}_{t+k},\mathbf{a}_{t+k})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t+k}|\mathbf{s}_{t+k})}{\pi_{0}(\mathbf{a}_{t+k}|\mathbf{s}_{t+k})}-\theta^{\pi}\right)}}\Biggr], \displaystyle Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})=r(\mathbf{s}_{t},\mathbf{a}_{t})-\theta^{\pi}+ \displaystyle\mathop{\mathbb{E}}_{\mathbf{s}_{t+1}\sim{}p,\mathbf{a}_{t+1}\sim{}\pi}\left[Q^{\pi}_{\theta}(\mathbf{s}_{t+1},\mathbf{a}_{t+1})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t+1}|\mathbf{s}_{t+1})}{\pi_{0}(\mathbf{a}_{t+1}|\mathbf{s}_{t+1})}\right]. Identifying the entropy-regularized state value function (as in the discounted setting) {V(\mathbf{s}_{t})=\mathop{\mathbb{E}}_{\mathbf{a}_{t}\sim{}\pi}\left[Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right]} completes the proof. ∎ Lemma 1 (ERAR Rate Gap) . Consider two policies \pi,\pi^{\prime} absolutely continuous w.r.t. \pi_{0} . Then the gap between their corresponding entropy-regularized reward-rates is: \theta^{\pi^{\prime}}-\theta^{\pi}=\mathop{\mathbb{E}}_{\begin{subarray}{c}\mathbf{s}_{t}\sim d_{\pi^{\prime}}\\ \mathbf{a}_{t}\sim\pi^{\prime}\end{subarray}}\left(A^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right), (15) where A^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})=Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-V^{\pi}(\mathbf{s}_{t}) is the advantage function of policy \pi and d_{\pi^{\prime}} is the steady-state distribution induced by \pi^{\prime} . Proof. Working from the right-hand side of the equation, \displaystyle\mathop{\mathbb{E}}_{\mathbf{s}_{t}\sim{}d_{\pi^{\prime}},\mathbf{a}_{t}\sim{}\pi^{\prime}}\left(A^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right)=\mathop{\mathbb{E}}_{\mathbf{s}_{t}\sim{}d_{\pi^{\prime}},\mathbf{a}_{t}\sim{}\pi^{\prime}}\left(Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-V^{\pi}(\mathbf{s}_{t})-\frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right) \displaystyle=\mathop{\mathbb{E}}_{\mathbf{s}_{t}\sim{}d_{\pi^{\prime}},\mathbf{a}_{t}\sim{}\pi^{\prime}}\left({\color[rgb]{0,0,1}{r(\mathbf{s}_{t},\mathbf{a}_{t})}}-\theta^{\pi}+\mathop{\mathbb{E}}_{\mathbf{s}_{t+1}\sim{}p}V^{\pi}(\mathbf{s}_{t+1})-V^{\pi}(\mathbf{s}_{t}){\color[rgb]{0,0,1}{-\frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}}}\right) \displaystyle=\theta^{\pi^{\prime}}-\theta^{\pi}+\mathop{\mathbb{E}}_{\mathbf{s}_{t}\sim{}d_{\pi^{\prime}},\mathbf{a}_{t}\sim{}\pi^{\prime}}\left(\mathop{\mathbb{E}}_{\mathbf{s}_{t+1}\sim{}p(\cdot|\mathbf{s}_{t},\mathbf{a}_{t})}V^{\pi}(\mathbf{s}_{t+1})-V^{\pi}(\mathbf{s}_{t})\right) \displaystyle=\theta^{\pi^{\prime}}-\theta^{\pi}. where we have used the definition \theta^{\pi^{\prime}}=\mathop{\mathbb{E}}_{\mathbf{s}_{t}\sim{}d_{\pi^{\prime}},\mathbf{a}_{t}\sim{}\pi^{\prime}}\left({r(\mathbf{s}_{t},\mathbf{a}_{t})}-\frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right), (16) and \mathop{\mathbb{E}}_{\mathbf{s}_{t}\sim{}d_{\pi^{\prime}}}\mathop{\mathbb{E}}_{\mathbf{a}_{t}\sim{}\pi^{\prime}}\mathop{\mathbb{E}}_{\mathbf{s}_{t+1}\sim{}p}V^{\pi}(\mathbf{s}_{t+1})=\mathop{\mathbb{E}}_{\mathbf{s}_{t}\sim{}d_{\pi^{\prime}}}V^{\pi}(\mathbf{s}_{t}), (17) which follows given that d_{\pi^{\prime}} is the stationary distribution. In other words, d_{\pi^{\prime}} is an eigenvector of the transition operator p(\mathbf{s}_{t+1}|\mathbf{s}_{t},\mathbf{a}_{t})\cdot\pi^{\prime}(\mathbf{a}_{t+1}|\mathbf{s}_{t+1}) . ∎ Theorem 1 (ERAR Policy Improvement) . Let a policy \pi absolutely continuous w.r.t. \pi_{0} and its corresponding differential value Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t}) be given. Then, the policy \pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})\doteq\frac{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})e^{\beta Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})}}{\int e^{\beta Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})}d\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})} (18) achieves a greater entropy-regularized reward-rate. That is, \theta^{\pi^{\prime}}\geq\theta^{\pi} , with equality only at convergence, when \pi^{\prime}=\pi=\pi^{*} . Proof. Let \pi^{\prime} be defined as above. Then \frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}=Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\mathop{\mathbb{E}}_{a\sim{}\pi_{0}}e^{\beta Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})}. (19) Using Lemma 1 , \displaystyle\theta^{\pi^{\prime}}-\theta^{\pi} \displaystyle=\mathop{\mathbb{E}}_{s\sim{}d_{\pi^{\prime}},a\sim{}{\pi^{\prime}}}\left(A^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right) \displaystyle=\mathop{\mathbb{E}}_{s\sim{}d_{\pi^{\prime}},a\sim{}{\pi^{\prime}}}\left(Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-V^{\pi}(s)-\frac{1}{\beta}\log\frac{\pi^{\prime}(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right) \displaystyle=\mathop{\mathbb{E}}_{s\sim{}d_{\pi^{\prime}},a\sim{}{\pi^{\prime}}}\left(\frac{1}{\beta}\log\mathop{\mathbb{E}}_{a\sim{}\pi_{0}}e^{\beta Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})}-V^{\pi}(s)\right)\geq 0\;, where the last line follows from the variational formula Mitter & Newton (2000) ; Theodorou & Todorov (2012) , \frac{1}{\beta}\log\mathop{\mathbb{E}}_{a\sim{}\pi_{0}}e^{\beta Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})}=\sup_{\pi}\mathop{\mathbb{E}}_{a\sim{}\pi}\left(Q^{\pi}(\mathbf{s}_{t},\mathbf{a}_{t})-\frac{1}{\beta}\log\frac{\pi(\mathbf{a}_{t}|\mathbf{s}_{t})}{\pi_{0}(\mathbf{a}_{t}|\mathbf{s}_{t})}\right). (20) ∎ 9 Implementation Details For all SAC runs, we used Raffin et al. (2021) implementation of SAC with hyperparameters (beyond the default values) shown below in Section 9.1 . The finetuned runs here took \sim{}3000 GPU hours for all environments, ran on a variety of RTX series and A100 GPUs. Each run requires roughly \sim{}1-10 GB of RAM. 9.1 Hyperparameters In addition to the methods discussed in the main text, we also use gradient clipping (on critic network only), with the maximum gradient norm of 10 for all experiments. For all ASAC experiments, we use the same hyperparameters as Haarnoja et al. (2018b) : batch size of 256 , replay buffer size of 1\,000\,000 , hidden dimension of 256 for each of 2 hidden layers (actor and critic networks), Polyak averaging with coefficient 0.005 , train frequency and gradient steps of 1 (train for one gradient step at each environment step). We use the Adam optimizer for actor, critic, and reward-rate with learning rates 10^{-4},5\times 10^{-4},5\times 10^{-3} . We clip the critic network gradients with a maximum norm of 10 . The scale for reset penalties is chosen as p_{0}=10 (see pseudocode below). In all environments (for SAC and ASAC) we use \beta=5 , except for Swimmer and Humanoid, for which we use \beta=20 . Note that this is in line with the “reward scale” used in ( Haarnoja et al., 2018b ) . We found that hyperparameter sweeps can give better performance for individual environments, but the values listed above gave a strong performance universally. We found the replay buffer size to be a sensitive hyperparameter for ARO-DDPG, in particular for maintaining its asymptotic performance. We chose the largest replay buffer for ARO-DDPG (equivalent to total environment interactions), but further tuning is left to future work as it is an expensive environment-dependent operation. We also note that beyond the default hyperparameters for ASAC described above, we did not perform any tuning, showcasing ASAC’s robustness to hyperparameter choice. Future work may entail an extensive hyperparameter sweep and sensitivity analysis to further understand the robustness and maximize performance across various environments. Figure 3 : Comparison to SAC shows that our average-reward extension outperforms the original discounted SAC on the environments tested. It is worth recalling that SAC and ASAC are inherently designed to optimize different objectives (a discounted return and average reward, respectively), despite the prevalent use of SAC as a surrogate for optimizing the average reward. Nevertheless, we give a comparison between the two algorithms here for completeness. We note that the reward values are different than in earlier environment versions (as used in e.g. Haarnoja et al. (2018b) ), as the result of an updated reward function and bug fixes (including changes to contact forces, control costs), described in detail here: https://farama.org/Gymnasium-MuJoCo-v5_Environments . Algorithm 1 Average-Reward Soft Actor-Critic (ASAC) 1: Initialize policy parameters \phi , Q -function parameters \psi_{1},\psi_{2} . 2: Initialize target parameters \bar{\psi}_{1}\leftarrow\psi_{1} , \bar{\psi}_{2}\leftarrow\psi_{2} . 3: Initialize learning rates and optimizers (Adam). 4: Initialize mini-batch size b , Polyak step-size \tau , temperature \alpha (fixed), replay buffer \mathcal{D} . 5: while not converged do 6: Observe state s_{t} and sample action a_{t}\sim\pi_{\phi}(\cdot\mid s_{t}) 7: Execute a_{t} , observe reward r_{t} and next state s_{t+1} 8: Store (s_{t},a_{t},r_{t},s_{t+1}) in replay buffer \mathcal{D} 9: for each gradient step do 10: Sample mini-batch of b tuples (s_{i},a_{i},r_{i},s^{\prime}_{i})\sim\mathcal{D} 11: Sample a^{\prime}_{i}\sim\pi_{\phi}(\cdot\mid s^{\prime}_{i}) 12: Shift the target Q -functions to pass through the origin: Q_{\bar{\psi}_{j}}(s,a)\leftarrow Q_{\bar{\psi}_{j}}(s,a)-Q_{\bar{\psi}_{j}}(0,0) 13: Use pessimistic estimate by taking the pointwise minimum: Q_{\bar{\psi}}(s,a)\leftarrow\min_{j=1,2}Q_{\bar{\psi}_{j}}(s,a)\quad\forall(s,a) 14: If episode terminated at s^{\prime} , apply adaptive penalty: r\leftarrow r-p\quad\text{where}\quad p\leftarrow(1-\tau)p+\tau\bar{p}\text{ and }\bar{p}=p_{0}\cdot\frac{1}{b}\sum_{r\sim\mathcal{B}}r 15: Compute target: \hat{y}(r,\theta;\bar{\psi},\phi)=r-\theta+\mathbb{E}_{a^{\prime}\sim\pi_{\phi}(\cdot\mid s^{\prime})}\left[Q_{\bar{\psi}}(s^{\prime},a^{\prime})-\beta^{-1}\log\frac{\pi_{\phi}(a^{\prime}\mid s^{\prime})}{\pi_{0}(a^{\prime}\mid s^{\prime})}\right] 16: Update Q -functions (for \psi\in\{\psi_{1},\psi_{2}\} ) by minimizing: \mathcal{L}_{\psi}=\frac{1}{b}\sum_{(s,a,r,s^{\prime})\sim\mathcal{B}}\left(Q_{\psi}(s,a)-\hat{y}(r,\theta;\bar{\psi},\phi)\right)^{2} 17: Update policy by minimizing (using pessimistic estimate of online networks Q_{\psi} ): \mathcal{L}_{\phi}=\frac{1}{b}\sum_{s\in\mathcal{B}}\mathbb{E}_{a\sim\pi_{\phi}}\left[\log\frac{\pi_{\phi}(a\mid s)}{\pi_{0}(a\mid s)}-\beta^{-1}Q_{\psi}(s,a)\right] 18: Update ERAR rate \theta by minimizing \mathcal{L}_{\theta}=(\theta-\bar{\theta})^{2} where: \bar{\theta}=\frac{1}{b}\sum_{(s,a,r)\sim\mathcal{B}}\left[r-\beta^{-1}\log\frac{\pi_{\phi}(a\mid s)}{\pi_{0}(a\mid s)}\right] 19: Update target networks: \bar{\psi}_{j}\leftarrow\tau\psi_{j}+(1-\tau)\bar{\psi}_{j}\quad\text{for }j=1,2 20: end for 21: end while 8 , 30