## 3 Methodology
### Description of the Algorithm  
The proposed framework operates in two stages: self-supervised pretraining for generic feature learning and supervised fine-tuning for task-specific adaptation.  
Pretraining Phase: Leveraging unlabeled RF signals, the model learns discriminative representations through contrastive learning. Input signals undergo data augmentation to generate positive and negative pairs, which are encoded by the hybrid encoder. A nonlinear projection head maps encoded features to a lower-dimensional space where NT-Xent loss maximizes agreement between positive pairs while repelling negatives.  
Fine-tuning Phase: The pretrained encoder is frozen to preserve general features. A lightweight feature enhancement module and linear classifier are appended. VAT injects worst-case perturbations into the frozen encoder's feature space to enhance robustness, combining cross-entropy classification loss with VAT loss. The specific pseudocode is shown in Algorithm 1.  
```
0: Unlabeled dataset \(\mathcal{D}_{ul}=\{\mathbf{x}_{i}\}_{i=1}^{N}\), where \(\mathbf{x}_{i}\in\mathbb{R}^{4000}\) Parameters: Encoder \(f_{\theta}\), Projection head \(g_{\phi}\)
1:for epoch \(=1\) to \(N_{pretrain}\)do
2:for each batch \(\{\mathbf{x}_{k}\}_{k=1}^{8}\subset\mathcal{D}_{ul}\)do
3: Generate two augmented views: \(\tilde{\mathbf{x}}_{i}\leftarrow\mathcal{T}_{1}(\mathbf{x}_{k})\), \(\tilde{\mathbf{x}}_{i}\leftarrow\mathcal{T}_{2}(\mathbf{x}_{k})\)
4: Extract representations: \(\mathbf{h}_{i}\gets f_{\theta}(\tilde{\mathbf{x}}_{i})\), \(\mathbf{h}_{i}\leftarrow f_{\theta}(\tilde{\mathbf{x}}_{j})\)
5: Project features: \(\mathbf{z}_{i}\leftarrow g_{\phi}(\mathbf{h}_{i})\), \(\mathbf{z}_{j}\leftarrow g_{\phi}(\mathbf{h}_{j})\)
6: Compute similarity: \(\text{sim}(\mathbf{u},\mathbf{v})\leftarrow\frac{\mathbf{u}^{\top}\mathbf{v}}{ \|\mathbf{u}\|\|\mathbf{v}\|}\)
7: Compute contrastive loss \(\mathcal{L}_{cont}\) as Equation (14)
8: Update parameters: \[\theta\leftarrow\theta-\eta_{\theta}\
abla_{\theta}\mathcal{L}_{cont},\quad \phi\leftarrow\phi-\eta_{\phi}\
abla_{\phi}\mathcal{L}_{cont}\]
9:endfor
10:endfor
11: Fine-tuning Phase Input: Labeled dataset \(\mathcal{D}_{l}=\{(\mathbf{x}_{j},y_{j})\}_{j=1}^{M},y_{j}\in\{1,\dots,C\}\) Parameters: Frozen encoder \(f_{\theta^{*}}\), Feature enhancement module \(q_{\psi}\), Classifier \(c_{\omega}\)
12:for epoch \(=1\) to \(N_{finetune}\)do
13:for each batch \(\{(\mathbf{x}_{k},y_{k})\}_{k=1}^{B}\subset\mathcal{D}_{l}\)do
14: Feature extraction and enhancement: \[\mathbf{h}\gets f_{\theta^{*}}(\mathbf{x}_{k}),\quad\mathbf{h}_{\text{enh} }\gets q_{\psi}(\mathbf{h}),\quad\hat{g}\gets c_{\omega}(\mathbf{h}_{ \text{enh}})\]
15: Compute cross-entropy loss \(\mathcal{L}_{CE}\) as Equation (18)
16: Generate random noise: \(d\sim\mathcal{N}(0,\xi^{2}I)\)
17: Compute adversarial direction \(\mathbf{r}_{adr}\) as Equation (15)
18: Compute VAT loss \(\mathcal{L}_{VAT}\) as Equation (16)
19: Compute total loss \(\mathcal{L}_{total}\) as Equation (19)
20: Update parameters: \[\psi\leftarrow\psi-\eta_{\psi}\
abla_{\psi}\mathcal{L}_{\text{total}},\quad \omega\leftarrow\omega-\eta_{\omega}\
abla_{\omega}\mathcal{L}_{\text{total}}\]
21:endfor
22:endfor
```  
**Algorithm 1** Self-Supervised SEI Framework