Pegasus: A Universal Framework for Scalable Deep Learning Inference on the Dataplane

Yinchao Zhang, Su Yao, Yong Feng, Kang Chen, Tong Li, Zhuotao Liu, Yi Zhao, Lexuan Zhang, Xiangyu Gao, Feng Xiong, Qi Li, Ke Xu

Abstract

The networking community is increasingly moving toward the Intelligent DataPlane (IDP), where deep learning (DL) models are embedded directly into high-speed switches to analyze traffic in real-time. However, the fundamental "impedance mismatch" between the Match-Action Table (MAT) architecture of programmable switches and the mathematical requirements of neural networks has historically limited the scale and accuracy of such deployments. This paper presents Pegasus, a universal framework that enables complex DL models—including CNNs, RNNs, and AutoEncoders—to run directly on switches at line-rate. By decomposing operations into dataplane-friendly primitives and utilizing a novel fuzzy matching technique, Pegasus supports models up to 248x larger than previous state-of-the-art methods while improving accuracy by up to 22.8%.

1. Introduction

As network traffic grows in complexity, the need for real-time analysis for malware detection, application classification, and anomaly detection has become paramount. Traditional approaches that offload traffic to CPUs or GPUs introduce significant latency and throughput bottlenecks. Embedding intelligence directly into the dataplane offers a solution, yet it faces three primary challenges:

  1. Hardware Constraints: Programmable switches are optimized for routing and lack support for floating-point arithmetic, multiplication, or exponentiation.
  2. The Accuracy-Scale Trade-off: Previous solutions often relied on model binarization (which degrades accuracy) or exact-match lookups (which lead to exponential memory consumption as input size increases).
  3. Lack of Generality: Most existing frameworks are specialized for specific model types, failing to provide a general-purpose solution for diverse architectures like Convolutional Neural Networks (CNNs).

Pegasus addresses these challenges by transforming the deep learning inference problem from a calculation task into a high-speed search task.

2. The Pegasus Framework

Pegasus introduces a hierarchical approach to bridge the gap between complex DL models and the flow-table-centric environment of the dataplane.

2.1 Dataplane-Friendly Primitives

To accommodate the limitations of switch hardware, Pegasus translates standard neural network layers into three core primitives:

  • Partition: High-dimensional input features are broken down into smaller, manageable segments.
  • Map: This primitive performs the core logic by retrieving precomputed results from a match-action table, effectively replacing complex math with a lookup.
  • SumReduce: The results from various segments are aggregated to produce the final output for the layer.

2.2 Fuzzy Matching and Scalability

The "secret sauce" of Pegasus is its use of Fuzzy Indexing. Rather than requiring an exact match for every possible input combination—which would lead to memory exhaustion—Pegasus utilizes a clustering tree. This tree maps inputs to the nearest "centroid" (a representative value). This nearest-neighbor approach allows the switch to handle high-precision inputs using only a small fraction of the memory typically required, enabling the framework to support input scales 212x larger than previous methods.

2.3 Primitive Fusion and Hardware-Aware Training

Switch hardware is limited by a fixed number of processing stages. Pegasus employs Primitive Fusion to merge multiple operations—such as Batch Normalization, Fully Connected layers, and ReLU activations—into a single table lookup. This compression is vital for fitting multi-layer models within the physical constraints of the switch chip.

To mitigate the approximation errors introduced by fuzzy matching, Pegasus incorporates hardware constraints directly into the training phase. Using backpropagation, the framework fine-tunes centroids and cluster parameters, ensuring that the precomputed values stored in the switch tables remain as close to the ideal mathematical outputs as possible.

3. Experimental Evaluation

The authors evaluated Pegasus across several standard traffic classification and anomaly detection benchmarks, including PeerRush (P2P classification), CICIOT2022 (IoT state classification), and ISCXVPN2016 (VPN traffic identification). For malware and DoS detection, the USTC-TFC2016 and Kitsune datasets were used to test AutoEncoder reconstruction errors.

Testing was conducted on a Barefoot Tofino 2 switch, deploying five distinct architectures: MLP, RNN, CNN (Basic, Medium, and Large), and an AutoEncoder.

4. Key Results

Pegasus demonstrates significant improvements over existing state-of-the-art (SOTA) methods like N3IC and BoS:

  • Scalability: Pegasus supports models up to 6083 Kb (248x larger than N3IC) and input scales of 3840 bits.
  • Accuracy: The framework achieved an average accuracy improvement of 22.8% over binarized MLPs and 17.9% over binarized RNNs. The approximation loss compared to full-precision server-side models was minimal, averaging only ~1.08%.
  • Throughput and Latency: Running at line-rate, Pegasus is 3800x faster than a CPU and 600x faster than a high-end GPU (Tesla V100) for inference, with virtually zero impact on network latency.

5. Conclusion and Future Work

Pegasus proves that by treating the switch as a nearest-neighbor search engine rather than a calculator, it is possible to deploy large-scale, accurate DL models directly on the dataplane. While the framework is currently bound by the physical SRAM and TCAM limits of commodity switches—making it unsuitable for massive models like Transformers—it represents a major leap in network intelligence.

Future research will focus on multi-tenancy (allowing multiple models to share hardware stages) and developing mechanisms for dynamic model updates that do not require interrupting network traffic.

Summary updated

BibTeX
@inproceedings{zhang2025pegasus,
  author = {Yinchao Zhang and Su Yao and Yong Feng and Kang Chen and Tong Li and Zhuotao Liu and Yi Zhao and Lexuan Zhang and Xiangyu Gao and Feng Xiong and Qi Li and Ke Xu},
  title = {{Pegasus: A Universal Framework for Scalable Deep Learning Inference on the Dataplane}},
  booktitle = {SIGCOMM},
  year = {2025},
  doi = {10.1145/3718958.3750529},
}
Figure