# Deep Reinforcement Learning Based Intelligent Reflecting Surface for Secure Wireless Communications

Helin Yang, Zehui Xiong, Jun Zhao, Dusit Niyato, Liang Xiao, Qingqing Wu · arXiv · 2020-2-27

- **Problem** Beamforming at the BS and reflection phases at the IRS must jointly meet secrecy and QoS targets, but the design problem is non-convex and the channels are time-varying and outdated.
- **Method** Models the BS as a learning agent that picks beamforming and IRS phase actions with a DQN, using post-decision state updates to track channel dynamics and prioritized experience replay to sample training transitions.
- **Results** Under time-varying channels, the proposed approach is reported to raise the secrecy rate by 17.21% and the QoS satisfaction level by 8.67% over the approach of reference \[14\].

![Figure 2: Deep PDS-PER learning based beamforming for IRS-aided secure communications](https://refivu.com/papers/7f104da3-3d98-4ecd-95d9-a25944d61e36/figures/figure-e493a120c68231ebe40bce85201bbf89.png?thumb=512)

**Fig. 2** . Deep PDS-PER learning based beamforming for IRS-aided secure communications.

[Original paper](https://arxiv.org/abs/2002.12271v5) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Helin Yang, Zehui Xiong, Jun Zhao, Dusit Niyato, Liang Xiao, Qingqing Wu · Deep Reinforcement Learning Based Intelligent Reflecting Surface for Secure Wireless Communications · Original paper figure · Extracted the figure area from page 6 of the original PDF.

## Why secure IRS beamforming is hard to optimise directly

The setting is a downlink in which a base station serves legitimate users while eavesdroppers try to decode their signals, and an intelligent reflecting surface made of passive elements reflects the signal toward the users. The simulations use four BS antennas, two legitimate users and two eavesdroppers.

The design goal is to maximise the sum of the users' secrecy rates while each user keeps a secrecy-rate target and a data-rate target, under a BS power limit and unit-modulus IRS phase constraints. The objective is not concave in either the BS beamformer or the IRS phases, and the two are coupled through the cascaded channel, so the joint problem is non-convex.

Single-slot optimisation can settle on a greedy solution, because it ignores the system history and the long-term benefit of an action. Previous studies mostly assumed perfect CSI at the BS, and the authors argue that this is unrealistic when delay and user mobility make the CSI outdated. Earlier learning-based IRS work covered only one user or did not include secrecy and imperfect CSI, which left the joint BS and IRS design open.

## Signal, channel and rate model

The BS sends a superposition of beamformed symbols, one per user, and each user receives its desired symbol plus inter-user interference and noise. Each eavesdropper receives the sum of all user symbols through its own effective channel.

The BS and the IRS estimate the channel with delay, so the channel used for beamforming lags the real one. The real-time channel is modelled as \\(h(t+T\_{\\mathrm{delay}})=\\rho h(t)+\\sqrt{1-\\rho^2}\\,\\hat h(t+T\_{\\mathrm{delay}})\\), where \\(\\hat h\\) has zero-mean, unit-variance complex Gaussian entries. The coefficient \\(\\rho\\) is set by the zeroth-order Bessel function of the Doppler spread and the delay, and it lies between 0 and 1, so \\(\\rho=1\\) corresponds to no outdating and smaller values to more outdated CSI.

The uncertainty is treated as a norm-bounded error on each estimated channel, so the worst case over the error radius is what the design must satisfy.

Each user's rate treats the other users' signals as interference, and each eavesdropper's rate is computed in the same way for the signal of a given user. The individual secrecy rate of user \\(k\\) is \\(R^{\\mathrm{sec}}\_k=\[R\_{u,k}-\\max\_{m}R\_{em,k}\]^+\\), so the largest eavesdropper rate for that user is subtracted and the result is clipped at zero.

## Casting beamforming as a reinforcement learning problem

The IRS-aided system is treated as the environment and the central controller at the BS acts as the agent, which fits a Markov decision process view. The state contains the channel information of all users and eavesdroppers, the secrecy rates, the last data rates and the QoS satisfaction levels. The action contains the BS beamforming vectors and the IRS phase shifts.

The reward is the sum of the users' secrecy rates minus two penalty terms, one for each user whose secrecy rate is below its target and one for each user whose data rate is below its target. In formula form, \\(r=\\sum\_{k}R^{\\mathrm{sec}}\_k-\\sum\_{k}\\mu\_1 p^{\\mathrm{sec}}\_k-\\sum\_{k}\\mu\_2 p^{u}\_k\\), where each indicator \\(p\\) equals 1 when the matching target is missed and 0 otherwise.

The penalty weights \\(\\mu\_1\\) and \\(\\mu\_2\\) balance the utility of the secrecy rate against the cost of missing a QoS target.

Q-Learning updates a Q-table with the Bellman relation, and the agent chooses actions with an epsilon-greedy rule that explores with probability epsilon. The paper uses this structure as the base and replaces the plain Q-table with a deep network trained through the PDS and PER updates described next.

## Post-decision state updates and prioritized replay

A post-decision state sits between the action and the next state. The part of the transition that is known, and the part caused by the unknown channel dynamics, are separated, and the reward is split into a known part and an unknown part. Because the state after the PDS does not depend on the earlier state, the transition probability factorises through the PDS, as in \\(T(s\_{t+1}\|s\_t,a\_t)=\\sum\_{\\tilde s\_t}T^u(s\_{t+1}\|\\tilde s\_t,a\_t)T^k(\\tilde s\_t\|s\_t,a\_t)\\).

The known reward and known transition let the Q-function on state-action pairs be expanded from the PDS action-value function.

At each step the PDS action-value is updated as \\(\\tilde Q\_{t+1}(\\tilde s\_t,a\_t)=(1-\\alpha\_t)\\tilde Q\_t(\\tilde s\_t,a\_t)+\\alpha\_t(r^u(\\tilde s\_t,a\_t)+\\gamma \\hat V\_t(s\_{t+1}))\\), and the Q-function is then recomputed from it. The deep network approximates the Q-function with parameters \\(\\theta\\), and its loss is the squared difference between a target built from the reward and the next maximum and the current estimate.

The temporal-difference error is the gap between that target and the current estimate, and it sets the priority of each stored transition.

Classical replay draws transitions uniformly, which spends updates on experiences that carry little information, so the paper extends prioritized replay to the PDS setting. Sampling probability is \\(p(i)=\|\\delta(i)\|^{\\eta\_1}/\\sum\_{j'}\|\\delta(j')\|^{\\eta\_1}\\), with \\(\\eta\_1=0\\) giving uniform sampling. Because prioritized sampling biases the visit frequencies, importance-sampling weights \\(W(i)=(D\\cdot p(i))^{-\\eta\_2}\\) rescale the loss, where \\(D\\) is the replay buffer size.

## Training loop, implementation stage and cost

In the training stage the controller observes the state, selects an action with the epsilon-greedy rule, executes it, and updates the PDS action-value and the Q-function. Each transition is stored in the replay buffer, mini-batches are sampled by the PER rule, and the network parameters are updated with the weighted loss.

At run time the trained network outputs the action with the highest value, which fixes the BS beamforming matrix and the IRS phase shift matrix. The authors state that the policy can be computed at the BS and the IRS phases passed to the IRS offline, so the heavy training happens off line on a server.

The PDS step adds order \\(\|S\|^2\\times\|A\|\\) work relative to classical DQN, with the PDS version given as order \\(2\|S\|^2\\times\|A\|\\), and PER adds order \\(\\log\_2 D\\) operations for buffer size \\(D\\). The authors conclude that the proposed algorithm is slightly more expensive than classical DQN, and they argue the extra cost buys better performance.

## What Theorem 1 establishes and what it assumes

Theorem 1 states that deep PDS-PER learning converges to the optimal Q-function of the Markov decision process with probability 1. The result needs the learning-rate sequence to satisfy the usual stochastic approximation conditions, namely that the sum of the rates is infinite and the sum of their squares is finite, with each rate in the stated range.

The proof argues that if every action is executed infinitely often in every state, so the policy keeps exploring greedily, the PDS-learning Q-function and its policy converge to the optimal values with probability 1. The proof relies on earlier PDS-learning results cited as \[34\] and \[35\] rather than a self-contained derivation in this excerpt.

## Simulation data and network configuration

Users and eavesdroppers are placed at random in a 100 m by 100 m grid with 2.5 m resolution, with the BS and the IRS at fixed positions. Sampled channels and their rewards form the training set, and the BS and IRS beamforming choices are drawn from predefined codebooks.

The DQN is a fully connected multi-layer perceptron, with the input layer holding the system state and the output layer predicting the reward for each beamforming choice. Training uses a regression loss on the mean squared error between predicted and normalised rewards, and the network has three hidden layers of 500, 250 and 200 neurons. The network is trained for 1000 epochs with 128 mini-batches per epoch, and the replay buffer holds 32000 samples, with 80% of the data used for training and 20% for validation.

The simulation uses background noise of -90 dBm, a BS power range of 15 to 40 dBm, IRS elements from 10 to 60, and outdated CSI coefficients from 0.5 to 1. The minimum secrecy rate is 3 bits/s/Hz and the minimum data rate is 5 bits/s/Hz, with the path loss exponent set to 3 and the learning rate set to 0.002 with a discount factor of 0.95.

Exploration is annealed linearly from 0.8 to 0.1 over the first 300 episodes, and the penalty weights are both set to 2.

## Learning rate and loss behaviour during training

Learning rates of 0.1, 0.01, 0.001 and 0.0001 were compared by average reward against training episodes. A rate of 0.1 oscillates and reaches much lower reward than 0.001, while 0.0001 needs a longer time to converge. The authors chose a rate near 0.001 for their tests, neither too large nor too small, and they report that the model learns well at 0.001.

Training and validation loss fall quickly over the first epochs and level off after about 150 epochs. The authors read a high validation loss with a low training loss as overfitting and both losses being high as underfitting.

## Secrecy and QoS against transmit power

Secrecy rate and QoS satisfaction probability of all approaches rise as the transmit power increases, which the authors attribute to a higher received SINR at the users.

The proposed learning approach outperforms Baseline1, which optimises the BS and IRS beamformers in an iterative manner while the other is held fixed. The proposed approach also reaches higher secrecy rate and QoS satisfaction probability than the classical DQN-based beamforming, which the authors link to the PDS and PER updates. All three IRS-assisted approaches give clearly higher secrecy rate and QoS satisfaction probability than the design without IRS.

## Effect of the number of IRS elements

For the IRS-assisted approaches, secrecy rate and QoS satisfaction grow with the number of elements, because more reflected paths raise the received SINR at the users and lower it at the eavesdroppers. The design without IRS stays constant across element counts.

The gap in secrecy rate between the proposed approach and Baseline1 and DQN widens as the number of elements increases, which the authors attribute to more flexible phase design. The proposed approach is the first to reach 100% QoS satisfaction as the number of elements rises, and the authors credit the QoS-aware reward for this.

## Sensitivity to outdated CSI

The outdated CSI coefficient is swept from 0.5 to 1 with the transmit power at 30 dBm and 40 IRS elements. As the coefficient falls, the average secrecy rate and QoS satisfaction decrease for all approaches, since more accurate CSI lets the policy choose better beamformers.

Reducing the coefficient affects the other three approaches more, while the proposed approach stays at a favourable level, which the authors read as lower sensitivity to CSI uncertainty. Against the approach of reference \[14\] in the time-varying channel case, the proposed approach is reported to improve the secrecy rate by 17.21% and the QoS satisfaction level by 8.67%.

## Limitations

The authors state that training needs a powerful computation server and that it is performed offline at the BS. The trained model must be updated only when the environment changes greatly, which depends on the environment dynamics and the service requirements.

The convergence result holds only under the stated learning-rate conditions and greedy exploration with infinitely many visits, and the excerpt does not test it outside those conditions. The learning-rate study uses a single model and reward setting, and the 0.001 value is selected from four candidates. The sweeps hold the other variables fixed at one value each, with Pmax at 30 dBm and the CSI coefficient at 0.95 for the element sweep, and L at 40 for the Pmax sweep.

The proposed method's added computation is slightly higher than classical DQN, and the excerpt does not quantify the wall-clock cost.

## Paper info

- **Authors**: Helin Yang, Zehui Xiong, Jun Zhao, Dusit Niyato, Liang Xiao, Qingqing Wu
- **Venue**: arXiv · Preprint
- **First published**: 2020-2-27
- **Added**: 2026-11-6
- **Updated**: 2020-12-24
- **Version**: v5
- **arXiv**: 2002.12271
- **DOI**: 10.1109/twc.2020.3024860
- **Category**: eess.SP
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2002.12271v5) · [PDF ↗](https://arxiv.org/pdf/2002.12271v5)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

In this paper, we study an intelligent reflecting surface (IRS)-aided wireless secure communication system for physical layer security, where an IRS is deployed to adjust its surface reflecting elements to guarantee secure communication of multiple legitimate users in the presence of multiple eavesdroppers. Aiming to improve the system secrecy rate, a design problem for jointly optimizing the base station (BS)'s beamforming and the IRS's reflecting beamforming is formulated given the different quality of service (QoS) requirements and time-varying channel condition. As the system is highly dynamic and complex, and it is challenging to address the non-convex optimization problem, a novel deep reinforcement learning (DRL)-based secure beamforming approach is firstly proposed to achieve the optimal beamforming policy against eavesdroppers in dynamic environments. Furthermore, post-decision state (PDS) and prioritized experience replay (PER) schemes are utilized to enhance the learning efficiency and secrecy performance. Specifically, PDS is capable of tracing the environment dynamic characteristics and adjust the beamforming policy accordingly. Simulation results demonstrate that the proposed deep PDS-PER learning-based secure beamforming approach can significantly improve the system secrecy rate and QoS satisfaction probability in IRS-aided secure communication systems.

## Quote from the paper

Helin Yang, Zehui Xiong, Jun Zhao, Dusit Niyato, Liang Xiao, Qingqing Wu (2020). Deep Reinforcement Learning Based Intelligent Reflecting Surface for Secure Wireless Communications. arXiv:2002.12271v5. https://doi.org/10.1109/twc.2020.3024860

**BibTeX**

```
@article{yang2020deep,
  title = {{Deep Reinforcement Learning Based Intelligent Reflecting Surface for Secure Wireless Communications}},
  author = {Helin Yang and Zehui Xiong and Jun Zhao and Dusit Niyato and Liang Xiao and Qingqing Wu},
  year = {2020},
  eprint = {2002.12271},
  archivePrefix = {arXiv},
  doi = {10.1109/twc.2020.3024860},
  url = {https://arxiv.org/abs/2002.12271v5}
}
```

## Other paper commentary

- [Deep Reinforcement Learning for Stochastic Computation Offloading in Digital Twin Networks](https://refivu.com/en/papers/3abcd222-e3a8-4466-ab8d-04aeace1e847-deep-reinforcement-learning-for-stochastic-computation.md)
- [Mastering the Game of Stratego with Model-Free Multiagent Reinforcement Learning](https://refivu.com/en/papers/c8ba1a5f-8040-4096-92b0-d848951ca124-mastering-the-game-of-stratego-with-model-free.md)
- [Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning](https://refivu.com/en/papers/61131563-04fb-4585-b080-efba1e8d4a85-quantum-agents-in-the-gym-a-variational-quantum.md)
- [Variational Quantum Circuits for Deep Reinforcement Learning](https://refivu.com/en/papers/f6af79b4-b092-4c2a-8589-70b19b37fcc5-variational-quantum-circuits-for-deep-reinforcement-learning.md)
- [Reinforcement Learning via Self-Distillation](https://refivu.com/en/papers/020d237b-90b6-4f93-9da6-e25bde98d4ec-reinforcement-learning-via-self-distillation.md)
- [Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor](https://refivu.com/en/papers/ea8ec555-d426-4464-bcf3-677288c80a9c-soft-actor-critic-off-policy-maximum-entropy-deep.md)
- [Self-supervised Learning for Human Activity Recognition Using 700,000 Person-days of Wearable Data](https://refivu.com/en/papers/7d06c47d-a111-423f-a4f8-68d244e1093c-self-supervised-learning-for-human-activity-recognition.md)
- [A Generalized Deep Learning Framework for Whole-Slide Image Segmentation and Analysis](https://refivu.com/en/papers/17229723-709e-4a8a-9857-8cd6f0d14883-a-generalized-deep-learning-framework-for-whole-slide.md)
- [Attention Spiking Neural Networks](https://refivu.com/en/papers/2c52d99c-a249-4911-96bd-79f6720c0a09-attention-spiking-neural-networks.md)
- [Uncovering near-wall blood flow from sparse data with physics-informed neural networks](https://refivu.com/en/papers/5532e81a-0a00-4722-b226-e72f33cb333a-uncovering-near-wall-blood-flow-from-sparse-data.md)
- [Deep Unsupervised Learning using Nonequilibrium Thermodynamics](https://refivu.com/en/papers/0a712ab6-ae49-4e62-8de7-48f3f793c53f-deep-unsupervised-learning-using-nonequilibrium.md)
- [A Reduction of Imitation Learning and Structured Prediction to No-Regret Online Learning](https://refivu.com/en/papers/08306129-4598-48b6-baf3-9d1af09e03a6-a-reduction-of-imitation-learning-and-structured-prediction.md)

## Terms in this paper

- [Q-learning](https://refivu.com/en/terms/e20b416cb2f7-q-learning)
- [Markov Decision Process](https://refivu.com/en/terms/5d622f56f22a-markov-decision-process)
- [prioritized experience replay](https://refivu.com/en/terms/f111cab95d19-prioritized-experience-replay)
- [Theorem 1](https://refivu.com/en/terms/bef18c102f5e-theorem-1)
- [Deep Q-Network (DQN)](https://refivu.com/en/terms/df5d1042fd66-deep-q-network-dqn)
- [deep Q-network](https://refivu.com/en/terms/2ed05d25837b-deep-q-network)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/7f104da3-3d98-4ecd-95d9-a25944d61e36-deep-reinforcement-learning-based-intelligent-reflecting)
