## 2 Two-Stage Time-Domain Equalization Method
### Two-Stage Time-Domain Equalization Method  
As shown in Figure 1, the proposed two-stage DL equalizer employs a global-local cooperative strategy to model and compensate for nonlinear distortion in THz communication systems. Figure 1a illustrates the process of data acquisition and construction.  
Figure 2: LSTM block diagram at time step \(n\): input vector \(x_{n}\), current cell state \(C_{n}\), candidate cell state \(\tilde{C}_{n}\), hidden state \(h_{n}\), and forget gate \(f_{n}\), input gate \(i_{n}\), and output gate \(o_{n}\).  
The system collects two datasets: training data and validation data. These two sets differ in frequency and transmission distance, and are used to evaluate the robustness and generalization ability of the model.  
As depicted in Figure 1b, during the training phase, the collected transmit and receive signals are first upsampled and then sequentially processed by two DL modules. The first stage (global equalization module) performs global feature learning enabled by high temporal resolution through upsampling to capture broad nonlinear distortions. Its output is then downsampled and fed into the second stage (local equalization module) for localized residual compensation after downsampling. After training, two independent equalizer models are obtained: the global and the local equalizers.  
As shown in Figure 1c, during the testing phase, the trained models are cascaded to form a complete equalization structure. The validation data are first upsampled and then passed through the global and local equalization modules sequentially to produce the final equalized signal. The BER is measured to evaluate model robustness under varying communication conditions.  
In the global equalization module, signal upsampling enhances temporal resolution, allowing the DL model to capture nonlinear features caused by hardware impairments and complex channel effects. Then, global channel feature learning is performed at this scale.  
The output of the global module is then downsampled and processed by a local equalization module to further compensate the signal locally. To maintain low implementation complexity while ensuring temporal awareness, the second stage also adopts an LSTM-based architecture. It is worth emphasizing that the two-stage framework itself is highly flexible, allowing different network structures to be selected for each stage as long as the desired balance effect can be achieved. Although heterogeneous combinations such as \"LSTM in the first stage and CNNs in the second stage\" can be adopted, we still choose to use LSTM in both stages, mainly for the consideration of unified structural design to avoid the additional design and parameter tuning complexity brought about by the hybrid architecture. By applying targeted residual corrections before decision-making, the local equalizer further improves overall equalization accuracy.  
To assess the generalization capability of the proposed equalization architecture, testing data are collected under varying carrier frequencies and LOS distances by adjusting the operating conditions of the THz system. BER comparisons before and after equalization confirm that the two-stage equalizer achieves strong adaptability and robustness across different channel conditions.