hls4ml is an open-source compiler framework that converts pre-trained neural networks from standard libraries like Keras, PyTorch, and ONNX directly into High-Level Synthesis (HLS) firmware descriptions. By generating C++ code optimized for parallel execution, it enables the deployment of complex deep learning models onto Field-Programmable Gate Arrays (FPGAs) with deterministic, microsecond-scale latency, bypassing the overhead of traditional CPU or GPU inference.
Glossary
hls4ml

What is hls4ml?
An open-source Python package that translates traditional machine learning models into High-Level Synthesis (HLS) projects for ultra-low latency FPGA inference, commonly used in particle physics and real-time RF applications.
The framework applies aggressive model compression techniques, including quantization-aware training and configurable weight pruning, to map floating-point networks onto fixed-point digital logic. It produces a fully self-contained HLS project with AXI-streaming interfaces, enabling seamless integration into larger signal processing pipelines for applications like real-time automatic modulation classification and particle collision triggering.
Key Features of hls4ml
An open-source Python package that translates traditional machine learning models into High-Level Synthesis (HLS) projects for ultra-low latency FPGA inference, commonly used in particle physics and real-time RF applications.
Automated HLS Translation
Converts trained Keras, TensorFlow, PyTorch, and ONNX models directly into synthesizable C++ HLS code. The framework parses the model graph, maps layers to optimized HLS templates, and generates a complete Vivado HLS or Vitis HLS project. This eliminates manual RTL design, reducing FPGA deployment time from months to hours for signal processing engineers.
Configurable Precision via Quantization
Supports arbitrary fixed-point precision through ap_fixed types, allowing per-layer bit-width configuration for weights, biases, and activations. Users can specify integer and fractional bits independently, enabling aggressive quantization down to 2-4 bits for modulation classifiers while preserving accuracy. Integrates with Quantization-Aware Training (QAT) workflows to compensate for precision loss.
Streaming Dataflow Architecture
Generates deeply pipelined, fully streaming architectures where data flows continuously through the network without off-chip memory access for intermediate activations. Each layer processes samples as they arrive, achieving sub-microsecond latency per inference. This is critical for real-time RF applications like dynamic spectrum awareness and modulation classification on FPGAs.
Reuse Factor for Resource Scaling
Provides a reuse parameter that controls the trade-off between throughput and resource utilization. A reuse factor of 1 implements fully parallel hardware, maximizing throughput at the cost of DSP slices and LUTs. Higher reuse factors serialize computation, sharing a single multiplier across multiple operations to fit larger models onto smaller FPGA fabrics.
Vivado and Vitis Backend Support
Targets both Xilinx Vivado HLS (legacy) and Vitis HLS (modern) toolchains. The generated C++ is synthesizable directly into FPGA bitstreams for Zynq, Kintex, Virtex, and Alveo platforms. Includes integration with the PYNQ framework for rapid prototyping on Python-enabled SoCs, enabling over-the-air testing of compressed modulation classifiers.
Layer-Specific Optimization Templates
Implements hand-optimized HLS templates for common neural network layers:
- Convolutional: Im2col with line-buffer caching for spatial locality
- Fully Connected: Tiled matrix-vector multiplication with weight streaming
- Batch Normalization: Mathematically folded into preceding layers
- Activation: Piecewise linear approximations for tanh, sigmoid, and ReLU variants These templates exploit FPGA parallelism efficiently.
Frequently Asked Questions
Addressing the most common technical questions about translating machine learning models for automatic modulation classification into high-performance FPGA firmware using the hls4ml workflow.
hls4ml is an open-source Python package that translates pre-trained machine learning models directly into High-Level Synthesis (HLS) projects, generating register-transfer level (RTL) code for ultra-low latency FPGA inference. For automatic modulation classification, it converts a TensorFlow or PyTorch classifier into a fully pipelined hardware dataflow, bypassing the need for manual VHDL or Verilog coding. The workflow parses the model graph, applies hardware-aware optimizations like operator fusion and batch normalization folding, and generates C++ synthesis directives. This allows an IQ sample stream to be classified with deterministic, single-digit microsecond latency, making it ideal for real-time spectrum awareness and cognitive radio front-ends where GPU batching is infeasible.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core techniques and complementary tools that form the deployment pipeline for translating trained neural networks into optimized FPGA firmware using hls4ml.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us