TL;DR
The paper introduces Planter, the first open-source, modular framework that automates the end-to-end deployment of trained machine learning (ML) models directly onto programmable network hardware. By translating standard ML models into P4 data plane code, Planter enables line-rate, ultra-low-latency network inference for tasks like anomaly detection and financial forecasting without requiring extra server hops.
What Problem Does This Paper Address?
Traditional network architectures route traffic to external servers to perform machine learning tasks (e.g., detecting a cyberattack or predicting stock movements). This introduces significant latency and extra network traffic, as illustrated in Figure 1.
While programmable network devices (like smart network cards and programmable switches) allow code to run directly on the data path ("in-network computing"), mapping complex ML algorithms to these devices is incredibly difficult. Network hardware has strict constraints: limited memory, rigid processing pipelines, and no native support for floating-point math or complex operations like loops and square roots.
Prior research in this area yielded only rigid, closed-source, or single-model proofs-of-concept. Network engineers lacked a general, automated tool to easily train, optimize, and deploy a wide variety of ML models onto different hardware targets.
Methods
The authors developed Planter, a modular framework that automates the entire pipeline from data loading to hardware testing.
Planter classifies model-to-hardware mapping into three distinct architectural approaches:
- Encode-Based (EB) Solutions: These models partition the input feature space into grids or regions and assign codes to them. Tables map these codes directly to a classification decision. This works well for Decision Trees, Random Forests, and XGBoost.
- Lookup-Based (LB) Solutions: For algorithms requiring complex math (like Support Vector Machines or Naïve Bayes), Planter uses hardware Match/Action tables to pre-calculate and store intermediate mathematical results, which are then aggregated using simple addition.
- Direct-Mapping (DM) Solutions: These map the model structure directly onto the hardware pipeline. For example, a Binarized Neural Network (BNN) is mapped by replacing standard matrix multiplications with hardware-friendly bitwise XNOR and population count (PopCount) operations.
Datasets
Planter was evaluated across several diverse, real-world application domains using the following datasets:
- Network Security / Anomaly Detection: AWID3, CICIDS 2017, KDD99, and UNSW-NB15.
- Financial Transactions: NASDAQ TotalView-ITCH and the Jane Street Market Prediction dataset (evaluating both stateless and stateful feature extraction).
- Quality of Experience (QoE): The Requet dataset, used for predicting video streaming buffer warnings.
- Pattern Recognition: The classic Iris dataset.
Key Insights and Ideas
- Coexistence without Compromise: In-network ML models generated by Planter can be seamlessly integrated directly into standard switching architectures (like
switch.p4) without requiring additional pipeline stages or degrading traditional routing capabilities. - The Memory vs. Latency Trade-off: Encode-Based (EB) models are highly efficient with switch memory and pipeline stages, but as the model grows, they can introduce slightly more latency than Lookup-Based (LB) models. LB models scale cleanly in latency but are highly sensitive to the range and precision of input features, which can quickly exhaust table memory.
- Automated Optimization: Planter utilizes ternary matching and default table actions to dramatically compress the number of rules required on the switch, allowing surprisingly complex ensemble models (like Random Forests) to fit on commodity hardware.
Key Results
- Line-Rate Performance: On a commercial Intel Tofino switch ASIC, Planter-generated models achieved full line-rate throughput at 6.4 Terabits per second (Tbps) for all feasible models.
- Negligible Latency Overhead: When combined with standard L2/L3 switching functionality, the latency overhead introduced by the ML inference was less than 4.7%.
- High Accuracy Preservation: Planter-mapped models achieved virtually identical classification accuracy and F1 scores compared to their original, server-side Python implementations (Scikit-Learn/PyTorch) when allocated sufficient bit-precision.
- Rapid Development: For standard model sizes, Planter’s end-to-end training and hardware-conversion process completes in under 10 seconds.
Limitations and Future Work
While Planter successfully automates deployment, it cannot bypass the fundamental physical limits of switch hardware. "Huge" model configurations with massive decision trees or high feature dimensions still fail to compile on strict switch ASICs due to memory and stage limitations.
The authors plan to extend Planter to support more hardware architectures, including NetFPGA platforms and a wider variety of SmartNICs. They also aim to implement advanced table-minimization techniques to further reduce the hardware footprint of large models.
Summary updated