hls4ml

Machine learning on FPGAs using HLS

https://github.com/fastmachinelearning/hls4ml

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 7 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    17 of 65 committers (26.2%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.1%) to scientific vocabulary

Keywords

fpga hls intel-hls keras machine-learning neural-network onnx python pytorch vivado vivado-hls

Keywords from Contributors

mesh energy-system pipeline-testing datacleaner data-profilers ode transformers spacy-extension hydrology exoplanet
Last synced: 6 months ago · JSON representation ·

Repository

Machine learning on FPGAs using HLS

Basic Info
Statistics
  • Stars: 1,613
  • Watchers: 53
  • Forks: 478
  • Open Issues: 229
  • Releases: 18
Topics
fpga hls intel-hls keras machine-learning neural-network onnx python pytorch vivado vivado-hls
Created over 8 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Citation

README.md

hls4ml

DOI License Documentation Status PyPI version Downloads conda-forge

A package for machine learning inference in FPGAs. We create firmware implementations of machine learning algorithms using high level synthesis language (HLS). We translate traditional open-source machine learning package models into HLS that can be configured for your use-case!

If you have any questions, comments, or ideas regarding hls4ml or just want to show us how you use hls4ml, don't hesitate to reach us through the discussions tab.

Documentation & Tutorial

For more information visit the webpage: https://fastmachinelearning.org/hls4ml/.

For introductory material on FPGAs, HLS and ML inferences using hls4ml, check out the video.

Detailed tutorials on how to use hls4ml's various functionalities can be found here.

Installation

bash pip install hls4ml

To install the extra dependencies for profiling:

bash pip install hls4ml[profiling]

Getting Started

Creating an HLS project

```Python import hls4ml

Fetch a keras model from our example repository

This will download our example model to your working directory and return an example configuration file

config = hls4ml.utils.fetchexamplemodel('KERAS_3layer.json')

You can print the configuration to see some default parameters

print(config)

Convert it to a hls project

hlsmodel = hls4ml.converters.kerasv2tohls(config)

Print full list of example models if you want to explore more

hls4ml.utils.fetchexamplelist() ```

Building a project.

We will build the project using Xilinx Vivado HLS, which can be downloaded and installed from here. Alongside Vivado HLS, hls4ml also supports Vitis HLS, Intel HLS, Catapult HLS and has some experimental support dor Intel oneAPI. The target back-end can be changed using the argument backend when building the model.

```Python

Use Vivado HLS to synthesize the model

This might take several minutes

hls_model.build()

Print out the report if you want

hls4ml.report.readvivadoreport('my-hls-test') ```

FAQ

List of frequently asked questions and common HLS synthesis can be found here

Citation

If you use this software in a publication, please cite the software bibtex @software{fastml_hls4ml, author = {{FastML Team}}, title = {fastmachinelearning/hls4ml}, year = 2025, publisher = {Zenodo}, version = {v1.1.0}, doi = {10.5281/zenodo.1201549}, url = {https://github.com/fastmachinelearning/hls4ml} } and first publication: bibtex @article{Duarte:2018ite, author = "Duarte, Javier and others", title = "{Fast inference of deep neural networks in FPGAs for particle physics}", eprint = "1804.06913", archivePrefix = "arXiv", primaryClass = "physics.ins-det", reportNumber = "FERMILAB-PUB-18-089-E", doi = "10.1088/1748-0221/13/07/P07027", journal = "JINST", volume = "13", number = "07", pages = "P07027", year = "2018" } Additionally, if you use specific features developed in later papers, please cite those as well. For example, CNNs: bibtex @article{Aarrestad:2021zos, author = "Aarrestad, Thea and others", title = "{Fast convolutional neural networks on FPGAs with hls4ml}", eprint = "2101.05108", archivePrefix = "arXiv", primaryClass = "cs.LG", reportNumber = "FERMILAB-PUB-21-130-SCD", doi = "10.1088/2632-2153/ac0ea1", journal = "Mach. Learn. Sci. Tech.", volume = "2", number = "4", pages = "045015", year = "2021" } @article{Ghielmetti:2022ndm, author = "Ghielmetti, Nicol\`{o} and others", title = "{Real-time semantic segmentation on FPGAs for autonomous vehicles with hls4ml}", eprint = "2205.07690", archivePrefix = "arXiv", primaryClass = "cs.CV", reportNumber = "FERMILAB-PUB-22-435-PPD", doi = "10.1088/2632-2153/ac9cb5", journal ="Mach. Learn. Sci. Tech.", year = "2022" } binary/ternary networks: bibtex @article{Loncar:2020hqp, author = "Ngadiuba, Jennifer and others", title = "{Compressing deep neural networks on FPGAs to binary and ternary precision with HLS4ML}", eprint = "2003.06308", archivePrefix = "arXiv", primaryClass = "cs.LG", reportNumber = "FERMILAB-PUB-20-167-PPD-SCD", doi = "10.1088/2632-2153/aba042", journal = "Mach. Learn. Sci. Tech.", volume = "2", pages = "015001", year = "2021" }

Acknowledgments

If you benefited from participating in our community, we ask that you please acknowledge the Fast Machine Learning collaboration, and particular individuals who helped you, in any publications. Please use the following text for this acknowledgment:

We acknowledge the Fast Machine Learning collective as an open community of multi-domain experts and collaborators. This community and <names of individuals>, in particular, were important for the development of this project.

Funding

We gratefully acknowledge previous and current support from the U.S. National Science Foundation (NSF) Harnessing the Data Revolution (HDR) Institute for Accelerating AI Algorithms for Data Driven Discovery (A3D3) under Cooperative Agreement No. PHY-2117997, U.S. Department of Energy (DOE) Office of Science, Office of Advanced Scientific Computing Research under the Real‐time Data Reduction Codesign at the Extreme Edge for Science (XDR) Project (DE-FOA-0002501), DOE Office of Science, Office of High Energy Physics Early Career Research Program (DE-SC0021187, DE-0000247070), and the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (Grant No. 772369).

A3D3 NSF DOE ERC

Owner

  • Name: Fast Machine Learning Lab
  • Login: fastmachinelearning
  • Kind: organization
  • Email: fml@fastmachinelearning.org

Real-time and accelerated ML for fundamental sciences

Citation (CITATION.cff)

cff-version: 1.2.0
message: "Please cite the following works when using this software."
type: software
authors:
- given-names: "FastML Team"
title: "hls4ml"
version: "v1.1.0"
date-released: "2025-03-17"
doi: 10.5281/zenodo.1201549
repository-code: "https://github.com/fastmachinelearning/hls4ml"
url: "https://fastmachinelearning.org/hls4ml"
keywords:
  - python
  - machine-learning
  - FPGA
  - physics
  - tensorflow
  - pytorch
  - onnx
  - qonnx
license: "Apache-2.0"
abstract: |
  hls4ml is an open-source software-hardware codesign workflow
  to interpret and translate machine learning algorithms for
  implementations in hardware, including FPGAs and ASICs.
references:
  - type: article
    title: "Fast inference of deep neural networks on FPGAs with hls4ml"
    authors:
    - family-names: "Duarte"
      given-names: "Javier"
    - family-names: "Han"
      given-names: "Song"
    - family-names: "Harris"
      given-names: "Philip"
    - family-names: "Jindariani"
      given-names: "Sergo"
    - family-names: "Kreinar"
      given-names: "Edward"
    - family-names: "Kreis"
      given-names: "Benjamin"
    - family-names: "Ngadiuba"
      given-names: "Jennifer"
    - family-names: "Pierini"
      given-names: "Maurizio"
    - family-names: "Rivera"
      given-names: "Ryan"
    - family-names: "Tran"
      given-names: "Nhan"
    - family-names: "Wu"
      given-names: "Zhenbin"
    journal: "JINST"
    volume: "13"
    start: "P07027"
    doi: "10.1088/1748-0221/13/07/P07027"
    year: "2018"
    number: "07"

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 1,949
  • Total Committers: 65
  • Avg Commits per committer: 29.985
  • Development Distribution Score (DDS): 0.668
Past Year
  • Commits: 313
  • Committers: 17
  • Avg Commits per committer: 18.412
  • Development Distribution Score (DDS): 0.725
Top Committers
Name Email Commits
Vladimir Loncar v****r 647
Javier Duarte j****e@u****u 225
Jovan Mitrevski j****s@f****v 203
Sioni Summers s****0@i****k 129
Benjamin Ramhorst b****7@g****m 100
Chang Sun c****n@c****h 74
Jan-Frederik Schulte j****e@c****h 74
Ben Kreis b****s@g****m 59
pre-commit-ci[bot] 6****] 50
Nhan Tran n****n@g****m 41
Nicolò Ghielmetti n****i@g****m 35
jngadiub j****a@c****h 32
Duchstf m****9@g****m 25
Dylan R d****0@g****m 20
Hamza Javed h****0@g****m 19
Javier Duarte j****e@c****u 19
ejk e****r@g****m 17
Nemer Chiedde c****e@m****r 14
AdrianAlan a****l@g****m 14
Enrico Lupi e****i@k****h 13
Maksymilian Graczyk m****8@i****k 12
Kelvin k****1@g****m 12
Yutaro y****a@c****h 11
Ben Kreis e****r@i****l 10
ngpaladi n****i 10
hls4ml User d****7@g****m 9
Lauri Laatu l****u@c****r 8
Zhenbin Wu z****u@g****m 4
dependabot[bot] 4****] 4
jicampos j****8@g****m 4
and 35 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 173
  • Total pull requests: 516
  • Average time to close issues: 8 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 103
  • Total pull request authors: 48
  • Average comments per issue: 2.11
  • Average comments per pull request: 1.82
  • Merged pull requests: 364
  • Bot issues: 0
  • Bot pull requests: 58
Past Year
  • Issues: 59
  • Pull requests: 237
  • Average time to close issues: 3 days
  • Average time to close pull requests: 21 days
  • Issue authors: 39
  • Pull request authors: 27
  • Average comments per issue: 1.05
  • Average comments per pull request: 1.33
  • Merged pull requests: 153
  • Bot issues: 0
  • Bot pull requests: 15
Top Authors
Issue Authors
  • jmitrevs (10)
  • AnouarITI (8)
  • sei-jgwohlbier (6)
  • calad0i (5)
  • Smitashree-code (4)
  • qberthet (4)
  • franhervas99 (4)
  • vandenBergArthur (4)
  • zsrabbani (4)
  • vloncar (4)
  • YumingChang666 (3)
  • rfforelli (3)
  • KOVI89alipes (2)
  • jsncepu (2)
  • abd0smaali (2)
Pull Request Authors
  • jmitrevs (124)
  • vloncar (89)
  • calad0i (69)
  • JanFSchulte (57)
  • pre-commit-ci[bot] (54)
  • jmduarte (27)
  • bo3z (16)
  • steltze (8)
  • laurilaatu (8)
  • dgburnette (6)
  • dependabot[bot] (6)
  • jicampos (6)
  • marco66colombo (6)
  • GiuseppeDiGuglielmo (6)
  • jurevreca12 (4)
Top Labels
Issue Labels
bug (122) enhancement (18) good first issue (6) help wanted (3) question (2) please test (2) wontfix (1)
Pull Request Labels
please test (237) bug (64) enhancement (17) dependencies (6) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 2,825 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 6
  • Total versions: 14
  • Total maintainers: 5
pypi.org: hls4ml

Machine learning in FPGAs using HLS

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 6
  • Downloads: 2,825 Last month
Rankings
Stargazers count: 2.2%
Forks count: 2.9%
Dependent repos count: 6.0%
Average: 6.0%
Downloads: 8.9%
Dependent packages count: 10.1%
Last synced: 6 months ago

Dependencies

.github/workflows/build-sphinx.yml actions
  • actions/checkout v1 composite
  • ad-m/github-push-action master composite
  • jmduarte/sphinx-action main composite
.github/workflows/pre-commit.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pre-commit/action v3.0.0 composite
  • trilom/file-changes-action v1.2.4 composite
.github/workflows/pypi-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/test-sphinx.yml actions
  • actions/checkout v1 composite
  • jmduarte/sphinx-action main composite
.github/workflows/update-branch-on-pr.yml actions
  • actions/checkout v3 composite
test/docker/Dockerfile docker
  • continuumio/miniconda latest build
docs/requirements.txt pypi
  • h5py *
  • matplotlib *
  • numpy *
  • onnx >=1.4.0
  • pandas *
  • pyyaml *
  • seaborn *
  • setuptools_scm >=5
  • six *
  • sphinx >=3.2.1
  • sphinx_rtd_theme *
  • toposort >=1.5.0