arXiv:2610.17961cs.NIOct 2026

Manuscript Offprint

arXiv:2610.17961

Shortcut in Generalization: Rethinking Evaluation Protocol for Encrypted Traffic Classification

Qiming Yu, Chungang Lin, Zhengyi Ma, Zijia Song, Yuliang Lu, Guozheng Yang, Dongzhen Qi

Qiming Yu 1^{1}, Chungang Lin 2,3^{2,3}, Zhengyi Ma 4^{4}, Zijia Song 1^{1}, Yuliang Lu 1^{1}, Guozheng Yang 1^{1}, Dongzhen Qi 1^{1}

1^{1}College of Electronic Engineering, National University of Defence Technology, Hefei 230037, China

2^{2}Institute of Computing Technology, Chinese Academy of Sciences, China

3^{3}University of Chinese Academy of Sciences, China

4^{4}College of Computer Science and Technology, National University of Defence Technology, Changsha 410000, China

Corresponding author: yangguozheng17nudt.edu.cn

Abstract—Encrypted traffic classification is commonly evaluated under a range of experimental protocols, with classification performance reported as the primary measure. However, the reported performance may be influenced by shortcuts left uncontrolled in the evaluation protocol, such as shortcut features and cross-partition sharing, rather than reflect generalizable traffic patterns. And test-only feature transformations may further introduce train–test mismatch. In this paper, we study how current evaluation protocols are affected by shortcut-related factors, including field-level shortcuts, cross-partition sharing, and train–test processing. We compare feature importance, retrained feature removal, and field-only split sensitivity. We also vary Source-IP overlap and packets per flow, compare test-only IP transformations with matched train–test transformations. Experiments on three public datasets show that the performance of existing methods are affected by both cross-partition sharing and the consistency of train–test transformations. Specifically, increasing Source-IP overlap from 0% to 100% raises accuracy by about 32–33 points before identifier masking, compared with only about 8 points after masking. For two state-of-the-art pretrained models (i.e., YaTC and NetMamba), the 11–13 points loss caused by test-only IP zeroing is almost fully recovered when the same transformation is applied during both training and testing.

Index Terms—encrypted traffic classification, evaluation methodology, shortcut learning, data splitting, field interventions

I. INTRODUCTION

Encrypted traffic classification (ETC) supports network management and security monitoring. Existing methods range from lightweight classifiers built on packet features [1]–[3] to pre-trained models such as ET-BERT, YaTC, NetMamba [4]–[6]. Recent methods report very high accuracy and F1 scores on commonly used benchmarks. As benchmark performance becomes increasingly high, it becomes equally important to understand what contributes to these scores. In other words: if the factors the model relies on are not close to reality, then the performance of the model is actually artificially high. This raises a question: What do current ETC evaluations actually measure?

In fact, the dataset split does more than divide samples. It also determines which identifiers and repeated observations remain shared across the two partitions. Identifier fields and repeated observations may form stable associations with labels, allowing a model to exploit shortcuts rather than learning broader traffic patterns [7]–[9]. Field masking and entity-based grouping address different parts of this problem: masking changes the information visible to the classifier, whereas grouping changes what can be shared across training and test. Descriptions such as packet-level random split or flow-level split therefore do not fully specify the resulting evaluation condition.

A second issue appears when feature dependence is inferred from test-time perturbations. If an IP field is removed or remapped only at test time, the input representation no longer matches the one used for training. The resulting performance loss can therefore reflect both information removal and train–test mismatch. Training and testing on the same transformed representation asks a different question: how well can the model perform when the transformation is applied consistently? Distinguishing these two settings is necessary before a test-only drop is interpreted as evidence of feature dependence.

To separate these factors, we examine ETC evaluation from three complementary directions, as summarized in Fig. 1: (1) Field-level diagnostics: We compare importance stability, retrained removal effects, and field-only split sensitivity to characterize different forms of association between individual traffic fields and classification outcomes. (2) Cross-partition sharing: We examine the grouping object and directly control source-IP overlap and the number of packets retained per flow to measure how shared identities and related observations affect evaluation results. (3) Train–test transformations: We compare test-only IP perturbations with matched train–test preprocessing and measure the residual performance gap after matched training.

Experiments on three public datasets produce three main observations: (1) Feature importance and field sensitivity are not equivalent. A field that appears unimportant in one setting can still form a strong split-sensitive label association in another; (2) Increasing Source-IP overlap from 0% to 100% raises accuracy by about 32 points before identifier masking, but only about 8 points after masking; (3) Test-only IP zeroing causes an 11–13 points loss for YaTC and NetMamba, yet this loss is almost fully recovered under matched train–test processing, while ET-BERT/CSTNET retains a 47.1 points residual. Together, these results show that ETC scores depend

Figure

Fig. 1: Overview of the evaluation framework.

on both what is shared across partitions and how input transformations are applied.

The main contributions are as follows:

  1. We show that feature importance, retrained removal effect and field-only split sensitivity capture different properties of traffic fields.

  2. We treat cross-partition sharing as an experimental variable by controlling Source-IP overlap and the number of packets retained per flow. The results show that shared identities and repeated observations can substantially change measured performance.

  3. We use matched train–test transformations to distinguish test-only perturbation sensitivity from performance under consistent preprocessing. This comparison shows when a large test-only loss can be recovered through matched training and testing instead of being attributed directly to feature dependence.