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.1.tar.gz (9.4 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.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llnn-0.1.1.tar.gz
  • Upload date:
  • Size: 9.4 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.1.tar.gz
Algorithm Hash digest
SHA256 aedd19db0bdd267dfd7c431479652382e4e5882962634da551e2f8c486fd31be
MD5 58d683cf3fe5561f848a415746259c6d
BLAKE2b-256 302e77d5ec8863a3d1a7705298e725938ac0e5c59d6e486a04f3836e7a58e2f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for llnn-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: llnn-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca847a5fac56256d790af774df43e1cdf1edd0d5fd602e949d4a35632ddcd2a5
MD5 d326efdd7f9cf1f97bc985a09ad7bdfe
BLAKE2b-256 a92eb9c84bee037638db87ff2f5e5e10dd5af2d4a8346dd46ce9ca2e46e3c7fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for llnn-0.1.1-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