I Introduction
Recent advancements in digital twins and 6th Generation mobile networks (6G) have paved the way for Industrial Internet of Things (IIoT) [8658105]. A series of edge intelligence use cases such as intelligent transportation [9072340, zk3] and smart city [7945258]
are envisioned to provide highquality services to users in the IIoT network. Data processing based on Artificial Intelligence (AI) algorithms lays the foundation for enabling the provision of intelligent services in the IIoT framework. Despite such enabling technologies and recent developments, the gap between the outcome of data analysis and the true reflection of the status of their physical systems remains a major hurdle in designing robust control algorithms for physical systems
[uhlemann2017digital]. In this regard, the digital twin paradigm [8477101] emerges as one of the most promising technologies in 6G networks that can enable the nearinstant wireless connectivity and extremereliable wireless communication[dang2020should]. Empowered by digital twin, the 6G networks can bridge the physical systems with the digital world in realtime for realizing robust edge intelligence in IIoT.Digital twins represent real objects or subjects with their data, functions, and communication capabilities in the digital space [8289327]. To reduce latency and enhance reliability for edge computing applications, we incorporate digital twins into wireless networks and propose the Digital Twin Wireless Networks (DTWN). By mapping IoT devices to digital twins in edge servers, DTWN improve the efficiency of AI algorithms and mitigates the impact of unreliable communication between users and edge servers. Moreover, DTWN interact with the physical IIoT systems in realtime through data collection and analytics to keep the digital plane synchronised with the physical system. Thus, the running state analysis and optimization of user devices can be conducted directly in the DTWN, which reduces the system cost. We have noted few works that discuss integrating digital twins with physical systems to improve their performance for different applications. For instance, in [8289327], the authors proposed the Experimentable Digital Twins (EDTs) that can be used to realize complex control algorithms or mental models. In particular, the authors constructed a general digital twin for complex equipment and proposed a new method for health management using digital twins [tao2018digital]. In this paper, we propose to integrate digital twins into edge networks to mitigate the resource gap between end users and Base Stations (BSs) for efficient edge computing.
Conventional centralized AI algorithms require data to be transmitted to the server, which incurs high data leakage risks. To enhance data security and protect user privacy, federated learning [mcmahan2017communication, smith2017federated]
has emerged as a new paradigm for distributed machine learning. Different from conventional AI algorithms, federated learning based models require transmitting only the parameters from locally trained models to the server while the original data is stored with the user to alleviate security and privacy risks
[8843900]. To this end, the distributed framework and the enhanced data privacy assurance offered by federated learning have attracted considerable attention and have been well studied for typical MEC applications [9060868] such as content caching [yu2018federated] and vehicular data sharing recently [8998397]. Nonetheless the need of conducting the iterative training process on distributed entities each with possibly limited computing resources can adversely affect the efficiency of federated learning in edge networks. To address the issue, in [wang2019adaptive], the authors proposed a control algorithm to determine the tradeoff between local update and global aggregation under a given resource budget. In [8737464], the authors formulated resource consumption and learning performance into an optimization problem and provided the approximate optimal solution.Moreover, the lack of mutual trust among users is another key factor that can hinder them from participating in the learning process to realize edge intelligence. To deal with this issue, blockchain has been widely explored to build a secure collaborative learning mechanism among untrusted users. For example, the authors in [alcaraz2020blockchain] proposed a three layerbased architecture to manage reliable and secure connections among entities, processes and critical resources for the smart grid. Meanwhile, the efficiency and intelligence of blockchain needs to be further improved. Several studies have explored the synergy between AI algorithms and blockchain to enhance the data security and system reliability aspects in edge intelligence enabled networks. In [zk1], the authors presented an edge intelligence and blockchain empowered framework to enhance the security of edge service management in an IoT scenario. Similarly, in [8998330], the authors integrated blockchain with Deep Reinforcement Learning (DRL) for content caching in vehicular networks. As conventional AI algorithms can suffer much data transmission load while also leading to higher data leakage risk, we propose to integrate blockchain with federated learning to achieve secure and efficient edge intelligence. In our proposed framework, the federated learning parameters are recorded in the blockchain instead of the parameter server thus considerably enhancing the security of parameters and improving the reliability of models from users.
In our proposed framework, DTWN mitigate the unreliability of learning parameter transmission caused by long communication distance and limited communication resource between end users and edge servers (BSs). However, some new challenges also arise for the maintenance of digital twins. First is the associations of digital twins to various servers. It consumes considerable amount of resources to maintain digital twins by synchronizing realtime data and building corresponding models. Due to the dynamic computing and communication resources available with edge servers, the association of digital twins to corresponding servers is a crucial factor in determining the performance of DTWN, which is a largely unexplored dimension in the context of edge networks. Moreover, due to the multiple communication rounds in federated learning, the limited bandwidth available with BSs requires to be optimally allocated to improve the communication efficiency of associated edge servers. In this paper, we first design the new DTWN model by incorporating digital twins into wireless networks to mitigate the unreliable and long distance communication between users and BSs, where the user data is synchronized to BSs to construct corresponding digital twins. Based on the DTWN, we propose a permissioned blockchain empowered federated learning framework for realizing robust edge intelligence. Data analysis can be executed on their digital twins in the BS plane directly instead of in the resource constrained end users. The security and privacy of digital twin data are also enhanced by . To improve the efficiency of the proposed architecture, we formulate an optimization problem for edge association and bandwidth allocation, and design a multiagent reinforcement learning based algorithm to find the optimal solution to it. The main contributions of this paper are summarized as follows.

We design a new digital twin wireless network model DTWN, which uses digital twins to mitigate the unreliable and long distance communication between end users and edge servers.

We define the edge association problem for DTWN, and propose a permissioned blockchain empowered federated learning framework for edge computing in DTWN.

To improve the efficiency of the proposed scheme, we formulate an optimization problem by jointly considering edge association and communication resource allocation to minimize the time cost, and develop a multiagent reinforcement learning based algorithm to find the optimal solution to the problem.
The rest of the paper is organized as follows. In Section II, the blockchain and federated learning model for DTWN is provided. In Section III, we formulate a new edge association problem in DTWN to minimize the total system latency. A multiagent reinforcement learning based algorithm is developed to find the optimal solution to the problem in Section IV. Numerical results are presented in Section V. Finally, Section VI concludes the paper.
Ii Blockchain and Federated Learning Model for Digital Twin Networks
In this section, we first present our DTWN model. Then we describe the edge association problem in DTWN in Section IIA, which is followed by the federated learning model in Section IIB. Then we introduce our blockchain model in Section IIC and the wireless communication model in Section IID.
We consider a blockchain and federated learning empowered digital twin network model as depicted in Fig. 1. The system consists of end users such as IoT devices and mobile devices, BSs, and a Macro Base Station (MBS). The BSs and the MBS are equipped with MEC servers. The end devices generate running data and synchronize their data with corresponding digital twins that run on the BSs. We use to denote the data of end user , where is the data size, is the data collected by end users and is the label of . The digital twin of end user in the BSs are denoted as , which is composed of behavior model , static running data and realtime dynamic state , . and is the essential data required to run digital twin applications. Instead of synchronizing all raw data to digital twins, which incurs great communication load and data leakage risk, we use federated learning to learn model from user data. In various application scenarios, the end users may communicate with other end users to exchange running information and share data, through e.g., Device to Device (D2D) communications. Thus, the digital twins also form a network based on the connections of end users. Based on the constructed DTWN, we can obtain the running states of physical devices and make further decisions to optimize and drive the running of devices by analyzing digital twins directly.
In our proposed digital twin network model, we use federated learning to execute the training and learning process collaboratively for edge intelligence. Moreover, since the end users lack mutual trust and the digital twins consist of private data, we use permissioned blockchain to enhance the system security and data privacy. The permissioned blockchain records the data from digital twins and manages the participating users through permission control. The blockchain is maintained by the BSs, which are also the clients of the federated learning model. The MBS runs as the server for the federated learning model. In each iteration of federated learning, the MBS distributes the machine learning model parameters to BSs for training. The BSs train the model based on data from digital twins and returns the model parameters to the MBS.
Iia Edge Association in DTWN
The end devices or users are mapped to the digital twins in BSs in DTWN. The maintenance of digital twins consumes a large amount of computing and communication resources for synchronizing realtime data and building corresponding models. However, the computation and communication resources in wireless networks are very limited, which should be optimally used to improve the resource utility. Thus, to associate various IoT devices with different BSs according to their computation capabilities and states of the communication channel, is a key problem in DTWN. As depicted in Fig. 1, The digital twins of IoT devices are constructed and maintained by their associated BSs. The training data and the computation tasks for training are distributed to various BSs based on the association between digital twins and the BSs. We provide the formal definition of the edge association in Definition 1.
Definition 1 (Edge Association)
Consider a DTWN with IoT users and BSs. For any user , , the goal of edge association is to choose the target BS to construct the digital twin of user . The association is denoted as . If is associated to BS , then , where is the size of data used to construct . Otherwise, .
A BS can associate with multiple digital twins, while a digital twin can only be associated with at most one BS. That is, . We perform edge association according to the datasets of IoT users, the computation capability of BSs , and the transmission rate between and , denoted as
(1) 
The objective of the edge association problem is to improve the utility of resources and the efficiency of running digital twins in the DTWN.
IiB Federated Learning Model
The goal of federated learning is to train a global machine learning model based on the data from various digital twins without transmitting the original training data. The learning process involves finding the parameter for global model
that minimizes the global loss function
, denoted as(2) 
The client BSs train their local models based on their own data. Each client minimizes the loss function on its local data through gradient descent based methods such as gradient descent and stochastic gradient descent, with a predefined learning rate. The clients then transmit the local gradients or the local models to the server MBS to update the global model, through algorithms such as federated averaging (FedAvg)
[mcmahan2017communication] and Federated SGD (FedSGD). We denote the aggregation of the global model as:(3) 
In the training process, the BSs train the local models based on the digital twins that they maintained according to Eq. 2. A BS may contain several digital twins constructed from the end users under its coverage. Different from conventional federated learning, the BSs in our proposed scheme first aggregate their local models from multiple digital twins instead of sending the original local models to the MBS, which can reduce the transmission load. As BS has digital twins, the aggregation at BS is
(4) 
where is the training data of digital twin and is the trained model of . BS then sends to the MBS, and the MBS updates the global model as
(5) 
The local models of digital twins are transmitted to the MBS through wireless links. The MBS collects the model parameters from all participating BSs and updates the global model. In this process, since all BSs transmit their parameters in the same period and the wireless bandwidth is limited, the communication efficiency is of vital importance for the learning phase to converge.
IiC Blockchain Model
To enhance the security and reliability of digital twins from untrusted end users, the BSs act as the blockchain nodes and maintain the running of the permissioned blockchain. The digital twins are stored in the blockchain and their data is updated as the state of the corresponding user changes. Moreover, the local models of the BS are also stored in the blockchain, which can be verified by other BSs to ensure the quality of local models. Thus, there are three types of records, namely, digital twin model records, digital twin data records, and training model records.
The overall blockchain scheme for federated learning is shown in Fig. 2. The BSs first train the local training models on their own data, and then upload the trained models to the MBS. The trained models are also recorded as blockchain transactions, and broadcasted to other BSs for verification. Other BSs collect the transactions and pack them into blocks. The consensus process is executed to verify the transactions in blocks.
Our consensus process is executed based on Delegated Proof of Stakes (DPoS) protocol, where the stakes are the training coins. Initial training coins are allocated to BS according to its data from digital twins, denoted as
(6) 
where is an initial value, is the number of digital twins associated to BS .
The coins of each BS are then adjusted according to their performance in the training process. If the trained model of a BS passes the verification of other BSs and the MBS, coins will be awarded to the BS. Otherwise, the BS will get no pay for its training work. A number of BSs are elected as the block producers by all BSs. In the voting process, all the BSs vote for the candidate BSs by using their own training coins. The elected BSs take turns to pack the transactions in a time interval into a block , and broadcast block to other producers for verification.
In our federated learning scheme, we leverage blockchain to verify the local models before embedding them into the global model. Due to high resource consuming for block verification, the interval should be set to multiple times of the local training period, that is, the BSs execute multiple local training iterations before transmitting local models to the MBS for global aggregation.
IiD Communication Model
We use the Orthogonal Frequency Division Multiple Access (OFDMA) for wireless transmission in our system. To upload trained local models, all BSs share subchannels to transmit their parameters. The achievable uplink data rate from BS to the MBS is:
(7) 
where is the total number of subchannels, is the time fraction allocated to BS on subchannel , is the bandwidth of each subchannel which is a constant value. The transmission power is and the uplink channel gain on subchannel is . is the path loss fading of the channel between BS and the MBS, is the distance between BS and the MBS, and is the path loss exponent. is the noise power and is the interference caused by other BSs using the same subchannel. In the download phase, the MBS broadcasts the global model with the rate
(8) 
where is the downlink power of BS and is the channel gain between BS and the MBS, is the downlink inference.
Iii Edge Association in DTWN: Problem Formulation
In this section, we first analyze the delay performance of the proposed model, and then formulates the optimization problem for edge association in DTWN to minimize the total system time cost under the given learning accuracy requirement.
Now we start to derive the formulation of edge association problem. We consider that the gradient of is Lipschitz smooth, that is
(9) 
where is a positive constant and is the norm of . We consider that the loss function is strongly convex, that is
(10) 
Many loss functions for federated learning can satisfy the above assumptions, for example, the logic loss functions. If (9) and (10) are satisfied, the upper bound of global iterations can be obtained as [ma2017distributed]
(11) 
where is the local accuracy , is the global accuracy, and . As in [8737464], we consider as a fixed value, so that the upper bound can be simplified to . Denote the time of one local training iteration by , then the computation time in one global iteration is , and the upper bound of total learning time is .
The time cost in our proposed scheme mainly consists of

Local training on digital twins: The time cost for the local training of BS is decided by the computing capability and the data size of its digital twins. The time cost is
(12) where is the number of CPU cycles required to train one sample of data, is the CPU frequency of BS , is the training batchsize of digital twin .

Model aggregation on BSs: The BSs aggregate its local models from various digital twins according to Eq. (4). The computing time for local aggregation is
(13) where is the size of local models and is the number of CPU cycles required to aggregate one unit of data. Since all the clients share the same global model, . Thus the time cost for local aggregation is
(14) 
Transmission of model parameters: The local models aggregated by BS are then broadcasted to other BSs as transactions. The time cost is related to the number of blockchain nodes and the transmission efficiency. Since other BSs also help to transmit the transaction in the broadcast process, the time function is related to , where is the size of the BS network. The required time cost is
(15) where is a factor of transmission time cost that can be obtained from historical running records of the transmission process.

Block Validation: The block producer BS collects the transactions and packs them into a block. The block is then broadcasted to other producer BSs, and validated by them. Thus, the time cost is
(16) where is the number of block producers, is the size of a block.
Note that in the aggregation phase, the size of model parameters is small and the computing capability is high. Thus, compared to other phases, the time for aggregation is very small that can be neglected. Based on the above analysis, the time cost for one iteration is denoted as
(17)  
In the 6G network, the growth of the user scale, the ultralow latency requirement of communication, and the dynamic network status make it an important issue to reduce the time cost of model training in various applications. Since accuracy and latency are two main metrics to evaluate the decision making abilities of digital twins in our proposed scheme, we consider the edge association problem to find the tradeoff between learning accuracy and time cost of the learning process. Due to the dynamic computing and communication capabilities of various BSs, the edge association of digital twins, that is, how to allocate the digital twins of different end users to various BSs for training, is a key issue to be solved for minimizing the total time cost. Moreover, increasing the training batch size of each digital twin can improve the learning accuracy. However, it will also increase the learning time cost to execute more computation. In addition, how to allocate the bandwidth resources to improve the communication efficiency, should also be considered. In our edge association problem, we should carefully design these policies to minimize the total time cost of the proposed scheme. Thus, we formulate the optimization problem as minimizing the time cost of federated learning under a given learning accuracy. To solve the problem, the association of digital twins, the batchsize of their training data, the bandwidth allocation should be jointly considered according to the computing capability and the channel state . The optimization problem can be formulated as
Constraint (18b) ensures that the sum of the number of associated digital twins does not exceed the size of total dataset. Constraint (18c) guarantees that each subchannel can only be allocated to at most one BS. Constraint (18d) ensures the range of training batch size for each digital twin. Problem (18) is a combinational problem. Since there are several products of variables in the objective function, and the time cost of each BS is also affected by the resource states of other BSs, it is challenging to solve problem (18).
Iv Multiagent DRL for Edge Association
Since the system states are only determined by network states in the current iteration and the allocation policies in the last iteration, we regard the problem as a Markov Decision Process (MDP) and use multiagent DRL
[lowe2017multi] based algorithm to solve it.Iva Multiagent DRL Framework
The proposed multiagent reinforcement learning framework is shown in Fig. 3. In our proposed system, each BS is regarded as a DRL agent. The environment consists of BSs and digital twins of end users. Our multiagent DRL framework consists of multiple agents, a common environment, system state , action and the reward function , which are described below.

State space: The state of the environment is composed of the computing capabilities of BSs, the number of digital twins on each BS , the training data size of each digital twin , the channel state . The states of multiple agents are denoted as
, where each dimension is a state vector that contains the states for all agents.

Action space: The actions of BS in our system consist of the digital twin allocation , the training data batchsizes for its digital twins , and the bandwidth allocation . Thus, the actions are denoted as . BS agent makes new action decisions at the beginning of iteration based on system state . The system action is .

Reward: We define the reward function of BS according to its time cost based on Eq. (17), as
(19) The reward vector of all agents is . According to Eq. (18), the total time cost is decided by the maximum time cost of agents . Thus each DRL agent shares the same reward function in our scheme. In the training process, the BS agents adjust their actions to maximize the reward function, that is, to minimize the system time cost in each iteration.
The learning process of BS is to find the best policy that maps its states to its actions, denoted as , where is the action to be taken by BS for the whole system state . The objective is to maximize the expected reward, that is
(20) 
where is the discount rate, . In the conventional DRL framework, it is hard for an agent to obtain the states of others. In our DTWN, the states of digital twins and BSs are recorded in the blockchain. A BS can retrieve records from blockchain to obtain the system states and actions of other agents in the training process.
IvB Multiagent DRL algorithm for edge association
Since the network states variable such as and are continuous values, the state and action spaces are large. We adopt Deep Deterministic Policy Gradient (DDPG) algorithm to address the formulated MDP problem. The DDPG algorithm uses policybased ActorCritic (AC) to select and evaluate the actions, and uses Deep Q Networks (DQNs) to approximate value functions in actor and critic networks. The multiple agents share the same reward function and train their policy network cooperatively to minimize the time cost.
In the training phase, each BS agent generates the training sample , where is the state of DTWN in the next time slot. We leverage DQN with the tuples randomly sampled from replay memory to train the actor network and critic network , with parameters and . There are two sets of actor and critic networks the primary networks and the target networks. The target networks have the same structure as the primary networks and are used to generate target values for training primary networks.
Each agent has a actor DNN to determine its action based on current state , as
(21) 
where is the random noise generated by the Ornstein Uhlenbeck process [barndorff2001non], is the explored edge association policy. The parameters of the primary actor DNN are updated as
(22) 
where is the learning rate of the actor DNN. We train the primary critic network of agent by taking steps in the opposite gradient direction of the loss function as
(23) 
where is the learning rate of the primary critic DNN, and is the target value generated by target networks, are the actions of all DRL agents.
The target networks represent the old version of the primary networks. The parameters of the target action DNN and the target critic DNN are trained in a different way. Agent updates its target action DNN and critic DNN as
(24)  
(25) 
where is the update rate.
The proposed multiagent reinforcement learning algorithm for edge association problem is summarized as Algorithm 1. Each agent first initializes its primary and target criticactor DNNs, and initializes the edge association policy. Then, the primary actor DNN of agent generates action based on current state and policy according to Eq. (21). The observed reward and next state are calculated, and the tuple is stored into the replay memory as training samples. The primary actor DNN and critic DNN are then updated based on Eq. (22) and Eq. (23). The target networks are updated according to Eq. (24).
The computation cost training process of the DRL can be performed offline for large number of episodes based on the dynamic system states. The trained DRL models are deployed online to optimally allocate the resources to minimize the time cost of federated learning under given learning accuracy. The actions in our multiagent DRL for edge association are composed of digital twin association policies , batchsize of training data , and the bandwidth allocation policies . Due to the large action and state space, we adopt the actor DNN to generate actions. The complexity of our proposed learning algorithm mainly lies in the training process of actor DNN and critic DNN . Consider the DNN in our algorithm has
hidden layers, and the average number of neurons in each layer is
. Thus the time complexity for training a DNN is . The total complexity for training the multiagent DRL model with agents is . Since the training at each agent is executed in parallel, the time complexity is , which is related to the DNN size and the number of episodes.V Numerical Results
We conduct our experiment on a realworld dataset CIFAR10[krizhevsky2009learning]. The CIFAR10 dataset consists of 60,000 images in 10 classes, including 50,000 training images and 10,000 test images. Learning on the image dataset simulates the real edge computing scenarios such as traffic flow monitoring and image recognition of smart cameras. We consider a wireless network with 1 MBS, 5 BSs, and 100 end users. The users are randomly distributed in the coverage area of BSs, as shown in Fig. 4
. The CIFAR10 dataset is shuffled and assigned to the end users randomly. Thus the training data of federated learning is Independent and Identically Distributed (IID) in our experiment. The Convolutional Neural Network (CNN)
[cnn] is adopted as the machine learning model for federated learning. The CNN model has two convolution layers (with 32 channels and 64 channels, respectively) and maxpooling layers, followed by a fully connected layer with 512 units. The maximum CPU frequencies of five BSs are 2.6GHz, 1.8GHz, 3.6GHz, 2.4GHz, and 2.4GHz, respectively. The transmission power of RSUs and the MBS is 34dBm and 42dBm, respectively. The bandwidth of the subchannel is set as 30MHz. is set to 174 dBm.The latency performance with respect to training rounds is shown in Fig. 5 for our proposed algorithm and the conventional learning algorithms with random edge association and with average edge association. Our proposed algorithm significantly reduces the system time cost compared with the benchmark algorithms. The multiagent reinforcement learning algorithm optimizes digital twin association, and optimally allocates communication resources, which improves the running efficiency and reduces the system latency for our scheme. Fig. 6 depicts the learning performance of the proposed algorithm, compared with the learning algorithm with full training data and the learning algorithm with random edge association. From the results we can see that our proposed algorithm achieves a comparable convergence performance compared to fully trained federated learning, where all training data of users is utilized in each training process. The learning loss of our proposed algorithm is improved through the optimization process compared with the conventional algorithm with random edge association.
The average cumulative reward is calculated by , where is the total reward of agent in episode , and is the number of agents. The cumulative average time cost of our proposed multiagent deep reinforcement learning are depicted in Fig. 7 for different values of the discount factor . The cost of different converges as the number of iterations increases, which denotes that the training process of the DRL model has maximized the cumulative reward and has minimized the system time cost. The curve with achieves the best performance, which has a higher convergence rate and smaller system time cost. The time cost for running our reinforcement learning based optimization algorithm is shown in Fig. 8
. We can see that the training of our proposed optimization algorithm costs much more time than the test phase. The reason is that the training of deep reinforcement learning model is a process of iterative exploration. The agents take much time to interact with the environment to learn optimal policies. Although there are some fluctuations in the result curves, the overall time cost for training or testing in each iteration is comparable. The time is consumed mainly by the training process of the deep neural networks in reinforcement learning. From Fig.
8 we can also see that a larger discount factor slightly leads to a larger time cost in each iteration. The reason is that a larger discount factor incurs more computation in the policy training process, thus leading to a larger time cost.Vi Conclusion
In this paper, we proposed the new DTWN model based on federated learning and blockchain, and improved the running efficiency of the proposed scheme. We first presented the DTWN model in a wireless edge network consisting of end users and BSs. We further developed a blockchain empowered federated learning scheme in DTWN for realizing edge intelligence. To improve the efficiency of the proposed scheme and better allocate the limited resources, we formulated an optimization problem for given learning accuracy. Specifically, we formulated the problem of edge association between digital twins and BSs and derived an optimal solution to the problem by exploiting the multiagent reinforcement learning. Numerical results based on the realworld dataset demonstrated that the proposed scheme effectively reduces the learning latency and achieves good learning convergence.
Comments
There are no comments yet.