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 llnn

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

HDL code generation example

python hdl/vhdl/convert2vhdl.py --model model1

LLNN Testbench

We offer a testbench in VHDL code to test a trained MNIST network and additional utility functions to convert the MNIST dataset into binary inputs for hardware validation in simulation.

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.4.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.4-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llnn-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d0027a1688065b1d27b35aa3c0fa32895ba1e6f9874bfa3f3a30fdfa0dd544a4
MD5 d0bd96c3ce05a6e4399818790498d9a9
BLAKE2b-256 397775ae808e370df1fcb365cc8ca030c8e3728cffa631b5a7468351d6c19657

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: llnn-0.1.4-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.12

File hashes

Hashes for llnn-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f1474a906703ce064208710a744bf117162d67f88445b9010d12c98cb4ed2ed9
MD5 5200d77720588092689502528908da68
BLAKE2b-256 9f5a9fdfb32b18e21bee84e00b93dd26364aef7a90bc736501d8a7971833f60d

See more details on using hashes here.

Provenance

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