{'fraction_non_alphanumeric': 0.05226126724778173, 'fraction_numerical': 0.011257475667435407, 'mean_word_length': 4.353421217827997, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Energy Efficient Edge Computing: When Lyapunov Meets Distributed Reinforcement Learning

In this work, we study the problem of energy-efficient computation offloading enabled by edge computing. In the considered scenario, multiple users simultaneously compete for limited radio and edge computing resources to get offloaded tasks processed under a delay constraint, with the possibility of exploiting low power sleep modes at all network nodes. The radio resource allocation takes into account inter- and intra-cell interference, and the duty cycles of the radio and computing equipment have to be jointly optimized to minimize the overall energy consumption. To address this issue, we formulate the underlying problem as a dynamic long-term optimization. Then, based on Lyapunov stochastic optimization tools, we decouple the formulated problem into a CPU scheduling problem and a radio resource allocation problem to be solved in a per-slot basis. Whereas the first one can be optimally and efficiently solved using a fast iterative algorithm, the second one is solved using distributed multi-agent reinforcement learning due to its non-convexity and NP-hardness. The resulting framework achieves up to 96.5% performance of the optimal strategy based on exhaustive search, while drastically reducing complexity. The proposed solution also allows to increase the network's energy efficiency compared to a benchmark heuristic approach.


I. INTRODUCTION
Wireless communication networks are experiencing an unprecedented revolution, evolving from pure communication systems towards a tight integration of communication, computation, caching, and control [1]. Such a heterogeneous ecosystem requires a flexible network design and orchestration, able to accommodate on the same network infrastructure all the different services with their requirements in terms of energy, latency, and reliability. This requires an enhancement of the radio access network, e.g., through the adoption of millimeter wave (mmWave) communications, densification of access points (APs), and a flexible management of the physical layer [2]. In addition, the deployment of computing and storage capabilities at the network edge will enable network function virtualization and a fast processing of the myriad of data collected by sensors, cars, mobile devices, etc. For this, Edge Computing 1 was conceived to enable energy efficient, lowlatency, highly reliable services by bringing cloud resources close to the users.
In this context, dynamic computation offloading allows resource-poor devices to transfer application execution to Edge This work was supported by the H2020 EU/Taiwan Project 5G CONNI, Nr. 861459. 1 It is standardized by ETSI as Multi-access Edge Computing (MEC) (https://www.etsi.org/technologies/multi-access-edge-computing). Servers (ESs) to reduce energy consumption and/or latency. From a network management perspective, this task is complex and requires the joint optimization of radio and computation resources. This problem has received wide attention [3]. In [4], a scheduling strategy is proposed to counterbalance task completion ratio and throughput, hinging on Lyapunov optimization. [5] aims at minimizing the long-term average delay under a long-term average power consumption constraint. In [6], the long-term average energy consumption of a MEC network is minimized under a delay constraint, using a MEC sleep control. [7] minimizes the energy consumption under a mean service delay constraint, optimizing the number of active base stations and the ESs' computation resource allocation, leveraging sleep modes for APs and ESs. In [8], Lyapunov optimization is used to reduce the energy consumption of a fog network, guaranteeing an average response time. In [9], devices' and APs' energy consumption is minimized via Lyapunov optimization, Lagrange multipliers and sub-gradient techniques, using APs' sleep state, under latency constraints.
Recently, the advances of machine learning and Deep Reinforcement Learning (DRL) in wireless networks have opened up new possibilities for low-complexity and efficient algorithms for MEC [1], especially when model-based optimization is challenged by the difficulty or even impossibility of writing mathematical models that accurately predict the networks' behavior. In this sense, the authors of [10] propose to couple model-based Lyapunov optimization with modelfree DRL and formulate a sum-rate maximization problem under queue stability and long-term device energy constraints. However, their reference scenario considers a single AP, and no CPU scheduling is optimized at the ES. [11] also considers the same approach, with the aim of minimizing the sum of the power consumption of the edge nodes, and a cost charged by a central cloud to help the edge node in processing the tasks under stability constraints. However, they do not consider the energy consumption of end users and APs.
In this paper, we combine the convenience of a modelbased solution that exploits Lyapunov stochastic optimization, with the power of model-free solutions based on multi-agent reinforcement learning (MARL), aiming at energy efficient computation offloading from an overall network perspective. We consider multiple user equipments (UEs) that perform computation offloading and compete for computation resources at an ES and for radio resources, interfering onto each other's transmissions. We treat the problem as a long-term system energy minimization with average end-to-end delay constraints, in a network with multiple APs and one ES, all exploiting low-power sleep operation modes. Although we do not assume any knowledge on radio channels and data arrival statistics, our online solution optimizes in each time slot the UE-AP association in a distributed way, and the ES's CPU scheduling via a fast iterative algorithm whose solution's complexity scales linearly in the number of UEs.
Compared to the cited works, the originality of our strategy consists in simultaneously: i) minimizing the duty cycles of all the network elements under delay constraints; ii) effectively managing radio interference; iii) being low-complexity; iv) combining Lyapunov optimization with DRL; v) being distributed and compatible with UE's mobility. The latter point, in sharp contrast with [10], results from the zero-shot generalization capability of our solution: it optimizes the learned computation offloading policy for all possible deployments of UEs using attention neural networks, and adapts when the number of UEs differs from the initial training point.

II. SYSTEM MODEL
We consider the scenario of Fig. 1, where K UEs offload computational tasks to an ES, via one out of N possible APs. Let U and A be the sets of UEs and APs, respectively. Also, let A k be the set of APs UE k can be associated with. In our dynamic system, time is divided in slots of equal duration τ . Specifically, we assume that a fraction β ∈ (0, 1) of each slot is devoted to control signaling and (1−β) to data transmission and computation, both potentially happening simultaneously. At each time slot t, radio channels and data arrivals at the UEs vary according to a priori unknown statistics. Consequently, the achievable data rate over the radio channels and the computation rate at the ES vary with time. A. Radio access and data rate model In this paper, we consider uplink communications for computation offloading. Specifically, we assume spatial division multiple access. All UEs are served by the APs over the same time-frequency resources but with different beams. In this scenario, uplink communications are affected by both intraand inter-cell interference. Indeed, suppose that UE k is served by AP n at time t. Let p u,tx k (t) be the uplink transmit power of UE k, G ch kn (t) the channel power gain between UE k and AP n, G tx kn (t) the transmit antenna gain towards the direction of AP n, G rx kn (t) the receive antenna gain, B the allocated bandwidth, and N 0 the noise power spectral density. Then, the signal-to-interference-plus-noise ratio (SINR) is given by is the overall interference. Then, the achievable rate of UE k at time t is R k (t) = B log 2 (1 + SINR k (t)). If the k-th UE's offloadable data unit is encoded into S k bits, the number of data units transmitted in the uplink direction at time t is . . .
Processing Queues Then, denoting by J k the number of processed data units per CPU cycle, the number of data units processed over one slot is C. Delay and queuing model In our setting, computation offloading involves two steps: i) an uplink transmission phase of input data from the UEs; ii) a computation phase at the ES. New data units are continuously generated from an application at the UE's side and consequently offloaded and processed at the ES. In particular, once generated, data are queued locally at the UEs, then uploaded to the ES through one AP with time varying data rate as in (1). At the ES, they are queued waiting to be processed and they are finally computed with time varying computational rate as in (2). Thus, we represent the overall system through a simple queuing model involving both queues, synthetically depicted in Fig. 1. Accordingly, each data unit experiences two different delays: i) a communication delay, including buffering at the UE; ii) a computation delay, including buffering at the ES. As shown later, we take into account these two delays jointly, as in [12]. UE k's uplink communication queue evolves as Q l is the number of newly arrived offloadable data units generated by the application at the UE at time t, which is the realization of a random process whose statistics are unknown a priori. The remote computation queue at the ES evolves as Q s . End-to-end delay constraints. By Little's law [13], given a stationary queueing system, the average overall service delay is proportional to the average queue length. Then, in our system, the overall delay is directly related to the sum of the uplink communication queue and the computation queue Q tot k (t) = Q l k (t) + Q s k (t). In particular, ifD k = E {D k (t)/τ } is the average data unit arrival rate, the long-term average end-to-end delay L avg k experienced by a data unit generated by UE k is given by the ratio between the average of Q tot k and the average arrival rate. Thus, our constraint on the long-term average delay L avg k is formulated as follows: Note:D k is not known a priori, but can be estimated online.

D. Energy consumption model
We exploit low-power operation modes at UEs, APs, and ES to reduce the overall energy consumption. However, due to control signaling, UEs, APs, and ES are active for at least βτ seconds in each slot, consuming active power. Hence, the energy consumption of each entity is modeled as follows: UE Energy Consumption. Let x k,n (t) ∈ {0, 1} be an association variable equal to 1 if and only if UE k offloads its data via AP n at time t. Let p u,off k and p u,on k be UE k's sleep and active power, respectively. Then, the total UEs' energy consumption at time t is: where I u it does not transmit at time t, I u k (t) = 0, and p u,tx k (t) = 0. AP Energy Consumption. Let p a,off n and p a,on n be the n-th AP's sleep and active power consumption, respectively. The total APs' energy consumption at time t is where I a n (t) = max k∈U {x k,n (t)} indicates whether AP n is active (I a n (t) = 1) or not (I a n (t) = 0). ES Energy Consumption. To reduce the energy consumption, we adopt both a low-power sleep mode for the ES, when no computation is performed at a given slot t, and a scaling of the CPU frequency f c (t), when the CPU is active and computing [14]. Namely, the CPU core consumes a power p on s in active state, and a power p off s < p on s in sleep state. When the ES is active, the dynamic power spent for computation is p c s (t) = κf 3 c (t), where κ is the effective switched capacitance of the processor [15]. In particular, we assume that f c (t) can be dynamically selected from a finite set F = {0, . . . , f max }. Therefore, the ES's energy consumption at time t is E s (t) = (1 − β)τ I s (t) (p on s + p c s (t)) + (1 − I s (t))p off s + βτ p on s , where I s (t) = 1{f c (t)}, with 1{·} the indicator function, indicates whether the ES is active (I s (t) = 1) or not (I s (t) = 0). From (4), (5), (6), the total system energy consumption at time t is E tot (t) = E s (t) + E a (t) + E u (t). Our objective function is a convex combination of its terms: with 3 i=1 α i = 1. Different α i lead to different strategies. For example, α 1 = 1 models a user-centric strategy, where only UEs' energy consumption is optimized. α i = 1/3, ∀i yields a holistic strategy that includes the whole network's energy [16].

III. PROBLEM FORMULATION
We formulate the following minimization problem on the weighted network energy consumption, subject to (3) and instantaneous constraints on the optimization variables: where Ψ(t) = [{x k,n (t)} k,n , f c (t), {f k (t)} k ] and the expectation is taken with respect to the random input data unit generation and radio channels, whose statistics are unknown. (C1) is the delay constraint. (C2)-(C7) mean what follows: (C2) the UE-AP association variables are binary; (C3) the number of UEs assigned to each AP cannot exceed a maximum N n ; (C4) each UE is assigned to at most one AP; (C5)-(C7) the computation frequencies assigned to each user are non negative and their sum cannot exceed the total CPU frequency of the ES, chosen from the finite set F. Directly solving (P 0 ) is very challenging due to the unavailability of the statistics. Therefore, we hinge on Lyapunov optimization. To handle (C1), we introduce virtual queues [17] Z k (t) that evolve as Z k (t+1) = max(0, Z k (t)+Q tot k (t+1)− Q avg k ) for all k. Z k (t) is a state variable that measures how the system behaves w.r.t. (C1): it increases if the instantaneous value of Q tot k (t) violates the constraint, and decreases otherwise. It can be easily shown [17] To ensure this, we introduce the Lyapunov and the drift-pluspenalty functions: ∆ p (Z(t)) = E {L(Z(t + 1)) − L(Z(t)) + Ω · E w (t)|Z(t)} .
Here, L(Z(t)) "measures" the system's congestion, whereas ∆ p (Z(t)) is the conditional expected variation of L(Z(t)) over one slot, plus a penalty factor weighted by Ω, which trades off queue backlogs and the objective function of (P 0 ) [17].
Proposition 1. If the radio channel states and the input data generation are i.i.d. over time slots, the optimal solution of (P 0 ) is obtained when optimally solving the following two sub-problems for a sufficiently high value of Ω. For CPU scheduling: At time t, solve the following problem: subject to (C5)-(C7) of (P 0 ).

Sketch of proof.
From [17], we know that, if ∆ p (Z(t)) is bounded, the Z k (t)'s are mean rate stable and therefore (C1) is guaranteed. Now, the main statement follows because minimizing a proper upper bound of ∆ p (Z(t)) under (C2)-(C7) is equivalent to optimally solving (P 0 ) when Ω is sufficiently large [17,Th. 4.8]. The considered upper bound is: where ζ > 0 is a constant and χ k (t) does not depend on the optimization variables. To obtain (9), note first that [17, p. 59] Then, apply (10) and the following two inequalities to the Full derivations and expressions of ζ and χ k (t) are omitted due to the lack of space, but follow a similar approach as in [12], [16]. Now, according to the concept of greedy optimization of a conditional expectation [17], to obtain an optimal policy it is sufficient to minimize (9) in a slot-by-slot fashion, only based on the observation of instantaneous queue lengths, radio channels, and data generation at the UEs. The decomposition into two sub-problems is straightforward because radio and computing optimization variables are decoupled in (9) and can be treated independently. Problem (P 1 ) can be efficiently and optimally solved using a fast iterative algorithm as in [16], which requires at most K × |F| iterations. However, (P 2 ) is more complex as it is non-convex and NP-hard [18]. Therefore, we propose a MARL strategy, where UEs, modeled as autonomous agents, learn to offload tasks over multiple episodes of random deployments to maximize a long-term γ-discounted reward is the common reward perceived by each UE at time t and T is the length of an episode. From a Lyapunov optimization perspective, the long-term goal (minimization of the long-term average energy) is guaranteed when (P 2 ) is solved optimally slot by slot. Here, this is achieved by myopically maximizing the instantaneous reward instead of the long-term reward, i.e., by setting γ = 0. Remark 1. During an episode, r(t) can drop to −∞ due to the presence of queues in the expression of G 2 (t), which is not bounded. To solve this problem, note that in a feasible scenario, the queues growing to infinity result from UEs deciding systematically to not offload (which is a wrong policy). Hence, we define two clipping values Q clip k = (1+ 1 )Q avg k and Z clip k = (1 + 2 )(Q avg k ) 2 , parameterized by 1 , 2 and considered as the maximum tolerable value of physical and virtual queues respectively, above which an episode terminates with a failure. In this way, we improve the learning convergence, as UEs are quickly notified of their failure.

IV. PROPOSED LYAPUNOV-AIDED MARL FOR MOBILE EDGE COMPUTING
To solve the radio resource allocation problem (P 2 ), we propose a MARL framework. Fig. 2 describes the proposed architecture, made of encoding functions f (·), g(·), and h(·) for features extraction, a message aggregator, an actor-critic module for policy training, and an action selector for task offloading decisions. UEs share the same policy architecture and the same parameters. However, this does not preclude UEs from taking different decisions, due to their different environment observations in the same slot. In contrast, sharing parameters limits complexity (as there is only one common policy to learn), enables efficient training, and helps to improve convergence. Inspired by our previous work [18], let o R k (t) denote the set of "radio observations" of UE k: a k (t−1) ∈ A k denotes UE k's action (i.e., connection request to an AP) at time t−1, R k,a k (t−1) is the perceived rate, R(t− 1) the total network sum-rate, and ACK k the received connection acknowledgment signal. {RSS k,n } n∈A k , {ϑ k,n } n∈A k indicate the received signal strength and corresponding angles of arrival (AoA) from UE k to AP n. Similarly, o C k (t) represents "MEC observations", related to task offloading: where Q l k (t), Q s k (t), Z k (t) are the queues defined above, (x k , y k ) are UE k's geographical coordinates, and f k (t) its allocated CPU frequency at the ES. In our framework, after observing o R k (t), UE k builds its local state encoding u k , which represents its "perception" of the radio environment, using an encoding function f (·), e.g., a neural network. Then, based on the aggregated MEC observations of its whole neighborhood, it constructs an encoding vector v k , which characterizes its perception of the network from a computation viewpoint. UE k then builds its overall context encoding vector c k to represent its global understanding of the environment, using an encoding function h(·), e.g., a concatenation operator or a neural network. For each UE, the goal of the MARL framework is to learn an association policy π θ with learnable parameters θ, where π θ (a k (t)|o k (t)) = p a k (t),k indicates the probability of taking action a k (t) after observing o k (t) = {o R k (t), o C k (t)}. Note that p k (t) = [p 0,k , . . . , p N,k ] ∈ [0, 1] N +1 , from which the action a k (t) of the UE will be sampled, is such that n∈A p n,k = 1 and p n,k = 0 for all n ∈ A k .

A. Message passing service
Let W k , W q , and W ν : R 6 × R m be learnable weights, describing the set of parameters of the encoding function g(·), which we later refer to as the message generator. For each UE l, let , and m l = {q l , ν l } be the key, the query, the value, and the message associated with UE l. Then, each UE k, after aggregating the messages from its neighbors N k , computes its encoding vector v k = l∈N k α l,k ν l , where the score α l,k represents the interaction between UEs l and k (in achieving the underlying optimization goal). This score is calculated using dot-product attention mechanism [19]: Here, softmax(·) denotes the normalized exponential function. Note that computing v k only involves the queries and the values from others UEs in N k and not their keys, which are UE-specific and do not need to be transmitted. Such a message passing service enables the scalability and the transferability of the learned policy, which is optimized for all possible UE deployments, in sharp contrast with [10], which requires fixed UEs. In other words, in our framework, a change in the number or position of UEs in the network does not require a new policy training and does not impact the architecture of the policy network. Only the number of exchanged messages varies, depending on the variation of a UE's neighborhood. Both, the input variables and the number of neurons of the encoding functions remain fixed. This enables curriculum learning, where a policy obtained from e.g. 6 UEs can be leveraged as a starting point to train another policy for K > 6 UEs. Finally, all the encoding functions, including the message generator, are optimized through end-to-end proximal policy optimization (PPO) and an actor-critic framework [20].
V. NUMERICAL RESULTS In this section, we assess the effectiveness of the proposed framework in a network of 3 APs 2 operating at 28-GHz mmWave frequencies and for K ∈ {6, 9, 12, 15} UEs. We use p u,off = 0.346 W, p u,on = 0.9 W, p a,off = 0.278 W, p a,on = 2.2 W, p s,off = 10 W, p s,on = 20 W. Each UE transmits with power p u,tx (t) = min p tg k (t), p max over a bandwidth B = 10 MHz, where p tg k (t) is the power to meet a predefined target SNR of 15 dB and p max = 0.1 W. Each slot lasts 10 ms and we set β = 0.1, N n = 15, κ = 10 −27 , J k = 10 −3 , S k = 1500 bits ∀k and F = {0, 0.1, . . . , 1} × 10 9 cycle/s. UEs' data generation rate follows a Poisson distribution with mean D k = 50 × S k bits ∀k. Additional parameters, including pathloss and antenna diagrams, can be found in [18, Table  I]. In our setup, all encoding functions are composed of one multi-layer perceptron (MLPs) of m = 128 neurons with a rectifier linear unit (ReLu) activation. Both the actor and the critic module comprise 2m neurons and we empirically set the learning rate to 10 −4 , 1 = 10 and 2 = 0. To foster the learned policy and enable better generalization, during training, we consider random CPU scheduling 3 . This is possible since (P 1 ) and (P 2 ) are completely decoupled, therefore, the policy learned to solve (P 2 ) must be independent of the ES frequency allocation. We compare our solution, labeled L2OFF (Learning to Offload) in Fig. 3 and 4, to two benchmarks: • Exhaustive search: at each slot, we perform an exhaustive search over all possible solutions of (P 2 ). • Max-SNR: each UE is associated with a Bernoulli random variable with probability p of being in active state (which models the average duty cycle of UEs). Then, at each t, an active UE gets associated with the AP providing the maximum signal-to-noise ratio (SNR). All results are averaged over 200 random deployments of UEs. Energy-delay trade-off vs. Ω. Here, we evaluate the performance of our proposed framework for different values  of Ω (cf. (8)), and compare the results to the performance obtained via exhaustive search in Fig. 3. First, we observe the results suggested by the theory: when Ω increases, optimally solving (P 1 ) and (P 2 ) leads to a lower energy consumption. Meanwhile, the average delay increases and caps to 100ms, which is the fixed delay constraint (C1). Interestingly, the proposed scheme exhibits performance close to exhaustive search approach (for Ω = 10 9 ), reaching up to 96.5% of its performance, for the same delay. Performance Comparison. To fairly compare the proposed framework with the heuristic based on Max-SNR, we first determine exhaustively the optimal lowest duty cycle that enables the Max-SNR algorithm to guarantee an average delay constraint of 100 ms. Then, comparison is made for the same delay in Fig. 4. We can notice how, even by optimally computing the duty cycle for the Max-SNR algorithm, our solution still outperforms, reducing the energy by 10% for 15 UEs compared to Max-SNR solution, as we consider interference, and intelligently orchestrate UEs. Moreover, under the same delay constraint, with our strategy, the network consumes 246 mJ in average for 15 UEs, whereas for the same energy consumption, the Max-SNR can only serve 12 UEs.

VI. CONCLUSION
In this work, we proposed a novel approach for delay constrained energy-efficient computation offloading services in dense mmWave networks impaired by interference. We first formulated the computation offloading as a long-term optimization. Then, we applied Lyapunov optimization tools to split the problem into a CPU scheduling problem and a UE-AP association problem. While the first one is easily solvable via an efficient iterative algorithm, we solved the second one thanks to multi-agent reinforcement learning with a distributed and transferable policy. The proposed solution reaches up to 96.5% of the optimal solution obtained via exhaustive search and can reduce energy consumption up to 10% compared to a heuristic approach based on SNR maximization.