{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/compressing-deep-neural-networks-on-fpgas-to","title":"Compressing deep neural networks on FPGAs to binary and ternary precision with HLS4ML","arxiv_id":"2003.06308","date":"2020-03-11","proceeding":null,"authors":["Giuseppe Di Guglielmo","Javier Duarte","Philip Harris","Duc Hoang","Sergo Jindariani","Edward Kreinar","Mia Liu","Vladimir Loncar","Jennifer Ngadiuba","Kevin Pedro","Maurizio Pierini","Dylan Rankin","Sheila Sagear","Sioni Summers","Nhan Tran","Zhenbin Wu"],"abstract":"We present the implementation of binary and ternary neural networks in the hls4ml library, designed to automatically convert deep neural network models to digital circuits with FPGA firmware. Starting from benchmark models trained with floating point precision, we investigate different strategies to reduce the network's resource consumption by reducing the numerical precision of the network parameters to binary or ternary. We discuss the trade-off between model accuracy and resource consumption. In addition, we show how to balance between latency and accuracy by retaining full precision on a selected subset of network components. As an example, we consider two multiclass classification tasks: handwritten digit recognition with the MNIST data set and jet identification with simulated proton-proton collisions at the CERN Large Hadron Collider. The binary and ternary implementation has similar performance to the higher precision implementation while using drastically fewer FPGA resources.","url_abs":"https://arxiv.org/abs/2003.06308v2","url_pdf":"https://arxiv.org/pdf/2003.06308v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"compressing-deep-neural-networks-on-fpgas-to","repo_url":"https://github.com/hls-fpga-machine-learning/hls4ml","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"compressing-deep-neural-networks-on-fpgas-to","repo_url":"https://github.com/fastmachinelearning/hls4ml","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":{"status":"unanswered"}}],"tasks":[{"task_slug":"handwritten-digit-recognition","task_name":"Handwritten Digit Recognition"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2003.06308","atlas_url":"https://app.syntology.ai/?focus=2003.06308","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2003.06308"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/fastmachinelearning/hls4ml","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hls-fpga-machine-learning/hls4ml","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":1,"unverified":5},"by_repo_kind":{"official":{"samples":6,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"bee79d98e7582bd9","entry":"find_minimum_width","repo":"hls-fpga-machine-learning/hls4ml","repo_kind":"official","path":"hls4ml/model/types.py","file_url":"https://github.com/hls-fpga-machine-learning/hls4ml/blob/HEAD/hls4ml/model/types.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bee79d98e7582bd9"}},{"code_sha256_prefix":"254e7a84dc620a57","entry":"array_to_summary","repo":"hls-fpga-machine-learning/hls4ml","repo_kind":"official","path":"hls4ml/model/profiling.py","file_url":"https://github.com/hls-fpga-machine-learning/hls4ml/blob/HEAD/hls4ml/model/profiling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"254e7a84dc620a57"}},{"code_sha256_prefix":"f5cba7fafe8166fd","entry":"boxplot","repo":"hls-fpga-machine-learning/hls4ml","repo_kind":"official","path":"hls4ml/model/profiling.py","file_url":"https://github.com/hls-fpga-machine-learning/hls4ml/blob/HEAD/hls4ml/model/profiling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f5cba7fafe8166fd"}},{"code_sha256_prefix":"8ff9eaa80ce13603","entry":"fetch_example_model","repo":"hls-fpga-machine-learning/hls4ml","repo_kind":"official","path":"hls4ml/utils/example_models.py","file_url":"https://github.com/hls-fpga-machine-learning/hls4ml/blob/HEAD/hls4ml/utils/example_models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8ff9eaa80ce13603"}},{"code_sha256_prefix":"1242fc9c36f9fde0","entry":"get_backend","repo":"hls-fpga-machine-learning/hls4ml","repo_kind":"official","path":"hls4ml/backends/backend.py","file_url":"https://github.com/hls-fpga-machine-learning/hls4ml/blob/HEAD/hls4ml/backends/backend.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1242fc9c36f9fde0"}},{"code_sha256_prefix":"a0f249e116bdec49","entry":"get_unoptimized_hlsmodel","repo":"hls-fpga-machine-learning/hls4ml","repo_kind":"official","path":"hls4ml/model/profiling.py","file_url":"https://github.com/hls-fpga-machine-learning/hls4ml/blob/HEAD/hls4ml/model/profiling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a0f249e116bdec49"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}