Abstract
Recent results at the Large Hadron Collider (LHC) have pointed to enhanced physics capabilities through the improvement of the real-time event processing techniques. Machine learning methods are ubiquitous and have proven to be very powerful in LHC physics, and particle physics as a whole. However, exploration of the use of such techniques in low-latency, low-power FPGA hardware has only just begun. FPGA-based trigger and data acquisition (DAQ) systems have extremely low, sub-microsecond latency requirements that are unique to particle physics. We present a case study for neural network inference in FPGAs focusing on a classifier for jet substructure which would enable, among many other physics scenarios, searches for new dark sector particles and novel measurements of the Higgs boson. While we focus on a specific example, the lessons are far-reaching. We develop a package based on High-Level Synthesis (HLS) called hls4ml to build machine learning models in FPGAs. The use of HLS increases accessibility across a broad user community and allows for a drastic decrease in firmware development time. We map out FPGA resource usage and latency versus neural network hyperparameters to identify the problems in particle physics that would benefit from performing neural network inference with FPGAs. For our example jet substructure model, we fit well within the available resources of modern FPGAs with a latency on the scale of 100 ns.
Introduction
At the Large Hadron Collider (LHC), proton bunches collide at a rate of 40 MHz, generating hundreds of terabytes of data per second. To manage this deluge, detectors employ a "Level-1 (L1) trigger"—a hardware-based filter that must decide whether to keep or discard an event within a fraction of a microsecond. While machine learning (ML) is exceptionally effective at identifying interesting physics events, such as Higgs boson decays or dark matter signatures, standard CPU or GPU implementations are far too slow for the L1 trigger's sub-microsecond requirements.
Field Programmable Gate Arrays (FPGAs) offer the necessary speed and low power consumption, but their traditional programming via hardware description languages (VHDL/Verilog) is time-consuming and requires specialized expertise. This paper introduces a bridge between user-friendly ML software and low-latency hardware to democratize FPGA acceleration for the physics community.
The hls4ml Workflow
The core contribution of this work is hls4ml, an open-source software package that automates the translation of trained neural networks into FPGA firmware. As shown in the workflow diagram below, the tool takes models from standard Python frameworks like Keras, TensorFlow, or PyTorch and converts them into High-Level Synthesis (HLS) C++ code.
This abstraction allows physicists to rapidly prototype and deploy models without deep knowledge of digital circuit design. The pipeline includes steps for model compression and tuning configurations for precision and resource reuse, ensuring the resulting firmware is optimized for the strict constraints of the LHC environment.
Optimization Strategies
To fit complex neural networks onto the limited real estate of an FPGA while maintaining sub-microsecond latency, hls4ml employs three primary optimization techniques:
- Compression (Pruning): Models are trained using $L_1$ regularization to encourage sparsity. Connections with near-zero weights are pruned. In FPGA hardware, these pruned weights literally disappear—no circuitry is built for them, leading to direct savings in chip area and power.
- Quantization: Standard 32-bit floating-point numbers are replaced with custom fixed-point arithmetic (e.g., 16-bit). Research indicates that physics classification tasks are highly resilient to this reduction in precision, showing virtually no loss in accuracy.
- Parallelization (Reuse Factor): A tunable "reuse factor" allows designers to balance speed and resource usage. A reuse factor of 1 maximizes parallelization and speed, while higher factors share hardware multipliers to save space at the cost of increased latency.
Case Study: Jet Substructure Classification
The tool was benchmarked using a jet substructure classification task, a critical component for identifying particles like W/Z bosons and top quarks in high-energy collisions at $\sqrt{s} = 13$ TeV. The model utilized a Multi-Layer Perceptron (MLP) architecture to process 16 "expert-level" physics observables.
Key Results and Performance
The optimized jet substructure model demonstrated exceptional performance on a Xilinx Kintex Ultrascale FPGA:
- Latency: The 3-hidden-layer network achieved an inference latency of just 75 nanoseconds (15 clock cycles at 200 MHz), easily meeting the L1 trigger requirements.
- Efficiency: Pruning reduced the number of model parameters by 3.3x (from 4,389 to 1,338) without degrading classification power.
- Resource Footprint: The compressed model consumed only 10% of the available Digital Signal Processors (DSPs), leaving ample room for other trigger logic.
Conclusion and Future Directions
hls4ml successfully bridges the gap between high-level machine learning research and low-level hardware implementation. While this study focused on fully connected networks, future work aims to extend support to Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) to handle more complex detector data. By abstracting the complexities of FPGA firmware design, this tool enables the physics community to leverage the full power of modern deep learning in real-time discovery environments.
Summary updated