arxiv.org·2026/10/21
针对CERN硬件触发器需在微秒级缓冲内裁决事件、而注意力机制因需两个激活相乘且无可吸收常量权重而难以映射为查找表的瓶颈,LEAF把transformer/linformer的QKV投影与输出前馈层等常量矩阵向量乘法转为LUT感知层,key-query与value激活间乘法保留算术形式,并与HGQ-LUT训练、Alkaid生成RTL组成端到端流程。在hls4ml LHC Jet喷注标记任务上,相较先前亚微秒transformer,同输入尺寸下LEAF准确率提高1.8个百分点、LUT降至62k;最高效linformer达**80.4%**准确率和35 ns延迟。消融显示资源节省主要来自LUT感知训练,Alkaid后端为辅,代码已开源至HGQ仓库;作者认为可扩展到异常检测和基础模型,但当前仅在喷注标记上验证。
为什么重要 对做 FPGA 实时推理或触发系统的工程团队,LEAF 提供了可微 LUT 预算下的注意力层,资源显著压缩而不掉精度,且已接入 HGQ/Alkaid 开源链路。适合 做 FPGA 实时推理、CERN 触发系统、量化训练与 HLS 部署的工程师。
我们提出面向 FPGA 的查找表(LUT)感知高效注意力(LEAF)。LEAF 是首个面向 FPGA 的纳秒级 LUT 感知 transformer。部署足够大以表现良好、足够小以适配 FPGA、且足够快以满足 CERN 等实时系统所需的亚微秒时间尺度的 transformer 仍然困难,因为赋予这些模型高表达能力的同样注意力机制也使其硬件实现成本高昂。
LEAF 通过 LUT 感知训练将 query、key、value 投影和最终输出前馈层转换为 FPGA 原生层,创建了为超低延迟推理构建的首个 LUT 感知 transformer 和 linformer 层。注意力机制抵抗 LUT 感知训练,因为它对两个激活值做乘法,而该方法需要常量权重来建表;LEAF 将注意力模块中的常量矩阵-向量乘法建表,其余部分保持算术形式。
在标准喷注标记基准上,在相同输入大小下,与先前最先进的亚微秒 transformer 相比,该方法在使用少 2.9 倍的 LUT 的同时将准确率提高了 1.8 个百分点。我们最高效的基于 LEAF 的 linformer 在输入为 64 个粒子时,以 28k LUT 和 35ns 达到 80.4% 的分类准确率。
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 28k LUTs and 35ns.
准确率
64 粒子
LUT
64 粒子
延迟
64 粒子
粒子数
取最高 pT 粒子
注释 · 这是全表最低 LUT 与最低延迟组合,来自 out-of-context P&R 结果。出自 表1、摘要
EVIDENCE / METHODS
表格
LEAF Transformer 以 78.8% 准确率、62k LUT、62ns 延迟,进入 Pareto 前沿。
| 路径 | Acc.(%) | Lat.(ns) | LUT(k) |
|---|---|---|---|
| LEAF Transformer | 78.8 | 62 | 62 |
| Transformer MAC Alkaid | 77.0 | 80 | 141 |
| Transformer MAC da4ml | 77.0 | 83 | 180 |
| JEDI-linear 术语解释逻辑查找表,将神经网络单输入操作映射为 FPGA 真值表。 | 78.3 | 30 | 42 |
| MLP Mixer MAC | 78.0 | 62 | 63 |
注释 · 同表 P&R 后 Vivado 2025.1 结果;JEDI-linear 延迟更低,但准确率相近。出自 表1
原版排版与图表 · 手机无法内嵌时可在浏览器打开。PDF 插件内选文不能传给网页助手。