---
title: Dirichlet D3PG for MEC Offloading
url: https://www.emergentmind.com/topics/dirichlet-ddpg-d3pg
type: topic
---

# Dirichlet D3PG for MEC Offloading

Dirichlet Deep Deterministic Policy Gradient (D3PG) is a deep reinforcement learning algorithm designed for constrained hybrid action spaces, prominently in dynamic environments encountered in Mobile Edge Computing (MEC). D3PG addresses the challenge of simultaneous task partitioning (distribution over edge servers) and computational power allocation (continuous values), as formulated in a Markov decision process (MDP) with a hybrid, tightly constrained action space. The algorithm extends the conventional Deep Deterministic Policy Gradient (DDPG) framework by introducing a Dirichlet policy head to parameterize simplex-constrained action components, while separately handling standard real-valued actions. The approach directly supports multi-objective optimization tasks critical to MEC—including maximizing task completions before deadlines, minimizing energy expenditure, and reducing service latency—while effectively managing requirements such as sum-to-one constraints and continuous control [2112.09328].

## 1. Markov Decision Process Formulation for MEC Offloading

D3PG operates within a Markov decision process framework adapted to represent the MEC setting with multiple IoT devices and heterogeneous edge servers. The state at each decision epoch, $s_t = (M, \zeta, \Omega)$, consists of:

- $M = (m_1, ..., m_K)$: For each of $K$ edge servers, this vector contains the current queue length, remaining running time of the head-of-queue task, and available CPU frequency.
- $\zeta = \{\zeta_{i,j}\}$: The uplink rate matrix, specifying the wireless transmission rate from each user $i$ to each server $j$.
- $\Omega = \{\Omega_i\}$: The set of newly arrived computation tasks, where $\Omega_i = (D_i, C_i, \Delta_i^{max})$ encodes the task data size, required CPU cycles, and deadline.

The hybrid action at each epoch is $a_t=(\Phi_t,F_t)$, where:
- $\Phi_t = (\phi_1,...,\phi_K)\sim\textrm{Dirichlet}(\psi)$: The task partition vector, specifying the fraction of the current task to offload to each server; subject to $\phi_j\geq 0$ and $\sum_j \phi_j=1$.
- $F_t = (f_1,...,f_K)$: The CPU frequency allocations per server, where $f_j\in[0,1]$ is the normalized proportion of each server’s $f_j^{max}$.

The transition dynamics $p(s_{t+1}\mid s_t, a_t)$ arise from the stochastic evolution of server queues, wireless channels, and task arrivals.

The scalar reward at time $t$ is a composite of multiple objectives:
$$
R_t = \alpha w_1 \Lambda_t - (1-\alpha)w_2 \log(E_t) - w_3 \log(T_t) + C
$$
where $\Lambda_t$ indicates task completion within deadline, $E_t$ is the aggregate energy cost (transmission plus computation), $T_t$ is incurred latency, and $w_k$ are normalization scalars; $C$ is a small regularization constant and $\alpha\in[0,1]$ sets a success-versus-cost tradeoff.

## 2. Actor–Critic Network Architecture

The D3PG agent employs two neural network modules: an actor and a critic. Both utilize deep multilayer perceptron architectures.

- **Actor Network, $\mu(s\mid \theta^\mu)$**: Input dimension is $\textrm{dim}(M)+K^2+3|\Omega|$. Three hidden layers of 256, 512, and 256 units with ReLU activations culminate in two output heads:
    - **Dirichlet head**: Outputs concentration parameter logits $z \in \mathbb{R}^K$, with $\psi_j = \exp(z_j) + \varepsilon$ ($\varepsilon \approx 10^{-8}$).
    - **Continuous head**: Outputs real values $y \in \mathbb{R}^K$, mapped via a bounded activation (e.g., $[0,1]$ using scaled tanh), with Ornstein-Uhlenbeck noise $\eta_t$ applied for exploration.
    - At run time, $\Phi_t \sim \text{Dirichlet}(\psi)$, $F_t = \text{clip}(y + \eta_t, 0, 1)$.

- **Critic Network, $Q(s,a\mid \theta^Q)$**: Input dimension is $\textrm{dim}(s) + 2K$. Three hidden layers mirror the actor (256–512–256, with ReLU). The output is a scalar Q-value. A target critic of identical architecture, $Q'$, is maintained for stability.

This division allows independent learning of the simplex-constrained distributional action and the regular continuous action.

## 3. Dirichlet Policy Head and Simplex-Constrained Actions

The Dirichlet policy head is central to D3PG’s ability to model simplex-constrained decisions. For each action, a vector $\psi$ of positive concentration parameters is generated; then, $\Phi\sim\text{Dirichlet}(\psi)$. The standard probability density is
$$
p(\Phi;\psi) = \frac{1}{B(\psi)} \prod_{j=1}^K \phi_j^{\psi_j - 1}
$$
with $B(\psi)$ the multivariate Beta function. The exponentiation and $\varepsilon$-offset ensure each $\psi_j>0$.

Sampling follows the Gamma-reparameterization: for $j=1...K$, sample $g_j\sim\textrm{Gamma}(\psi_j, 1)$ and set $\phi_j = g_j/\sum_{m=1}^K g_m$. This allows differentiability for policy gradient updates via the score-function estimator or explicit reparameterization.

This approach ensures all partitioning actions satisfy both non-negativity and sum-to-one constraints at every timestep, a property not guaranteed by unconstrained parameterizations or direct softmax transformation followed by Gaussian noise.

## 4. Training Procedure and Loss Functions

D3PG training follows an off-policy actor-critic routine utilizing deep experience replay. For each time step:

1. The actor produces logits $z$ and frequency values $y$ from $s_t$.
2. Concentration parameters are computed as $\psi = \exp(z)+\varepsilon$, then $\Phi_t\sim\textrm{Dirichlet}(\psi)$.
3. The complete action $a_t=(\Phi_t, \textrm{clip}(y+\eta_t,0,1))$ is executed in the environment, and the outcome $(s_{t+1}, r_t)$ sampled.
4. Transitions are stored in replay buffer $D$.
5. For each update cycle, minibatches are drawn from $D$.

Loss terms are:
- **Critic (Bellman error):**
$$
L_Q(\theta^Q) = \frac{1}{N} \sum_{i=1}^N [Q(s_i,a_i\mid\theta^Q) - y_i]^2
$$
where $y_i = r_i + \gamma Q'(s_i', \mu'(s_i'))$.
- **Actor (deterministic policy gradient):**
$$
\nabla_{\theta^\mu} J \approx \frac{1}{N} \sum_{i=1}^N \nabla_a Q(s, a\mid\theta^Q)\Big|_{s_i,a=\mu(s_i)} \cdot \nabla_{\theta^\mu}\mu(s_i\mid\theta^\mu)
$$
with actions sampled as $(\Phi, y + \eta)$.

Target networks are softly updated at each step, e.g., $\theta^{Q'}\leftarrow \tau\theta^Q + (1-\tau)\theta^{Q'}$ for small $\tau$.

A concise high-level pseudocode is provided:

| Algorithm Component           | Operation/Role                                            | Details                                    |
|------------------------------|----------------------------------------------------------|---------------------------------------------|
| Actor Forward                | State $\rightarrow$ Dirichlet logits + frequency         | $\psi = \exp(z) + \varepsilon$, $y$        |
| Action Sampling              | $\Phi\sim$ Dirichlet($\psi$), $F_t=\text{clip}(y+\eta,0,1)$ | Gamma reparameterization + noise           |
| Critic Forward               | $(s,a)$ to Q-value                                       | Used for Bellman error/actor gradient       |
| Target Networks              | Gradual update                                           | $\theta'\leftarrow \tau\theta + (1-\tau)\theta'$ |

## 5. Comparison with Existing Methods and Key Algorithmic Innovations

Standard DDPG algorithms are designed for unconstrained, real-valued action spaces. In the MEC task offloading problem, a sub-action (task-slice allocation) must satisfy strict simplex constraints, which standard DDPG cannot natively enforce. D3PG’s Dirichlet parameterization:

- Guarantees simplex-constrained actions without requiring post-processing.
- Provides intrinsic stochasticity for exploration, supplanting ad hoc $\varepsilon$-greedy schemes.
- Removes reliance on softmax transformations followed by Gaussian noise, which can yield suboptimal or locally-trapped solutions.

Ablation studies underline that Dirichlet-based policy heads outperform variants using naïve softmax-plus-noise or those neglecting action constraints (e.g., treating all actions as unconstrained continuous or purely discrete).

## 6. Experimental Evaluation and Performance

Simulation experiments were conducted on MEC settings with up to 1,000 IoT users and 50 edge servers, encompassing diverse hardware profiles (e.g., $f_j^{max}\in[2\, \text{GHz},\,8\, \text{GHz}]$), and task sizes $D_i\in[2\cdot10^5,2\cdot10^7]$ bits. The D3PG agent was compared against DDPG, DDPG with softmax-partitioning, Twin Delayed DDPG (TD3), and a greedy offloading heuristic. Key configurations included five-layer neural architectures (input–256–512–256–output), batch size 256, learning rate $5\times10^{-4}$, and $\gamma=0.9$.

Principal performance results:
- D3PG converged to the highest cumulative reward within approximately 1,500 episodes.
- Relative to baselines:
   - 10–20% more tasks completed before deadlines.
   - Approximately 15% lower energy use per completed task.
   - Lower average task latency.
   - Improved episode-length stability (servers are less likely to become overloaded).

Ablation analyses demonstrate the efficacy of Dirichlet-constrained partitioning, which is strictly superior to approaches that either do not enforce simplex constraints or rely on softmaxed Gaussian noise.

## 7. Applicability and Generalization

Although devised for joint task partitioning and computation offloading in MEC with hybrid action types, D3PG provides a general framework for reinforcement learning tasks requiring distribution-valued (simplex-constrained) and real-valued actions. Its architectural division—Dirichlet head for distributional actions and conventional output noise for continuous control—supports principled multi-objective optimization, robust exploration, and compliance with domain-specific constraints in reinforcement learning, both within and beyond MEC environments [2112.09328].

Source: https://www.emergentmind.com/topics/dirichlet-ddpg-d3pg