arXiv:2610.27078cs.LGOct 2026

Manuscript Offprint

arXiv:2610.27078

LEAF: LUT-aware Efficient Attention on FPGAs

Arianna Cox, Chang Sun, Lauri Laatu, Benedikt Maier, Aadeesh Sharma, Leo Rozanov, Wayne Luk, Maria Spiropulu, Alexander Tapper, Zhiqiang Que

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We introduce Lookup-table (LUT)-aware Efficient Attention on FPGAs (LEAF). LEAF is the first nanosecond-scale LUT-aware transformer for FPGAs. Deploying transformers that are large enough to perform well, small enough to fit on an FPGA, and fast enough to meet the sub-microsecond timescales required by real-time systems such as those at CERN remains difficult, since the same attention mechanism that gives these models their high expressivity also makes them costly to implement in hardware. LEAF converts the query, key, and value projections and the final output feed-forward layer into FPGA-native layers with LUT-aware training, creating the first LUT-aware transformer and linformer layers built for ultra-low-latency inference. Attention resists LUT-aware training because it multiplies two activations where the method needs a constant weight to tabulate; LEAF tabulates the attention block's constant matrix-vector multiplications and leaves the rest in arithmetic form. On a standard jet tagging benchmark this improves accuracy by 1.8 percentage points while using 2.9 times fewer LUTs than the previous state-of-the-art sub-microsecond transformer at the same input size. Our most efficient LEAF-based linformer with 64 input particles reaches 80.4% classification accuracy at 28 k LUTs and 35 ns.

1 Introduction

The CMS [1] and ATLAS [2] experiments at the Large Hadron Collider [3] at CERN generate hundreds of terabytes of data per second from 40 MHz collisions. Since this data cannot all feasibly be stored, the experiments select a small subset of potentially interesting events using a two-level trigger system, consisting of an FPGA-based hardware trigger followed by a software trigger. The experiments can only store the full detector readout for a few microseconds [4, 5], due to limited buffer capacity, and thus the hardware trigger must decide whether to keep each event within this time frame. Any events not selected are permanently discarded, making trigger efficiency crucial for the experiments' physics reach. To improve filtering performance on the hardware trigger, physicists aim to deploy advanced ML algorithms, which demand highly compressed models capable of running on FPGAs within the resource and latency budgets.

Jet tagging, the task of identifying which particle initiated a collimated spray of particles, is a key step in these trigger systems: accurately tagged jets provide an essential handle for distinguishing rare signals of interest from overwhelming Standard Model backgrounds. Jet tagging has also become a standard benchmark within the fast machine learning community, widely used to demonstrate quantization and compression techniques for FPGA-based neural networks, and we therefore use it to compare our LEAF workflow against previous methods.

LUT-aware training replaces arithmetic with truth tables learned during training, absorbing each constant weight into a table indexed by a single input. Attention resists this: the operation that defines

9th Workshop on Machine Learning and the Physical Sciences (ML4PS 2026) it multiplies two activations and offers no constant to absorb, so existing LUT-aware methods [6] provide dense and convolutional layers only. Within the attention block, however, the query, key and value projections and the output feed-forward layer are constant matrix-vector multiplications (CMVMs). We convert all of them to table-based representations, while the activation-activation products remain in arithmetic form. All parts are trained under a single resource budget, so the trade-off between accuracy and hardware cost is optimized across the whole network. We call the resulting LUT-aware transformer and linformer layers LEAF. Combined with HGQ-LUT [6] for training and Alkaid [7] for bit-exact RTL generation, they form an end-to-end workflow that, on the hls4ml jet tagging benchmark, improves accuracy by 1.8 percentage points while using 2.9×2.9 \times fewer LUTs than the previous state-of-the-art sub-microsecond transformer [8] with 32 input particles. We have integrated our transformer and linformer layers into the open-source HGQ [9] repository, enabling the fast machine learning community to develop efficient LUT-aware transformers for their own applications.