# Survey on 5G Physical Layer Security Threats and Countermeasures
## 6 Machine Learning for Enhancing PHY Layer Security
### Reccurent Neural Networks and Long Short-Term Memory  
Recurrent Neural Network (RNN) and Long Short-Term Memory (LSTM) [127] networks represent advancements in deep learning for analyzing and interpreting sequential and time-series data, potentially in applying RF fingerprinting. RNNs are designed to process data sequences by maintaining a hidden state that acts as memory and allows them to capture temporal dependencies and patterns within the data. However, RNNs often struggle with long-term dependencies due to issues like vanishing and exploding gradients. LSTMs, a special type of RNN, address these challenges with a more complex internal structure comprising gates that regulate the flow of information. These gates effectively allow LSTMs to remember and forget information over long sequences, making them particularly adept at modelling time-series data or sequences where the timing and order of events are critical [128; 129]. The fundamental building units of RNN and LSTM networks are depicted in Figure 11.  
The capabilities addressed above make RNNs and LSTMs particularly suitable for RF fingerprinting applications that require analysis of the temporal characteristics of signals, enabling more accurate identification of devices and transmission patterns within LTE and 5G networks. Integrating RNN and LSTM models in RF fingerprinting signifies a move towards more sophisticated, temporal-sensitive analysis techniques, offering improved performance over traditional methods in capturing the dynamic nature of wireless signal transmissions. To our best knowledge, although an LSTM has very recently been used for 5G anomaly detection in signaling traffic [130], no works have used RNNs and LSTMs for  
Figure 10: The general structure of the triplet network. The network has three inputs—an anchor signal \((x^{A})\), a positive signal \((x^{P})\) and a negative signal \((x^{N})\). The inputs are passed through concurrently in parallel through the same structures Deep architectures \(F\) with shared weights resulting in embeddings \(F(x^{A})\), \(F(x^{P})\) and \(F(x^{N})\). The embeddings are directly used to calculate the triplet loss, and extra Feed Forward layers are used to calculate the global loss. The final loss is an addition of triplet loss and global loss. the RF fingerprinting of 5G and LTE signals on the PHY layer. Nevertheless, several recent works have focused on other wireless transmission signals. For instance, [131] focuses on fingerprint identification for Long Range (LoRa) devices and [132] considers a set of USRP SDR's transmitting WiFi signals. The 802.11a/g signals transmitted from USRP have also been considered in [133], with the neural network architecture consisting of convolutional-LSTM architecture. At the same time, multiple deep-learning approaches, MLP, CNN, and LSTM, are compared with multiple variants of the input data, such as raw In-Phase Quadrature (IQ), frequency domain signal, and spectrogram. Study [134] is based on processing raw IQ data for RF fingerprinting by software-defined radio-type USRP-2900. Besides direct use for the authentication of devices, recursive networks also have the potential to improve the performance of location-based approaches, such as the RNN used for signal preprocessing in [135]. Although not yet showcased for 5G, the properties of the RNN and LSTM networks described above, and successful demonstrations of RF fingerprinting presented in papers [131; 133; 134], make these network architectures potential candidates for successful RF fingerprinting classification of LTE and 5G transmitter devices. Transformers, initially introduced in [136] in the context of Natural Language Processing (NLP), have rapidly become a revolutionary architecture in the field of deep learning due to their ability to handle sequential data without the limitations inherent to RNNs and LSTMs networks [137].