Homunculus: Auto-Generating Efficient Data-Plane ML Pipelines for Datacenter Networks

Tushar Swamy, Annus Zulfiqar, Luigi Nardi, Muhammad Shahbaz, Kunle Olukotun

TL;DR

Homunculus is an automated framework that generates optimized machine learning (ML) pipelines for programmable network hardware like switches and SmartNICs. By using a high-level declarative language and hardware-aware Bayesian optimization, it allows network operators to deploy high-performance in-network ML models without needing deep expertise in hardware description languages or complex hyperparameter tuning.

What Problem Does This Paper Address?

Modern datacenter networks need to react to events—like microbursts, gray failures, or DDoS attacks—in microseconds. While programmable data planes (e.g., Intel Tofino, FPGAs) allow for line-rate processing, deploying sophisticated ML models on them is a "Sisyphean task."

Currently, a network operator must be a "triple threat": an expert in ML (model selection and tuning), network design (latency and throughput constraints), and hardware architecture (P4, Verilog, or Spatial DSL). As shown in Figure 1, the traditional workflow is a manual, iterative loop of building, tuning, and checking hardware constraints that often leads to sub-optimal models or failed deployments.

Comparison of data-plane ML pipeline development process.

Methods

The authors introduce Homunculus, a compiler-like framework that automates this entire lifecycle. It consists of three main components:

  1. Alchemy DSL & Frontend: A Python-embedded declarative language. Instead of writing low-level hardware code, operators specify their intent: the dataset, the objective (e.g., maximize F1 score), and the hardware constraints (e.g., "must run on a Taurus switch at 1 Gpkt/s").
  2. Optimization Core: This is the "brain" of the system. It uses Bayesian Optimization (specifically the HyperMapper framework) to explore the design space. It doesn't just look for the most accurate model; it rules out models that are too large or too slow for the target hardware, effectively pruning the search space based on physical resource limits (like Match-Action Tables or FPGA LUTs).
  3. Backend Generator: Once an optimal, compliant model is found, Homunculus uses a library of parameterized templates to auto-generate the final hardware code (Spatial for FPGAs/Taurus or P4 for MAT-based switches).
High-level Homunculus framework architecture.

Datasets

The framework was evaluated using several real-world network datasets:

  • NSL-KDD: A classic intrusion detection dataset used for the Anomaly Detection (AD) task.
  • IoT Device Traces: Used for Traffic Classification (TC) to identify device types based on packet headers.
  • P2P/Botnet Traces: Includes traffic from botnets like Storm and Waledac, alongside benign P2P traffic (uTorrent, eMule), used for Botnet Detection (BD).

Key Insights and Ideas

  • Declarative Networking for ML: The shift from how to build a model to what the requirements are is the core "aha" moment. By treating hardware constraints as feasibility requirements in the optimization loop, the system finds models humans might overlook.
  • Reaction Time vs. Accuracy: Traditional botnet detection often waits for thousands of packets (per-flow) to make a decision. Homunculus enables per-packet inference, allowing the network to start detecting threats at line speed, drastically reducing the window of vulnerability.
  • Model Fusion: Homunculus can automatically assess different tasks and "fuse" models that share features. This reduces resource consumption by eliminating redundant feature extraction and communication logic on the chip.
  • Hardware-Aware Pruning: Unlike standard AutoML, Homunculus uses the target platform's specifications to immediately disqualify models that would never fit, making the search process much more efficient for constrained environments.

Key Results

  • Performance Boost: Homunculus-generated models achieved up to 12% better F1 scores compared to hand-tuned baselines for anomaly detection.
  • Simplicity: On average, operators only needed to write 30 lines of code in the Alchemy DSL to generate a full pipeline, compared to hundreds or thousands of lines of manual hardware description.
  • Line-Rate Execution: All generated models were constrained to and successfully operated at 1 Gpkt/s line-rate throughput.
  • Efficiency: For botnet detection, Homunculus found a model that outperformed the baseline while using a 5x smaller "flowmarker" (feature set), allowing the switch to track significantly more concurrent flows.

Limitations and Future Work

  • Search Budget: While Bayesian optimization is efficient, finding the absolute global optimum in a massive design space can still take significant time (iterations), as shown in the regret plots (Figure 4).
  • Backend Support: The system currently relies on template libraries for specific targets (Tofino, Taurus, FPGAs). Adding a radically new architecture would require developing new templates.
  • Feature Engineering: While the model architecture and tuning are automated, the initial selection of features from raw packets still largely relies on the provided dataset and the operator's initial input. Future work could involve automating feature discovery directly from raw packet headers.

Summary updated

BibTeX
@inproceedings{swamy2023homunculus,
  author = {Tushar Swamy and Annus Zulfiqar and Luigi Nardi and Muhammad Shahbaz and Kunle Olukotun},
  title = {{Homunculus: Auto-Generating Efficient Data-Plane ML Pipelines for Datacenter Networks}},
  booktitle = {ASPLOS},
  year = {2023},
  doi = {10.1145/3582016.3582022},
}
Figure