Skip to main content

LLNN: A Scalable LUT-Based Logic Neural Network Architecture for FPGAs

Project description

image

LLNN: A Scalable LUT-Based Logic Neural Network Architecture for FPGAs

model_comparison_avg-1

This repository implements Look-Up Tables Logic Neural Networks (LLNNs) presented in:

LLNN: A Scalable LUT-Based Logic Neural Network Architecture for FPGAs

g_abstract

📖 Citing

If you use this work, please cite the following paper:

@ARTICLE{11154450,
  author={Ramírez, Iván and Garcia-Espinosa, Francisco J. and Concha, David and Aranda, Luis Alberto and Schiavi, Emanuele},
  journal={IEEE Transactions on Circuits and Systems I: Regular Papers}, 
  title={LLNN: A Scalable LUT-Based Logic Neural Network Architecture for FPGAs}, 
  year={2025},
  volume={},
  number={},
  pages={1-13},
  keywords={Logic gates;Field programmable gate arrays;Biological neural networks;Table lookup;Hardware;Computer architecture;Training;Neurons;Logic;Complexity theory;Logic neural networks;LUT-based neural networks;FPGA implementation;scalability in hardware neural networks;real-time inference},
  doi={10.1109/TCSI.2025.3606054}
}

Installation

pip install -e .

Importing LUTLayer

import torch
from llnn.lutlayer import LUTLayer, Aggregation

model = torch.nn.Sequential(
    torch.nn.Flatten(),
    LUTLayer(input_dim=1000, lut_size=6, n_luts=2048),
    LUTLayer(input_dim=2048, lut_size=6, n_luts=4000),
    Aggregation(num_classes=10, tau=10)
)

Train a model

python main.py --train --save --name model1 --dataset mnist --batch-size 128 -lr 0.01 --num-iterations 10000

Test a trained model

python main.py --load --name model1 --dataset mnist

VHDL

Toolflow 1

VHDL code generation example

python vhdl/convert2vhdl.py --model model1

LUTNN Testbench

We offer a testbench with VHDL code and additional utility functions (e.g., bin_to_hex) for validating a LLNN trained on the MNIST dataset.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llnn-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llnn-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file llnn-0.1.0.tar.gz.

File metadata

  • Download URL: llnn-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llnn-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a23bd5eaf7eeb5e26c479d77e108c0818d0939698e715fd14adedbc666a8b10e
MD5 03bfae125f0442047fa749b5aadb19e5
BLAKE2b-256 0fd32cb68a8ebd980c672fb9ef0c072cd024a7c296e2c0b244c3b4780a91f65e

See more details on using hashes here.

Provenance

The following attestation bundles were made for llnn-0.1.0.tar.gz:

Publisher: publish.yml on capo-urjc/llnn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llnn-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llnn-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llnn-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86879c640506231e28d1f6f5d3a7f4c42c161d138d55239fc80580e7265eca37
MD5 88e8ebdea67e7d6f0ed22ef45147e37d
BLAKE2b-256 5f1ed5f2802553472cbb326d4bc8eb9c0c4c1d3677484da88aac5b09494785d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for llnn-0.1.0-py3-none-any.whl:

Publisher: publish.yml on capo-urjc/llnn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page