# Mean-Field Stackelberg Game-Based Security Defense and Resource Optimization in Edge Computing
## 3 System Model and Problem Statement  
In this section, we consider an edge computing system with \(N\) defender nodes, and the attackers modeled as one player. As shown in Figure 1, the structure of the edge computing architecture comprises three layers, which are named the terminal device layer, the edge layer, and the cloud layer. Edge computing architecture enables practical applications by providing resources and services through collaborative computing between the terminal and the edge cloud. Edge servers are connected to the cloud, which collects and centrally analyzes data from terminal devices and provides feedback to the bottom two layers. The terminal devices with limited resources process the calculation and storage of local real-tasks. In this paper, the dynamic interactions between attackers and defenders are studied by using mean-field Stackelberg differential games, in which the attacker can be considered as the leader and the defenders as the followers. The attacker chooses the strategy before the start of the games and announces it to the defenders. The defenders choose their optimal strategies noncooperatively and simultaneously based on the attack level. Moreover, the information structures for both the attacker and the defenders are given by each agent's initial condition in the proposed game model. We consider \(\{x_{i}(t),1\leq i\leq N\}\) as the resource consumption level of the edge device \(i\), \(x_{0}(t)\) as the number of attackers, \(u_{i}(t)\) as the defense level of the defender \(i(1\leq i\leq N)\), and \(u_{0}(t)\) as the attack level of the attacker. The evolution of the system states is influenced by the strategic decisions made by both the defenders and attackers in the context of edge computing security. The evolution of the state \(x_{i}(t)\) is also related to the mass behavior of the defenders. \(\left\|x\right\|^{2}=<x,x>\) denotes the induced 2-norm. Hence, the dynamic evolution states of the defenders and attackers can be given by  
\[\frac{dx_{i}(t)}{dt}=a_{i}x_{i}(t)+b_{i}u_{i}(t)+c_{i}\left\|x_{i}(t)-Ax^{N}(t )\right\|^{2}+c_{0}u_{0}(t) \tag{1}\]  
\[\frac{dx_{0}(t)}{dt}=a_{0}x_{0}(t)+b_{0}u_{0}(t)+\sum\limits_{i=1}^{N}x_{i}u_{ i}(t) \tag{2}\]  
where \(a_{i}\), \(b_{i}\), \(a_{0}\), \(b_{0}\), \(c_{i}\), \(c_{0}\), and \(\lambda_{i}\) are the real parameters. Specifically, \(a_{i}\) is a random coefficient of resource consumption to process the local tasks for the device \(i\), \(b_{i}\) is the probability of the device responding to the defense mechanism. \(x^{N}(t)=\frac{1}{N}\sum\limits_{i=1}^{N}x_{i}(t)\) is the mean-field term that captures the mass behavior of all the edge devices. \(c_{i}\left\|x_{i}(t)-Ax^{N}(t)\right\|^{2}\) means the available resource to detect the behavior of the attackers. \(b_{0}\) is the probability of successful attacks, and \(x_{i}\) is the probability that the number of attackers is detected and filtered by the defense mechanisms. For the defenders, the purpose is to reduce the limited resource consumption, minimize the loss caused by the attackers, and obtain the optimal strategies to maximize against the attacks. The objective function of the defenders is given by  
\[J_{i}(x_{i},u_{i},u_{0})=\underset{u_{i}(t)\to 0}{\min}\int_{0}^{T}\!\! \left[\alpha_{i}\|x_{i}(t)-Ax^{N}(t)\right]^{2}+\beta_{i}\|u_{i}(t)\|^{2}+ \lambda_{i}u_{i}(t)u_{0}(t)\right]\!dt \tag{3}\]  
where \(\alpha_{i},\beta_{i}(i=1,2,\cdots,N)\) are positive numbers satisfying \(\sum\
olimits_{i=1}^{N}\alpha_{i}=1,\alpha_{i}\|x_{i}(t)-Ax^{N}(t)\|^{2}\) is the cost of deviation from the whole average resource level of the node, \(\beta_{i}\|u_{i}(t)\|^{2}\) is the cost of the defense mechanisms, and \(\lambda_{i}u_{i}^{T}(t)u_{0}(t)\) is the payment for defenders, which  
Figure 1: The architecture of edge computing. depends on both the defense mechanisms and the attack level. Meanwhile, the attacker aims to choose the optimal attack strategy to damage the edge devices and try to increase its attack intensity by maximizing its attack frequency.