1 Introduction

Wireless networks have come a long way since 1G to 4G LTE, and the advent of 5G is a giant leap forward. However, existing technology could have trouble keeping up with the ever-increasing demands for more data and larger capacity. With carrier frequencies, 10–100 times greater than 5G, the next 6G era, which is set to use the terahertz (THz) spectrum, boasts wireless communication rates of up to 1 Tb/s [1]. 6G network development faces new obstacles and possibilities this innovation brings, especially for applications involving sensing and communications that operate beyond 100 GHz.

Studies on THz quantum cascade lasers and associated technologies suggest that THz capabilities might be enhanced [2]. 5G networks, security scanners, vehicle radar, and high-capacity wireless services are just a few areas that have benefited greatly from research into millimetre and THz waves [3]. Academic institutions and businesses have taken the initiative to start researching 6G systems, even while 5G networks are still in their early commercial phases [4]. New services, such as linked robots and expanded reality, will need upgraded wireless technology, which is anticipated to be supported by 6G wireless networks [5].

THz transceiver components play a pivotal role in wireless links with very high data capacities [6]. The possibilities of THz frequencies in wireless systems are shown by recent developments in low-noise terahertz radar, terahertz spectroscopy, and improvements in frequency stability and accuracy in the THz domain [7]. Research into higher frequency bands, such as THz, is becoming increasingly important due to the rising need for high-speed wireless communication [8]. The enormous amounts of data sent by terahertz wireless communications networks need novel transceiver architectures and algorithms for processing signals [9].

Continuous data transmission for many applications, including industrial IoT and driverless cars, will be made possible by introducing 6G networks. However, problems with security and attack resilience arise at THz frequencies due to substantial path loss. Consequently, 6G network dependability, QoS, and secrecy depend on novel security mechanisms fine-tuned for THz propagation mechanics.

Operating at THz frequencies, 6G networks demand improved system capacity, data rates, latency, and quality of service compared to 5G systems, yet they may encounter privacy and security issues. Highlighting the significance of advanced technologies for improved performance in 6G networks, the integration of AI and big data is anticipated to substantially impact the development of the 6G air interface and network.

To meet the high standards of future applications that need ultra-reliable, fast, seamless wireless connection with very low latency, a gradual path towards 6G networks is essential. This shift is projected to bring about revolutionary changes. Wireless data traffic is rising, and researchers are working to find radio spectrum regimes that can keep up with consumer demand. This has highlighted the need for highly connected and capacious infrastructures.

Modern technology is crucial for 6G wireless networks to provide the required connectivity, which includes broadband wireless connections for data exchange across several spectrum frequencies, real-time connectivity, and dynamic connectivity. 6G applications are anticipated to handle very high data rates and low latency, which are made possible by machine learning; hence, new methodologies are required to meet their unique demands.

The development of wireless communications relies heavily on improvements in resonators, antennas, waveguides, and materials used in THz equipment [10]. Still, accomplishing flexible beamforming and minimising interference for mobile THz connections is challenging. A revolutionary new technology, reconfigurable intelligent surfaces (RIS), can improve service quality by using passive arrays [11]. Energy efficiency and spectrum utilisation in next-generation wireless networks are expected to be enhanced by RISs [12]. Antenna design, prototype, and experimental results in wireless communications have also been investigated using RISs [13].

Plasmonic systems provide a holistic perspective on the current and future use of THz nano communications in wireless networks, which are essential for THz communications [14]. The study of mobile near-field terahertz communications poses difficulties for future generations of networks, including 6G [15]. Particularly in THz QPSK detection utilising single-bit quantization, deep learning has shown potential for improving THz wireless communications [16]. As an indication of possible future ultra-high data rate wireless communications, a terahertz-based broadband hybrid precoding scheme based on cyclic delay has been proposed [17]. Further evidence that RISs may transport data and power concurrently comes from breakthroughs in self-sustaining terahertz information and power transmission systems [18].

2 THz Communication Fundamentals

2.1 Propagation Characteristics

The 0.1–10 THz range has potential allocations at 140–220 GHz and 275–400 GHz bands as per FCC, albeit with variation in international spectra designations. Free space path loss is more pronounced, with attenuation anticipated at around 60–80 dB/km. Depending on atmospheric conditions, molecular absorption from H2O, O2, etc., introduces an additional 20–30 dB/km loss. Due to increased diffraction, scattering losses from rain and fog can exceed 15–20 dB/km. Overall, these factors limit THz range to around 10–100 m. However, bandwidths up to 100 GHz are realizable. Figure 1 shows the THz Communication system architecture.

Fig. 1
figure 1

THz communication system architecture

2.2 Channel Modeling

Statistical models like SASM approximate temporal dynamics using tapped delay lines. Physical frameworks like D-SCM emulate frequency dependencies in path gain. Beam-based spatial modelling revealed array correlation matrices with 0.5 antenna spacing retain directionality. Deterministic ray tracing has been shown to predict channel impulse response, complementing measured analysis accurately. Hybrid stochastic-deterministic models are emerging for balanced complexity.

2.3 Transceiver Architectures

Phased array architectures with RF/LO stage beamforming offer directional gain. However, digital baseband beamforming provides better adaptivity at the cost of higher complexity in ADCs/DACs. Sub-6 GHz systems predominantly use hybrid beamforming for tradeoffs. For THz, quantization noise limits the complete digital solution. All-analog topologies are more accessible to implement but lack flexibility compared to the hybrid approach, which is still under research.

2.4 Modulation and Waveforms

Coherent modulations like m-PSK/QAM with inter-carrier interference cancellation are suitable for THz multi-path channels. Direct chaotic modulation has also been proposed for simple, non-coherent detection. Sub-carrier-based waveforms are expected to become viable with semiconductor fabrication advances enabling high-speed DACs beyond 100 GSa/s.

2.5 Standards and Recent Advancements

Regulatory efforts are ongoing in FCC/ITU-R for framework development and definition of formal standards. Prototype demonstrations are shown with electronic sources using amplifiers and frequency multipliers. Photonic signal generation used in photo mixer testbeds. Future modem development awaits complete THz characterization. Table 1 shows THz frequency allocations based on the latest ITU and FCC regulations:

Table 1 THz frequency bands and allocations

3 Reconfigurable Intelligent Surfaces

Reconfigurable intelligent surfaces (RIS), called passive reflect-arrays or metasurfaces, are artificial materials engineered to contain elements that can manipulate impinging electromagnetic (EM) waves without requiring dedicated power sources or analogue circuitry. Unlike conventional relays, RIS functions as passive beamformers that can achieve reflection coefficient control in an energy-efficient manner, as shown in Fig. 2.

Fig. 2
figure 2

Schematic of RIS-Enabled passive beamforming and energy efficiency in THz communication systems

$$(f,\theta i,{\rm{ }}\varphi i;{\rm{ }}\Phi ) = g\,(f,{\rm{ }}\theta i,{\rm{ }}\varphi i) \cdot \Theta \left( \Phi \right)$$
(1)

where Γ(f,θi, φi; Φ) represents the reflection property of an RIS with phase configuration Φ. It is characterized by the inherent frequency and incident angle responses g(f, θi, φi) as well as the configurable phase shift matrix Θ(Φ). By tuning Φ adaptively, the signals reflected from the RIS or transmitted past it can be controlled intelligently.

3.1 Tunable Metasurfaces

The reconfigurable functionality in RIS stems from integrating tunable metamaterials as the meta-atoms within unit cells. By altering the voltage bias, typically between 0 and 5 V, salient properties of these metasurfaces like reflection amplitude/phase, and frequency characteristics can be tuned dynamically, even though the intrinsic geometry remains fixed.

3.2 Discrete vs. Continuous Phase Shifts

Depending on the control components and fabrication, RIS elements demonstrate two phase shift characteristics - discrete or continuous [3]. As highlighted discrete phase shifts achieve quantized reflection levels leading to phase errors and increased loss. However continuous shifts require sophisticated fabrication and calibration. State-of-the-art RIS platforms offer 256 discrete phase states using 6-bit PIN diode-based.

4 Deep Learning for Wireless Communications and Security

4.1 Introduction to Deep Learning

Deep learning refers to a subset of machine learning algorithms that use multilayer neural networks to learn hierarchical representations of data. Their ability to discover complex patterns makes them well-suited for wireless communications. Popular deep network architectures include Convolutional Neural Networks (CNNs) for imagery and spectral data, Recurrent Neural Networks (RNNs) for temporal sequences, and Autoencoders for efficient data codings. The networks are trained via backpropagation, fine-tuning the parameters using gradient descent optimization. Methods like Adam and RMSprop accelerate training by adapting the learning rates dynamically based on parameter updates.

4.2 Deep Learning for Signal Processing

Unlike analytical signal processing, deep learning adopts a data-driven approach to communicate, detect, estimate and classify signals wirelessly. CNNs serve as universal function approximators for channel conditions. RNNs predict time variations, and beamforming relies increasingly on reinforcement learning exploration. Autoencoders reconstruct messages after equalization. The ubiquity of data now allows statistical learning-based techniques to surpass or enhance model-based schemes.

4.3 Applications in Physical Layer Security

Wireless security is improved by optimizing artificial noise transmissions using power allocation policies learnt from environments. Malicious attacks on protocols can be detected by analyzing anomalies in sequence predictions. Manipulated inputs to trigger unwanted behaviours are flagged through statistical quantifications of deviations. True random number generators for encryption also employ neural models by generating heterogeneous outputs.

4.4 Deep Learning for THz Systems

Deep learning offers tools like generative models to synthesize realistic terahertz frequency datasets. Transceiver components optimized through differentiable end-to-end learning suit THz regimes. Intelligent surfaces with reconfigurable metamaterials can learn their reflection profiles dynamically using distributed multi-agent reinforcement learning architectures tailored to THz channels.

Algorithm 1

Deep Learning Model for THz RIS Optimization.

Initialize deep learning model with random weights.

for each training episode do.

Collect data from the communication system.

Preprocess and normalize the data.

Extract features using CNN.

Model temporal sequences using RNN/LSTM.

for each time-step do.

Predict the optimal RIS configuration using the RL agent.

Apply the configuration to the RIS.

Measure the system’s performance.

Update the RL agent’s policy based on the reward signal.

end for.

Retrain the CNN and RNN models periodically with new data.

end for.

4.5 Challenges and Future Directions

Despite the promise, deep learning for wireless faces barriers in mobility-induced distribution shifts. Training data efficiency needs amelioration through reuse and transfer learning. Interpretability is still limited, but better attributions, uncertainty modelling, and verified learning are active focuses that enable reliability alongside performance.

5 Proposed Secure THz Framework

5.1 System Model

We consider a THz wireless system consisting of a single-antenna access point (AP), K single-antenna mobile users, an intelligent surface with N passive reflecting elements, and L eavesdroppers attempting to intercept the communication, as illustrated in Fig. 3 below.

Fig. 3
figure 3

System model topology

The AP transmits a signal x(t) to the users using analog beamforming with a steering vector wtx ∈ CM×1 to focus the signal spatially. The intelligent surface dynamically adapts its reflection coefficients θ = [θ1, θ2,., θN] to manipulate the electromagnetic propagation environment. The channel from the AP to user k is denoted by hk ∈ C and that between the AP and eavesdropper l is given by gl ∈ C. The intelligent surface assists the link by inducing a phase shifted channel hr, k ∈ CN×1.

The signal received at legitimate user k is then expressed as:

$${\rm{yk }} = {\rm{ hkHwtxx }} + {\rm{ hr}},{\rm{kH\Theta hr,tx }} + {\rm{ nk}}$$
(2)

where nk ∼ CN(0,σ2) represents additive white Gaussian noise.

Similarly, the signal at eavesdropper l is given by:

$${\rm{zl = glHwtxx + nl}}$$
(3)

Our objective is to optimize the parameters wtx and Θ to maximize the secrecy rate and energy efficiency of the system, as detailed in the following section.

5.1.1 Network Topology

The network consists of the following major components:

THz access point (AP) fitted with electronically steerable phased array.

Single-antenna mobile users with handheld devices.

Reconfigurable intelligent surface (RIS) on surrounding walls.

Passive eavesdroppers attempting to intercept transmissions.

The AP serves multiple legitimate indoor users by beamforming THz signals using analog phase shifters. The RIS provides a programmable channel for coverage enhancement and passive beamforming through dynamic meta-surface adjustments.

5.1.2 THz Channel Characterization

The THz channel model incorporates frequency-dependent path loss, molecular absorption and noise effects. A frequency selective multi-path model with extended Saleh-Valenzuela parameters is adopted as:

$${\rm{h}}\left( {{\rm{t,f}}} \right){\rm{ = }}\Sigma {\rm{L\, l = 1 }}\,\Sigma {\rm{K\, k = 1\, \alpha kl \,exp}}\left( {{\rm{j2\pi \tau kl}}} \right){\rm{ \delta }}\left( {{\rm{t - Tl}}} \right)$$
(4)

where αkl and τkl denote path amplitudes and delays. Tl corresponds to clustering delays across propagation paths.This wideband spatio-temporal statistical channel representation accounts for measurements revealing RMS delay spreads of 10-20ps in indoor THz channels with multiple single and clustered bounce components.

Fig. 4
figure 4

Sum rate performance vs. number of RIS elements

Here is a Fig. 4 showing the sum rate performance relative to the increasing number of Reconfigurable Intelligent Surface (RIS) elements. The x-axis represents the number of RIS elements, and the y-axis represents the sum rate in Mbps. As the number of RIS elements increases, the sum rate performance also improves, demonstrating the benefit of using a larger RIS for enhancing wireless communication quality and reliability.

Table 2 Performance comparison of THz communication schemes with and without RIS

The consolidated Table 2 allows us to contrast the proposed optimized RIS-enabled terahertz communication system against baseline schemes without RIS and with randomly configured RIS surfaces.

Analyzing the secrecy rate, which quantifies the reliable information rate transferred to the legitimate receiver, we see the proposed technique achieves 92.2% gains compared to the case without intelligent surfaces. By adaptively learning the optimal phase configurations, our framework enhances confidentiality. Similarly, reliability is improved as the extremely low bit error rates (BERs) demonstrate for both legitimate users as well as eavesdroppers. The 5x/2x lower BERs in the optimized RIS scheme lead to accurate signal decoding at intended receivers while limiting useful interception.

Finally, the probability of message decoding by malicious eavesdroppers reduces remarkably from 38.5% down to 2.1% using the proposed intelligent metasurface optimizations. By directing beams precisely towards Bob while minimizing information leakage towards Eve through destructive interference, we obtain around 95% security enhancement. Thus, the tabulated metrics validate the efficacy of the overall dynamic deep learning powered RIS configuration solution in simultaneously improving secrecy capacity, transmission reliability, and security in the context of vulnerable terahertz links. The gains are consistent across performance indicators vis-à-vis the baseline setups without intelligent reconfigurability highlighting the indispensable value of programmable wireless environments.

Figure 5 compares the secrecy rates achieved in different scenarios, including “Random RIS,” “Without RIS,” and “Proposed RIS.” It demonstrates how the proposed RIS configuration enhances the secrecy rate compared to the other scenarios.

Fig. 5
figure 5

Secrecy rate comparison

Figure 6 presents a comparison of the Bit Error Rates (BER) in different scenarios, including “Random RIS,” “Without RIS,” and “Proposed RIS.” It highlights how the BER varies among these scenarios.

Fig. 6
figure 6

Bit error rate (BER) comparison

Figure 7 showcases the comparison of interception probabilities across various scenarios, including “Random RIS,” “Without RIS,” and “Proposed RIS.” It illustrates the effectiveness of the proposed RIS in reducing interception probabilities (See Fig. 8).

Fig. 7
figure 7

Interception probability comparison

Fig. 8
figure 8

Energy efficiency comparison

By combining reconfigurable intelligent surfaces (RIS), a type of programmable metasurface, with specialised deep learning algorithms, this groundbreaking study offers a game-changing method for 6G networks’ secure terahertz (THz) wireless connectivity, which can achieve up to 97% of the best secure communication benchmarks. A revolutionary framework is created to achieve ultra-reliable and secret connections in ever-changing surroundings with passive eavesdropping by systematically modelling, optimising, and using AI designed for THz propagation mechanics. For future 6G use cases like autonomous mobility, industrial automation, and extended reality—use cases that demand high rates and strict secrecy—this work represents a paradigm shift in manifesting resilient and private wireless connectivity by skillfully integrating software and hardware across electromagnetic wave manipulation, communication theoretic security, and neural network architectures via interdisciplinary techniques. The study showcases impressive advancements in THz technologies, customisable materials, and intelligence inspired by the brain, all aimed at designing communication networks beyond 5G/6G.

6 Conclusion

This groundbreaking research presents a game-changing method for 6G wireless terahertz (THz) security by combining reconfigurable intelligent surfaces (RIS), a programmable meta surface, with deep learning algorithms. The result is an approach that achieves up to 97% of the best secure communication benchmarks. A revolutionary framework is created using optimization, systematic modelling, and AI designed for THz propagation mechanics to achieve ultra-reliable and secret connections in ever-changing surroundings with passive eavesdropping. This work represents a paradigm shift in manifesting resilient and private wireless connectivity for future 6G use cases involving autonomous mobility, industrial automation, and extended reality, which require high rates and stringent secrecy. Through interdisciplinary techniques, it achieves this by expertly orchestrating software and hardware spanning electromagnetic wave manipulation, communication theoretic security, and neural network architectures. To design communication networks beyond 5G/6G, the study demonstrates outstanding advancements at the crossroads of THz technologies, designed customisable materials, and intelligence inspired by the brain.